From 861f9347d8fd7e39c6f657d10b05bba6b04d2c43 Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Nov 05 2013 14:13:23 +0000 Subject: import gdb-7.6.1-45.el7.src.rpm --- diff --git a/.gdb.metadata b/.gdb.metadata new file mode 100644 index 0000000..c0c7aab --- /dev/null +++ b/.gdb.metadata @@ -0,0 +1,3 @@ +eb6f62eeec66ce3a91388342b0bd9d16eb33ecbc SOURCES/gdb-6.5-bz190810-gdbserver-arch-advice.patch +0b14aa05bd956d4ea4d01a0fc6a3cc950a5278bc SOURCES/gdb-libstdc++-v3-python-r155978.tar.bz2 +0e38633b3902070d9c6755e4c54602148a094361 SOURCES/gdb-7.6.1.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/gdb-6.3-attach-see-vdso-test.patch b/SOURCES/gdb-6.3-attach-see-vdso-test.patch new file mode 100644 index 0000000..a0923f8 --- /dev/null +++ b/SOURCES/gdb-6.3-attach-see-vdso-test.patch @@ -0,0 +1,103 @@ +--- /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/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch b/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch new file mode 100644 index 0000000..6494cde --- /dev/null +++ b/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -0,0 +1,310 @@ +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/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch b/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch new file mode 100644 index 0000000..91dc69a --- /dev/null +++ b/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -0,0 +1,98 @@ +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/SOURCES/gdb-6.3-bz231832-obstack-2gb.patch b/SOURCES/gdb-6.3-bz231832-obstack-2gb.patch new file mode 100644 index 0000000..44971ae --- /dev/null +++ b/SOURCES/gdb-6.3-bz231832-obstack-2gb.patch @@ -0,0 +1,196 @@ +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832 + + +Index: gdb-7.5.50.20130118/gdb/symmisc.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/symmisc.c 2013-01-18 23:54:57.478974289 +0100 ++++ gdb-7.5.50.20130118/gdb/symmisc.c 2013-01-18 23:55:41.650930254 +0100 +@@ -148,10 +148,10 @@ 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 BFD obstack: %d\n"), +- obstack_memory_used (&objfile->per_bfd->storage_obstack)); ++ printf_filtered (_(" Total memory used for objfile obstack: %ld\n"), ++ (long) obstack_memory_used (&objfile->objfile_obstack)); ++ printf_filtered (_(" Total memory used for BFD obstack: %ld\n"), ++ (long) obstack_memory_used (&objfile->per_bfd->storage_obstack)); + printf_filtered (_(" Total memory used for psymbol cache: %d\n"), + bcache_memory_used (psymbol_bcache_get_bcache + (objfile->psymbol_cache))); +Index: gdb-7.5.50.20130118/include/obstack.h +=================================================================== +--- gdb-7.5.50.20130118.orig/include/obstack.h 2013-01-18 23:54:57.478974289 +0100 ++++ gdb-7.5.50.20130118/include/obstack.h 2013-01-18 23:55:10.256999188 +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.5.50.20130118/libiberty/obstack.c +=================================================================== +--- gdb-7.5.50.20130118.orig/libiberty/obstack.c 2013-01-18 23:54:57.478974289 +0100 ++++ gdb-7.5.50.20130118/libiberty/obstack.c 2013-01-18 23:55:10.256999188 +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/SOURCES/gdb-6.3-focus-cmd-prev-test.patch b/SOURCES/gdb-6.3-focus-cmd-prev-test.patch new file mode 100644 index 0000000..88f52f1 --- /dev/null +++ b/SOURCES/gdb-6.3-focus-cmd-prev-test.patch @@ -0,0 +1,28 @@ +--- /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/SOURCES/gdb-6.3-gcore-thread-20050204.patch b/SOURCES/gdb-6.3-gcore-thread-20050204.patch new file mode 100644 index 0000000..31ecbba --- /dev/null +++ b/SOURCES/gdb-6.3-gcore-thread-20050204.patch @@ -0,0 +1,25 @@ +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/SOURCES/gdb-6.3-gstack-20050411.patch b/SOURCES/gdb-6.3-gstack-20050411.patch new file mode 100644 index 0000000..b73eeff --- /dev/null +++ b/SOURCES/gdb-6.3-gstack-20050411.patch @@ -0,0 +1,232 @@ +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.6/gdb/Makefile.in +=================================================================== +--- gdb-7.6.orig/gdb/Makefile.in 2013-05-21 13:26:33.496820763 +0200 ++++ gdb-7.6/gdb/Makefile.in 2013-05-21 13:26:33.609819579 +0200 +@@ -1029,7 +1029,7 @@ info install-info clean-info dvi pdf ins + 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 \ +@@ -1060,7 +1060,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 \ +@@ -1083,6 +1101,18 @@ uninstall: force $(CONFIG_UNINSTALL) + fi + @$(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.6/gdb/gstack.sh +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/gstack.sh 2013-05-21 13:26:55.434625908 +0200 +@@ -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 $GDBARGS /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.6/gdb/testsuite/gdb.base/gstack.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.base/gstack.exp 2013-05-21 13:26:55.434625908 +0200 +@@ -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\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ 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.6/gdb/testsuite/gdb.base/gstack.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.base/gstack.c 2013-05-21 13:26:33.610819569 +0200 +@@ -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/SOURCES/gdb-6.3-ia64-gcore-page0-20050421.patch b/SOURCES/gdb-6.3-ia64-gcore-page0-20050421.patch new file mode 100644 index 0000000..c2c0026 --- /dev/null +++ b/SOURCES/gdb-6.3-ia64-gcore-page0-20050421.patch @@ -0,0 +1,20 @@ +Index: gdb-7.5.50.20130118/gdb/gcore.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/gcore.c 2013-01-18 23:50:56.698573186 +0100 ++++ gdb-7.5.50.20130118/gdb/gcore.c 2013-01-18 23:52:29.636705040 +0100 +@@ -549,8 +549,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/SOURCES/gdb-6.3-ia64-gcore-speedup-20050714.patch b/SOURCES/gdb-6.3-ia64-gcore-speedup-20050714.patch new file mode 100644 index 0000000..f902e62 --- /dev/null +++ b/SOURCES/gdb-6.3-ia64-gcore-speedup-20050714.patch @@ -0,0 +1,126 @@ +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/SOURCES/gdb-6.3-ia64-info-frame-fix-20050725.patch b/SOURCES/gdb-6.3-ia64-info-frame-fix-20050725.patch new file mode 100644 index 0000000..2ebab9e --- /dev/null +++ b/SOURCES/gdb-6.3-ia64-info-frame-fix-20050725.patch @@ -0,0 +1,107 @@ +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/SOURCES/gdb-6.3-ia64-sigill-20051115.patch b/SOURCES/gdb-6.3-ia64-sigill-20051115.patch new file mode 100644 index 0000000..bf8a1f1 --- /dev/null +++ b/SOURCES/gdb-6.3-ia64-sigill-20051115.patch @@ -0,0 +1,95 @@ +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/SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch b/SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch new file mode 100644 index 0000000..c6a7789 --- /dev/null +++ b/SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch @@ -0,0 +1,158 @@ +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/SOURCES/gdb-6.3-inferior-notification-20050721.patch b/SOURCES/gdb-6.3-inferior-notification-20050721.patch new file mode 100644 index 0000000..0eb397c --- /dev/null +++ b/SOURCES/gdb-6.3-inferior-notification-20050721.patch @@ -0,0 +1,315 @@ +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/SOURCES/gdb-6.3-inheritancetest-20050726.patch b/SOURCES/gdb-6.3-inheritancetest-20050726.patch new file mode 100644 index 0000000..ab81976 --- /dev/null +++ b/SOURCES/gdb-6.3-inheritancetest-20050726.patch @@ -0,0 +1,153 @@ +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/SOURCES/gdb-6.3-mapping-zero-inode-test.patch b/SOURCES/gdb-6.3-mapping-zero-inode-test.patch new file mode 100644 index 0000000..73d2446 --- /dev/null +++ b/SOURCES/gdb-6.3-mapping-zero-inode-test.patch @@ -0,0 +1,229 @@ +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/SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch b/SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch new file mode 100644 index 0000000..8e94e00 --- /dev/null +++ b/SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch @@ -0,0 +1,24 @@ +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/SOURCES/gdb-6.3-ppc64syscall-20040622.patch b/SOURCES/gdb-6.3-ppc64syscall-20040622.patch new file mode 100644 index 0000000..a237cc1 --- /dev/null +++ b/SOURCES/gdb-6.3-ppc64syscall-20040622.patch @@ -0,0 +1,111 @@ +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/SOURCES/gdb-6.3-readnever-20050907.patch b/SOURCES/gdb-6.3-readnever-20050907.patch new file mode 100644 index 0000000..5fb51b2 --- /dev/null +++ b/SOURCES/gdb-6.3-readnever-20050907.patch @@ -0,0 +1,98 @@ +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.5.50.20130215/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/doc/gdb.texinfo 2013-02-15 22:31:37.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/doc/gdb.texinfo 2013-02-15 22:34:22.381165443 +0100 +@@ -1026,6 +1026,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.5.50.20130215/gdb/main.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/main.c 2013-02-15 22:31:37.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/main.c 2013-02-15 22:34:22.382165445 +0100 +@@ -447,6 +447,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}, +@@ -1165,6 +1166,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.5.50.20130215/gdb/symfile.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/symfile.c 2013-02-01 20:39:03.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/symfile.c 2013-02-15 22:34:22.383165447 +0100 +@@ -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. */ + + /* Functions this file defines. */ + +Index: gdb-7.5.50.20130215/gdb/dwarf2read.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/dwarf2read.c 2013-02-15 22:31:37.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/dwarf2read.c 2013-02-15 22:34:34.479181584 +0100 +@@ -68,6 +68,7 @@ + #include "gdb_bfd.h" + #include "f-lang.h" + #include "source.h" ++#include "top.h" + + #include + #include "gdb_string.h" +@@ -1793,8 +1794,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.5.50.20130215/gdb/top.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/top.h 2013-01-07 17:40:36.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/top.h 2013-02-15 22:34:22.389165459 +0100 +@@ -58,6 +58,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/SOURCES/gdb-6.3-rh-dummykfail-20041202.patch b/SOURCES/gdb-6.3-rh-dummykfail-20041202.patch new file mode 100644 index 0000000..1f0bc9d --- /dev/null +++ b/SOURCES/gdb-6.3-rh-dummykfail-20041202.patch @@ -0,0 +1,22 @@ +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/SOURCES/gdb-6.3-rh-testlibunwind-20041202.patch b/SOURCES/gdb-6.3-rh-testlibunwind-20041202.patch new file mode 100644 index 0000000..0a121c3 --- /dev/null +++ b/SOURCES/gdb-6.3-rh-testlibunwind-20041202.patch @@ -0,0 +1,103 @@ +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/SOURCES/gdb-6.3-rh-testversion-20041202.patch b/SOURCES/gdb-6.3-rh-testversion-20041202.patch new file mode 100644 index 0000000..7839200 --- /dev/null +++ b/SOURCES/gdb-6.3-rh-testversion-20041202.patch @@ -0,0 +1,19 @@ +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/SOURCES/gdb-6.3-test-dtorfix-20050121.patch b/SOURCES/gdb-6.3-test-dtorfix-20050121.patch new file mode 100644 index 0000000..a8a0266 --- /dev/null +++ b/SOURCES/gdb-6.3-test-dtorfix-20050121.patch @@ -0,0 +1,239 @@ +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/SOURCES/gdb-6.3-test-movedir-20050125.patch b/SOURCES/gdb-6.3-test-movedir-20050125.patch new file mode 100644 index 0000000..4b05c13 --- /dev/null +++ b/SOURCES/gdb-6.3-test-movedir-20050125.patch @@ -0,0 +1,95 @@ +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/SOURCES/gdb-6.3-test-pie-20050107.patch b/SOURCES/gdb-6.3-test-pie-20050107.patch new file mode 100644 index 0000000..c6a8cbc --- /dev/null +++ b/SOURCES/gdb-6.3-test-pie-20050107.patch @@ -0,0 +1,2085 @@ +Index: gdb-7.5.91.20130323/gdb/testsuite/configure.ac +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/testsuite/configure.ac 2013-03-11 09:59:00.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/testsuite/configure.ac 2013-03-23 19:47:24.189683555 +0100 +@@ -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.5.91.20130323/gdb/testsuite/configure +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/testsuite/configure 2013-03-11 09:59:00.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/testsuite/configure 2013-03-23 19:47:47.256822312 +0100 +@@ -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.btrace/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.btrace/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 +@@ -4176,6 +4176,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.5.91.20130323/gdb/testsuite/gdb.pie/attach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/attach.c 2013-03-23 19:47:24.191683466 +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.5.91.20130323/gdb/testsuite/gdb.pie/attach2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/attach2.c 2013-03-23 19:47:24.192683421 +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); ++} +Index: gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/break.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/break.c 2013-03-23 19:47:24.192683421 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/break1.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/break1.c 2013-03-23 19:47:24.192683421 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/coremaker.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/coremaker.c 2013-03-23 19:47:24.192683421 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/attach.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/attach.exp 2013-03-23 19:47:24.193683377 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/break.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/break.exp 2013-03-23 19:47:24.194683332 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/corefile.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/corefile.exp 2013-03-23 19:47:24.194683332 +0100 +@@ -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.5.91.20130323/gdb/testsuite/gdb.pie/Makefile.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.pie/Makefile.in 2013-03-23 19:47:24.194683332 +0100 +@@ -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/SOURCES/gdb-6.3-test-self-20050110.patch b/SOURCES/gdb-6.3-test-self-20050110.patch new file mode 100644 index 0000000..a3ada08 --- /dev/null +++ b/SOURCES/gdb-6.3-test-self-20050110.patch @@ -0,0 +1,101 @@ +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/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch b/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch new file mode 100644 index 0000000..a24c448 --- /dev/null +++ b/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -0,0 +1,246 @@ +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/SOURCES/gdb-6.5-BEA-testsuite.patch b/SOURCES/gdb-6.5-BEA-testsuite.patch new file mode 100644 index 0000000..7c5778c --- /dev/null +++ b/SOURCES/gdb-6.5-BEA-testsuite.patch @@ -0,0 +1,930 @@ +Index: gdb-7.6/gdb/testsuite/gdb.threads/threadcrash.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/threadcrash.c 2013-05-21 13:35:45.592059786 +0200 +@@ -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-7.6/gdb/testsuite/gdb.threads/threadcrash.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/threadcrash.exp 2013-05-21 13:36:01.451056746 +0200 +@@ -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 $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" 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-7.6/gdb/testsuite/gdb.threads/threadcrash.sh +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/threadcrash.sh 2013-05-21 13:35:45.593059786 +0200 +@@ -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-7.6/gdb/testsuite/gdb.threads/threadcrash.sh-orig +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/threadcrash.sh-orig 2013-05-21 13:35:45.593059786 +0200 +@@ -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/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch new file mode 100644 index 0000000..70be875 --- /dev/null +++ b/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -0,0 +1,120 @@ +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 + +It is duplicite to its upstream variant: +http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html +http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html +2007-01-21 Jan Kratochvil + 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/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch new file mode 100644 index 0000000..fa2f4ed --- /dev/null +++ b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -0,0 +1,143 @@ +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 + +2008-02-24 Jan Kratochvil + + 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/SOURCES/gdb-6.5-bz203661-emit-relocs.patch b/SOURCES/gdb-6.5-bz203661-emit-relocs.patch new file mode 100644 index 0000000..cc8e515 --- /dev/null +++ b/SOURCES/gdb-6.5-bz203661-emit-relocs.patch @@ -0,0 +1,17 @@ +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/SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch b/SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch new file mode 100644 index 0000000..41a887a --- /dev/null +++ b/SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch @@ -0,0 +1,450 @@ +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/SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch new file mode 100644 index 0000000..bb6f3f1 --- /dev/null +++ b/SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -0,0 +1,91 @@ +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/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch new file mode 100644 index 0000000..6839678 --- /dev/null +++ b/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -0,0 +1,21 @@ +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 + + +Index: gdb-7.5.50.20130118/gdb/symtab.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/symtab.c 2013-01-18 23:53:22.009797788 +0100 ++++ gdb-7.5.50.20130118/gdb/symtab.c 2013-01-18 23:53:51.044846777 +0100 +@@ -2356,6 +2356,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/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch new file mode 100644 index 0000000..1c9b1f2 --- /dev/null +++ b/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -0,0 +1,79 @@ +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/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch b/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch new file mode 100644 index 0000000..dad4833 --- /dev/null +++ b/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch @@ -0,0 +1,139 @@ +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/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch b/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch new file mode 100644 index 0000000..c77c677 --- /dev/null +++ b/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch @@ -0,0 +1,120 @@ +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/SOURCES/gdb-6.5-last-address-space-byte-test.patch b/SOURCES/gdb-6.5-last-address-space-byte-test.patch new file mode 100644 index 0000000..8bdbb2b --- /dev/null +++ b/SOURCES/gdb-6.5-last-address-space-byte-test.patch @@ -0,0 +1,56 @@ +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/SOURCES/gdb-6.5-missed-trap-on-step-test.patch b/SOURCES/gdb-6.5-missed-trap-on-step-test.patch new file mode 100644 index 0000000..2f4436d --- /dev/null +++ b/SOURCES/gdb-6.5-missed-trap-on-step-test.patch @@ -0,0 +1,83 @@ +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/SOURCES/gdb-6.5-readline-long-line-crash-test.patch b/SOURCES/gdb-6.5-readline-long-line-crash-test.patch new file mode 100644 index 0000000..86a82a4 --- /dev/null +++ b/SOURCES/gdb-6.5-readline-long-line-crash-test.patch @@ -0,0 +1,136 @@ +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/SOURCES/gdb-6.5-section-num-fixup-test.patch b/SOURCES/gdb-6.5-section-num-fixup-test.patch new file mode 100644 index 0000000..53f7fec --- /dev/null +++ b/SOURCES/gdb-6.5-section-num-fixup-test.patch @@ -0,0 +1,111 @@ +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/SOURCES/gdb-6.5-sharedlibrary-path.patch b/SOURCES/gdb-6.5-sharedlibrary-path.patch new file mode 100644 index 0000000..3e0c101 --- /dev/null +++ b/SOURCES/gdb-6.5-sharedlibrary-path.patch @@ -0,0 +1,171 @@ +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/SOURCES/gdb-6.6-bfd-vdso8k.patch b/SOURCES/gdb-6.6-bfd-vdso8k.patch new file mode 100644 index 0000000..06507b0 --- /dev/null +++ b/SOURCES/gdb-6.6-bfd-vdso8k.patch @@ -0,0 +1,119 @@ +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/SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch b/SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch new file mode 100644 index 0000000..efacab5 --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch @@ -0,0 +1,196 @@ +http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html +Subject: Re: [patch] print a more useful error message for "gdb core" + +[ Fixed up since the mail. ] + +On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote: +> Not an exhaustive list, but if we go down the path of converting "gdb +> corefile" to "gdb -c corefile", then we also need to think about "file +> corefile" being converted to "core corefile" [or "target core +> corefile", "core" is apparently deprecated in favor of "target core"] +> and "target exec corefile" -> "target core corefile". Presumably +> "file corefile" (and "target exec corefile") would discard the +> currently selected executable. But maybe not. Will that be confusing +> for users? I don't know. + +While thinking about it overriding some GDB _commands_ was not my intention. + +There is a general assumption if I have a shell COMMAND and some FILE I can do +$ COMMAND FILE +and COMMAND will appropriately load the FILE. + +FSF GDB currently needs to specify also the executable file for core files +which already inhibits this intuitive expectation. OTOH with the build-id +locating patch which could allow such intuitive start notneeding the +executable file. Still it currently did not work due to the required "-c": +$ COMMAND -c COREFILE + +Entering "file", "core-file" or "attach" commands is already explicit enough +so that it IMO should do what the command name says without any +autodetections. The second command line argument +(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but +neither "attach" accepts a core file nor "core-file" accepts a PID. + + +The patch makes sense only with the build-id patchset so this is not submit +for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending +bfd_check_format_matches) as the patch below is its natural extension. + + +Sorry for the delay, +Jan + + +2010-01-25 Jan Kratochvil + + * exceptions.h (enum errors ): New. + * exec.c: Include exceptions.h. + (exec_file_attach ): Call throw_error (IS_CORE_ERROR, ...). + * main.c (exec_or_core_file_attach): New. + (captured_main ): Set also corearg. + (captured_main ): New variable func. + Call exec_or_core_file_attach if COREARG matches EXECARG. Call + symbol_file_add_main only if CORE_BFD remained NULL. + +Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html +2010-01-20 Doug Evans + + * exec.c (exec_file_attach): Print a more useful error message if the + user did "gdb core". + +Index: gdb-7.5.91.20130323/gdb/exceptions.h +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/exceptions.h 2013-03-22 21:41:45.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/exceptions.h 2013-03-23 19:49:05.738459185 +0100 +@@ -90,6 +90,9 @@ enum errors { + aborted as the inferior state is no longer valid. */ + TARGET_CLOSE_ERROR, + ++ /* Attempt to load a core file as executable. */ ++ IS_CORE_ERROR, ++ + /* Add more errors here. */ + NR_ERRORS + }; +Index: gdb-7.5.91.20130323/gdb/exec.c +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/exec.c 2013-01-31 19:37:37.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/exec.c 2013-03-23 19:48:53.284575912 +0100 +@@ -34,6 +34,7 @@ + #include "gdbthread.h" + #include "progspace.h" + #include "gdb_bfd.h" ++#include "exceptions.h" + + #include + #include "readline/readline.h" +@@ -240,12 +241,27 @@ exec_file_attach (char *filename, int fr + + if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) + { ++ int is_core; ++ ++ /* If the user accidentally did "gdb core", print a useful ++ error message. Check it only after bfd_object has been checked as ++ a valid executable may get recognized for example also as ++ "trad-core". */ ++ is_core = bfd_check_format (exec_bfd, bfd_core); ++ + /* Make sure to close exec_bfd, or else "run" might try to use + it. */ + exec_close (); +- error (_("\"%s\": not in executable format: %s"), +- scratch_pathname, +- gdb_bfd_errmsg (bfd_get_error (), matching)); ++ ++ if (is_core != 0) ++ throw_error (IS_CORE_ERROR, ++ _("\"%s\" is a core file.\n" ++ "Please specify an executable to debug."), ++ scratch_pathname); ++ else ++ error (_("\"%s\": not in executable format: %s"), ++ scratch_pathname, ++ gdb_bfd_errmsg (bfd_get_error (), matching)); + } + + /* FIXME - This should only be run for RS6000, but the ifdef is a poor +Index: gdb-7.5.91.20130323/gdb/main.c +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/main.c 2013-03-23 19:48:18.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/main.c 2013-03-23 19:48:53.285575901 +0100 +@@ -296,6 +296,36 @@ typedef struct cmdarg { + /* Define type VEC (cmdarg_s). */ + DEF_VEC_O (cmdarg_s); + ++/* Call exec_file_attach. If it detected FILENAME is a core file call ++ core_file_command. Print the original exec_file_attach error only if ++ core_file_command failed to find a matching executable. */ ++ ++static void ++exec_or_core_file_attach (char *filename, int from_tty) ++{ ++ volatile struct gdb_exception e; ++ ++ gdb_assert (exec_bfd == NULL); ++ ++ TRY_CATCH (e, RETURN_MASK_ALL) ++ { ++ exec_file_attach (filename, from_tty); ++ } ++ if (e.reason < 0) ++ { ++ if (e.error == IS_CORE_ERROR) ++ { ++ core_file_command (filename, from_tty); ++ ++ /* Iff the core file found its executable suppress the error message ++ from exec_file_attach. */ ++ if (exec_bfd != NULL) ++ return; ++ } ++ throw_exception (e); ++ } ++} ++ + static int + captured_main (void *data) + { +@@ -796,6 +826,8 @@ captured_main (void *data) + { + symarg = argv[optind]; + execarg = argv[optind]; ++ if (optind + 1 == argc && corearg == NULL) ++ corearg = argv[optind]; + optind++; + } + +@@ -951,11 +983,25 @@ captured_main (void *data) + && symarg != NULL + && strcmp (execarg, symarg) == 0) + { ++ catch_command_errors_ftype *func; ++ ++ /* Call exec_or_core_file_attach only if the file was specified as ++ a command line argument (and not an a command line option). */ ++ if (corearg != NULL && strcmp (corearg, execarg) == 0) ++ { ++ func = exec_or_core_file_attach; ++ corearg = NULL; ++ } ++ else ++ func = exec_file_attach; ++ + /* The exec file and the symbol-file are the same. If we can't + open it, better only print one error message. +- catch_command_errors returns non-zero on success! */ +- if (catch_command_errors (exec_file_attach, execarg, +- !batch_flag, RETURN_MASK_ALL)) ++ catch_command_errors returns non-zero on success! ++ Do not load EXECARG as a symbol file if it has been already processed ++ as a core file. */ ++ if (catch_command_errors (func, execarg, !batch_flag, RETURN_MASK_ALL) ++ && core_bfd == NULL) + catch_command_errors (symbol_file_add_main, symarg, + !batch_flag, RETURN_MASK_ALL); + } diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch new file mode 100644 index 0000000..617bef9 --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -0,0 +1,36 @@ +Index: gdb-7.4.50.20120602/gdb/elfread.c +=================================================================== +--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:35:09.669510757 +0200 ++++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:35:31.106502660 +0200 +@@ -1658,6 +1658,19 @@ build_id_to_filename (struct build_id *b + #include + #endif + ++/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031 ++ librpm must not exit() an application on SIGINT ++ ++ Enable or disable a signal handler. SIGNUM: signal to enable (or disable ++ if negative). HANDLER: sa_sigaction handler (or NULL to use ++ rpmsqHandler()). Returns: no. of refs, -1 on error. */ ++extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler); ++int ++rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler) ++{ ++ return 0; ++} ++ + /* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files + and avoid their duplicities during a single inferior run. */ + +Index: gdb-7.4.50.20120602/gdb/proc-service.list +=================================================================== +--- gdb-7.4.50.20120602.orig/gdb/proc-service.list 2012-06-02 21:35:09.669510757 +0200 ++++ gdb-7.4.50.20120602/gdb/proc-service.list 2012-06-02 21:35:14.296508989 +0200 +@@ -37,4 +37,7 @@ + ps_pstop; + ps_ptread; + ps_ptwrite; ++ ++ /* gdb-6.6-buildid-locate-rpm.patch */ ++ rpmsqEnable; + }; diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch b/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch new file mode 100644 index 0000000..0fe8877 --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch @@ -0,0 +1,105 @@ +warning: Skipping deprecated .gdb_index section +https://bugzilla.redhat.com/show_bug.cgi?id=953585 + +--- gdb-7.5.91.20130407-orig/gdb/dwarf2read.c 2013-04-22 15:47:18.837806752 +0200 ++++ gdb-7.5.91.20130407/gdb/dwarf2read.c 2013-04-22 16:12:55.043171881 +0200 +@@ -2700,6 +2700,14 @@ read_index_from_section (struct objfile + "set use-deprecated-index-sections on". */ + if (version < 6 && !deprecated_ok) + { ++ extern int rpm_verify_vendor (const char *filename); ++ ++ /* Red Hat Developer Toolset exception. */ ++ if (rpm_verify_vendor (filename)) ++ {} ++ else ++ { ++ + static int warning_printed = 0; + if (!warning_printed) + { +@@ -2711,6 +2719,8 @@ to use the section anyway."), + warning_printed = 1; + } + return 0; ++ ++ } + } + /* Version 7 indices generated by gold refer to the CU for a symbol instead + of the TU (for symbols coming from TUs). It's just a performance bug, and +--- gdb-7.5.91.20130407-orig/gdb/elfread.c 2013-04-22 15:47:18.637807200 +0200 ++++ gdb-7.5.91.20130407/gdb/elfread.c 2013-04-22 16:04:09.259429034 +0200 +@@ -1674,7 +1674,7 @@ static int missing_rpm_list_entries; + /* Returns the count of newly added rpms. */ + + static int +-missing_rpm_enlist (const char *filename) ++missing_rpm_enlist_1 (const char *filename, int verify_vendor) + { + static int rpm_init_done = 0; + rpmts ts; +@@ -1778,7 +1778,7 @@ missing_rpm_enlist (const char *filename + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); + if (mi != NULL) + { +- for (;;) ++ if (!verify_vendor) for (;;) + { + Header h; + char *debuginfo, **slot, *s, *s2; +@@ -1897,6 +1897,35 @@ missing_rpm_enlist (const char *filename + xfree (debuginfo); + count++; + } ++ else /* verify_vendor */ ++ { ++ int vendor_pass = 0, vendor_fail = 0; ++ ++ for (;;) ++ { ++ Header h; ++ errmsg_t err; ++ char *vendor; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ vendor = headerFormat_p (h, "%{vendor}", &err); ++ if (!vendor) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ if (strcmp (vendor, "Red Hat, Inc.") == 0) ++ vendor_pass = 1; ++ else ++ vendor_fail = 1; ++ xfree (vendor); ++ } ++ count = vendor_pass != 0 && vendor_fail == 0; ++ } + + rpmdbFreeIterator_p (mi); + } +@@ -1907,6 +1936,19 @@ missing_rpm_enlist (const char *filename + } + + static int ++missing_rpm_enlist (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 0); ++} ++ ++extern int rpm_verify_vendor (const char *filename); ++int ++rpm_verify_vendor (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 1); ++} ++ ++static int + missing_rpm_list_compar (const char *const *ap, const char *const *bp) + { + return strcoll (*ap, *bp); diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm.patch b/SOURCES/gdb-6.6-buildid-locate-rpm.patch new file mode 100644 index 0000000..5d5e1be --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm.patch @@ -0,0 +1,1476 @@ +Index: gdb-7.6/gdb/event-top.c +=================================================================== +--- gdb-7.6.orig/gdb/event-top.c 2013-01-31 19:37:37.000000000 +0100 ++++ gdb-7.6/gdb/event-top.c 2013-07-17 19:51:02.679357656 +0200 +@@ -36,6 +36,7 @@ + #include "continuations.h" + #include "gdbcmd.h" /* for dont_repeat() */ + #include "annotate.h" ++#include "symfile.h" + + /* readline include files. */ + #include "readline/readline.h" +@@ -170,6 +171,8 @@ rl_callback_read_char_wrapper (gdb_clien + void + cli_command_loop (void) + { ++ debug_flush_missing (); ++ + display_gdb_prompt (0); + + /* Now it's time to start the event loop. */ +@@ -237,6 +240,8 @@ display_gdb_prompt (char *new_prompt) + /* Reset the nesting depth used when trace-commands is set. */ + reset_command_nest_depth (); + ++ debug_flush_missing (); ++ + /* Each interpreter has its own rules on displaying the command + prompt. */ + if (!current_interp_display_prompt_p ()) +Index: gdb-7.6/gdb/elfread.c +=================================================================== +--- gdb-7.6.orig/gdb/elfread.c 2013-07-17 19:51:02.639357629 +0200 ++++ gdb-7.6/gdb/elfread.c 2013-07-17 19:51:50.738390068 +0200 +@@ -49,6 +49,7 @@ + #include "gdbcore.h" + #include "gdbcmd.h" + #include "observer.h" ++#include "elf/external.h" + #include + + extern void _initialize_elfread (void); +@@ -1682,8 +1683,360 @@ build_id_to_filename (const struct elf_b + return retval; + } + ++#ifdef HAVE_LIBRPM ++ ++#include ++#include ++#include ++#include ++#ifdef DLOPEN_LIBRPM ++#include ++#endif ++ ++/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files ++ and avoid their duplicities during a single inferior run. */ ++ ++static struct htab *missing_rpm_hash; ++ ++/* This MISSING_RPM_LIST tracker is used to collect and print as a single line ++ all the rpms right before the nearest GDB prompt. It gets cleared after ++ each such print (it is questionable if we should clear it after the print). ++ */ ++ ++struct missing_rpm ++ { ++ struct missing_rpm *next; ++ char rpm[1]; ++ }; ++static struct missing_rpm *missing_rpm_list; ++static int missing_rpm_list_entries; ++ ++/* Returns the count of newly added rpms. */ ++ ++static int ++missing_rpm_enlist (const char *filename) ++{ ++ static int rpm_init_done = 0; ++ rpmts ts; ++ rpmdbMatchIterator mi; ++ int count = 0; ++ ++#ifdef DLOPEN_LIBRPM ++ /* Duplicate here the declarations to verify they match. The same sanity ++ check is present also in `configure.ac'. */ ++ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); ++ extern int rpmReadConfigFiles(const char * file, const char * target); ++ static int (*rpmReadConfigFiles_p) (const char * file, const char * target); ++ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); ++ extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); ++ extern rpmts rpmtsCreate(void); ++ static rpmts (*rpmtsCreate_p) (void); ++ extern rpmts rpmtsFree(rpmts ts); ++ static rpmts (*rpmtsFree_p) (rpmts ts); ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, ++ rpmTag rpmtag, ++ const void *keyp, ++ size_t keylen); ++#else /* !DLOPEN_LIBRPM */ ++# define headerFormat_p headerFormat ++# define rpmReadConfigFiles_p rpmReadConfigFiles ++# define rpmdbFreeIterator_p rpmdbFreeIterator ++# define rpmdbNextIterator_p rpmdbNextIterator ++# define rpmtsCreate_p rpmtsCreate ++# define rpmtsFree_p rpmtsFree ++# define rpmtsInitIterator_p rpmtsInitIterator ++#endif /* !DLOPEN_LIBRPM */ ++ ++ gdb_assert (filename != NULL); ++ ++ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) ++ return 0; ++ ++ if (filename[0] != '/') ++ { ++ warning (_("Ignoring non-absolute filename: <%s>"), filename); ++ return 0; ++ } ++ ++ if (!rpm_init_done) ++ { ++ static int init_tried; ++ ++ /* Already failed the initialization before? */ ++ if (init_tried) ++ return 0; ++ init_tried = 1; ++ ++#ifdef DLOPEN_LIBRPM ++ { ++ void *h; ++ ++ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); ++ if (!h) ++ { ++ warning (_("Unable to open \"%s\" (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ return 0; ++ } ++ ++ if (!((headerFormat_p = dlsym (h, "headerFormat")) ++ && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles")) ++ && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator")) ++ && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator")) ++ && (rpmtsCreate_p = dlsym (h, "rpmtsCreate")) ++ && (rpmtsFree_p = dlsym (h, "rpmtsFree")) ++ && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator")))) ++ { ++ warning (_("Opened library \"%s\" is incompatible (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ if (dlclose (h)) ++ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, ++ dlerror ()); ++ return 0; ++ } ++ } ++#endif /* DLOPEN_LIBRPM */ ++ ++ if (rpmReadConfigFiles_p (NULL, NULL) != 0) ++ { ++ warning (_("Error reading the rpm configuration files")); ++ return 0; ++ } ++ ++ rpm_init_done = 1; ++ } ++ ++ ts = rpmtsCreate_p (); ++ ++ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); ++ if (mi != NULL) ++ { ++ for (;;) ++ { ++ Header h; ++ char *debuginfo, **slot, *s, *s2; ++ errmsg_t err; ++ size_t srcrpmlen = sizeof (".src.rpm") - 1; ++ size_t debuginfolen = sizeof ("-debuginfo") - 1; ++ rpmdbMatchIterator mi_debuginfo; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ /* Verify the debuginfo file is not already installed. */ ++ ++ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ s = strrchr (debuginfo, '-') - srcrpmlen; ++ s2 = NULL; ++ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) ++ { ++ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = memrchr (debuginfo, '-', s - debuginfo); ++ } ++ if (s2) ++ { ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = memrchr (debuginfo, '-', s2 - debuginfo); ++ } ++ if (!s2) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ debuginfo); ++ xfree (debuginfo); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ memmove (s2 + debuginfolen, s2, s - s2); ++ memcpy (s2, "-debuginfo", debuginfolen); ++ /* s = `XXXX.%{arch}' */ ++ /* strlen ("XXXX") == srcrpmlen + debuginfolen */ ++ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ ++ /* strlen ("XX") == srcrpmlen */ ++ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, ++ strlen (s + srcrpmlen + debuginfolen) + 1); ++ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ ++ ++ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ ++ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ ++ mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0); ++ xfree (debuginfo); ++ if (mi_debuginfo) ++ { ++ rpmdbFreeIterator_p (mi_debuginfo); ++ count = 0; ++ break; ++ } ++ ++ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ ++ debuginfo = headerFormat_p (h, ++ "%{name}-%{version}-%{release}.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ ++ /* Base package name for `debuginfo-install'. We do not use the ++ `yum' command directly as the line ++ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH ++ would be more complicated than just: ++ debuginfo-install NAME-VERSION-RELEASE.ARCH ++ Do not supply the rpm base name (derived from .src.rpm name) as ++ debuginfo-install is unable to install the debuginfo package if ++ the base name PKG binary rpm is not installed while for example ++ PKG-libs would be installed (RH Bug 467901). ++ FUTURE: After multiple debuginfo versions simultaneously installed ++ get supported the support for the VERSION-RELEASE tags handling ++ may need an update. */ ++ ++ if (missing_rpm_hash == NULL) ++ { ++ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE ++ should not deallocate the entries. */ ++ ++ missing_rpm_hash = htab_create_alloc (64, htab_hash_string, ++ (int (*) (const void *, const void *)) streq, ++ NULL, xcalloc, xfree); ++ } ++ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); ++ /* XCALLOC never returns NULL. */ ++ gdb_assert (slot != NULL); ++ if (*slot == NULL) ++ { ++ struct missing_rpm *missing_rpm; ++ ++ *slot = debuginfo; ++ ++ missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); ++ strcpy (missing_rpm->rpm, debuginfo); ++ missing_rpm->next = missing_rpm_list; ++ missing_rpm_list = missing_rpm; ++ missing_rpm_list_entries++; ++ } ++ else ++ xfree (debuginfo); ++ count++; ++ } ++ ++ rpmdbFreeIterator_p (mi); ++ } ++ ++ rpmtsFree_p (ts); ++ ++ return count; ++} ++ ++static int ++missing_rpm_list_compar (const char *const *ap, const char *const *bp) ++{ ++ return strcoll (*ap, *bp); ++} ++ ++/* It returns a NULL-terminated array of strings needing to be FREEd. It may ++ also return only NULL. */ ++ ++static void ++missing_rpm_list_print (void) ++{ ++ char **array, **array_iter; ++ struct missing_rpm *list_iter; ++ struct cleanup *cleanups; ++ ++ if (missing_rpm_list_entries == 0) ++ return; ++ ++ array = xmalloc (sizeof (*array) * missing_rpm_list_entries); ++ cleanups = make_cleanup (xfree, array); ++ ++ array_iter = array; ++ for (list_iter = missing_rpm_list; list_iter != NULL; ++ list_iter = list_iter->next) ++ { ++ *array_iter++ = list_iter->rpm; ++ } ++ gdb_assert (array_iter == array + missing_rpm_list_entries); ++ ++ qsort (array, missing_rpm_list_entries, sizeof (*array), ++ (int (*) (const void *, const void *)) missing_rpm_list_compar); ++ ++ printf_unfiltered (_("Missing separate debuginfos, use: %s"), ++ "debuginfo-install"); ++ for (array_iter = array; array_iter < array + missing_rpm_list_entries; ++ array_iter++) ++ { ++ putchar_unfiltered (' '); ++ puts_unfiltered (*array_iter); ++ } ++ putchar_unfiltered ('\n'); ++ ++ while (missing_rpm_list != NULL) ++ { ++ list_iter = missing_rpm_list; ++ missing_rpm_list = list_iter->next; ++ xfree (list_iter); ++ } ++ missing_rpm_list_entries = 0; ++ ++ do_cleanups (cleanups); ++} ++ ++static void ++missing_rpm_change (void) ++{ ++ debug_flush_missing (); ++ ++ gdb_assert (missing_rpm_list == NULL); ++ if (missing_rpm_hash != NULL) ++ { ++ htab_delete (missing_rpm_hash); ++ missing_rpm_hash = NULL; ++ } ++} ++ ++enum missing_exec ++ { ++ /* Init state. EXEC_BFD also still could be NULL. */ ++ MISSING_EXEC_NOT_TRIED, ++ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ ++ MISSING_EXEC_NOT_FOUND, ++ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded ++ or separate) or the main executable's RPM is now contained in ++ MISSING_RPM_HASH. */ ++ MISSING_EXEC_ENLISTED ++ }; ++static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; ++ ++#endif /* HAVE_LIBRPM */ ++ ++void ++debug_flush_missing (void) ++{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_list_print (); ++#endif ++} ++ + /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages +- Try to install the hash file ... ++ yum --enablerepo='*debug*' install ... + avoidance. */ + + struct missing_filepair +@@ -1737,11 +2090,17 @@ missing_filepair_change (void) + /* All their memory came just from missing_filepair_OBSTACK. */ + missing_filepair_hash = NULL; + } ++#ifdef HAVE_LIBRPM ++ missing_exec = MISSING_EXEC_NOT_TRIED; ++#endif + } + + static void + debug_print_executable_changed (void) + { ++#ifdef HAVE_LIBRPM ++ missing_rpm_change (); ++#endif + missing_filepair_change (); + } + +@@ -1808,14 +2167,34 @@ debug_print_missing (const char *binary, + + *slot = missing_filepair; + +- /* We do not collect and flush these messages as each such message +- already requires its own separate lines. */ ++#ifdef HAVE_LIBRPM ++ if (missing_exec == MISSING_EXEC_NOT_TRIED) ++ { ++ char *execfilename; + +- fprintf_unfiltered (gdb_stdlog, +- _("Missing separate debuginfo for %s\n"), binary); +- if (debug != NULL) +- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), +- debug); ++ execfilename = get_exec_file (0); ++ if (execfilename != NULL) ++ { ++ if (missing_rpm_enlist (execfilename) == 0) ++ missing_exec = MISSING_EXEC_NOT_FOUND; ++ else ++ missing_exec = MISSING_EXEC_ENLISTED; ++ } ++ } ++ if (missing_exec != MISSING_EXEC_ENLISTED) ++ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) ++ && (debug == NULL || missing_rpm_enlist (debug) == 0)) ++#endif /* HAVE_LIBRPM */ ++ { ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ fprintf_unfiltered (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), ++ "yum --enablerepo='*debug*' install", debug); ++ } + } + + static char * +Index: gdb-7.6/gdb/symfile.h +=================================================================== +--- gdb-7.6.orig/gdb/symfile.h 2013-07-17 19:51:02.639357629 +0200 ++++ gdb-7.6/gdb/symfile.h 2013-07-17 19:51:02.687357661 +0200 +@@ -598,6 +598,8 @@ extern struct elf_build_id *build_id_add + extern char *build_id_to_filename (const struct elf_build_id *build_id, + char **link_return, int add_debug_suffix); + extern void debug_print_missing (const char *binary, const char *debug); ++extern void debug_flush_missing (void); ++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") + + /* From dwarf2read.c */ + +Index: gdb-7.6/gdb/testsuite/lib/gdb.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-07-17 19:51:02.640357629 +0200 ++++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-07-17 19:51:02.688357662 +0200 +@@ -1482,7 +1482,7 @@ proc default_gdb_start { } { + warning "Couldn't set the width to 0." + } + } +- # Turn off the missing warnings as the testsuite does not expect it. ++ # Turn off the missing RPMs warnings as the testsuite does not expect it. + send_gdb "set build-id-verbose 0\n" + gdb_expect 10 { + -re "$gdb_prompt $" { +Index: gdb-7.6/gdb/testsuite/lib/mi-support.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/mi-support.exp 2013-07-17 19:51:02.656357640 +0200 ++++ gdb-7.6/gdb/testsuite/lib/mi-support.exp 2013-07-17 19:51:02.689357663 +0200 +@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } { + warning "Couldn't set the width to 0." + } + } +- # Turn off the missing warnings as the testsuite does not expect it. ++ # Turn off the missing RPMs warnings as the testsuite does not expect it. + send_gdb "190-gdb-set build-id-verbose 0\n" + gdb_expect 10 { + -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { +Index: gdb-7.6/gdb/tui/tui-interp.c +=================================================================== +--- gdb-7.6.orig/gdb/tui/tui-interp.c 2013-01-01 07:41:30.000000000 +0100 ++++ gdb-7.6/gdb/tui/tui-interp.c 2013-07-17 19:51:02.689357663 +0200 +@@ -30,6 +30,7 @@ + #include "tui/tui.h" + #include "tui/tui-io.h" + #include "exceptions.h" ++#include "symfile.h" + + /* Set to 1 when the TUI mode must be activated when we first start + gdb. */ +Index: gdb-7.6/gdb/aclocal.m4 +=================================================================== +--- gdb-7.6.orig/gdb/aclocal.m4 2013-01-17 12:06:26.000000000 +0100 ++++ gdb-7.6/gdb/aclocal.m4 2013-07-17 19:51:02.689357663 +0200 +@@ -11,6 +11,164 @@ + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + ++# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- ++# serial 1 (pkg-config-0.24) ++# ++# Copyright © 2004 Scott James Remnant . ++# ++# This program is free software; you can 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. ++# ++# As a special exception to the GNU General Public License, if you ++# distribute this file as part of a program that contains a ++# configuration script generated by Autoconf, you may include it under ++# the same distribution terms that you use for the rest of that program. ++ ++# PKG_PROG_PKG_CONFIG([MIN-VERSION]) ++# ---------------------------------- ++AC_DEFUN([PKG_PROG_PKG_CONFIG], ++[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) ++m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) ++AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) ++AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) ++AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=m4_default([$1], [0.9.0]) ++ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++ PKG_CONFIG="" ++ fi ++fi[]dnl ++])# PKG_PROG_PKG_CONFIG ++ ++# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) ++# ++# Check to see whether a particular set of modules exists. Similar ++# to PKG_CHECK_MODULES(), but does not set variables or print errors. ++# ++# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++# only at the first occurence in configure.ac, so if the first place ++# it's called might be skipped (such as if it is within an "if", you ++# have to call PKG_CHECK_EXISTS manually ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_EXISTS], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++if test -n "$PKG_CONFIG" && \ ++ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then ++ m4_default([$2], [:]) ++m4_ifvaln([$3], [else ++ $3])dnl ++fi]) ++ ++# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) ++# --------------------------------------------- ++m4_define([_PKG_CONFIG], ++[if test -n "$$1"; then ++ pkg_cv_[]$1="$$1" ++ elif test -n "$PKG_CONFIG"; then ++ PKG_CHECK_EXISTS([$3], ++ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], ++ [pkg_failed=yes]) ++ else ++ pkg_failed=untried ++fi[]dnl ++])# _PKG_CONFIG ++ ++# _PKG_SHORT_ERRORS_SUPPORTED ++# ----------------------------- ++AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi[]dnl ++])# _PKG_SHORT_ERRORS_SUPPORTED ++ ++ ++# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], ++# [ACTION-IF-NOT-FOUND]) ++# ++# ++# Note that if there is a possibility the first call to ++# PKG_CHECK_MODULES might not happen, you should be sure to include an ++# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac ++# ++# ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_MODULES], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl ++AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl ++ ++pkg_failed=no ++AC_MSG_CHECKING([for $1]) ++ ++_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) ++_PKG_CONFIG([$1][_LIBS], [libs], [$2]) ++ ++m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS ++and $1[]_LIBS to avoid the need to call pkg-config. ++See the pkg-config man page for more details.]) ++ ++if test $pkg_failed = yes; then ++ AC_MSG_RESULT([no]) ++ _PKG_SHORT_ERRORS_SUPPORTED ++ if test $_pkg_short_errors_supported = yes; then ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` ++ else ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ++ ++ m4_default([$4], [AC_MSG_ERROR( ++[Package requirements ($2) were not met: ++ ++$$1_PKG_ERRORS ++ ++Consider adjusting the PKG_CONFIG_PATH environment variable if you ++installed software in a non-standard prefix. ++ ++_PKG_TEXT]) ++ ]) ++elif test $pkg_failed = untried; then ++ AC_MSG_RESULT([no]) ++ m4_default([$4], [AC_MSG_FAILURE( ++[The pkg-config script could not be found or is too old. Make sure it ++is in your PATH or set the PKG_CONFIG environment variable to the full ++path to pkg-config. ++ ++_PKG_TEXT ++ ++To get pkg-config, see .]) ++ ]) ++else ++ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS ++ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS ++ AC_MSG_RESULT([yes]) ++ $3 ++fi[]dnl ++])# PKG_CHECK_MODULES ++ + # AM_CONDITIONAL -*- Autoconf -*- + + # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +Index: gdb-7.6/gdb/config.in +=================================================================== +--- gdb-7.6.orig/gdb/config.in 2012-12-09 19:39:58.000000000 +0100 ++++ gdb-7.6/gdb/config.in 2013-07-17 19:51:02.689357663 +0200 +@@ -33,6 +33,9 @@ + /* Define to BFD's default target vector. */ + #undef DEFAULT_BFD_VEC + ++/* librpm version specific library name to dlopen. */ ++#undef DLOPEN_LIBRPM ++ + /* Define to 1 if translation of program messages to the user's native + language is requested. */ + #undef ENABLE_NLS +@@ -210,6 +213,9 @@ + /* Define if Python 2.7 is being used. */ + #undef HAVE_LIBPYTHON2_7 + ++/* Define if librpm library is being used. */ ++#undef HAVE_LIBRPM ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIBUNWIND_IA64_H + +Index: gdb-7.6/gdb/configure +=================================================================== +--- gdb-7.6.orig/gdb/configure 2013-07-17 19:51:01.665356963 +0200 ++++ gdb-7.6/gdb/configure 2013-07-17 19:51:02.691357664 +0200 +@@ -686,6 +686,11 @@ PKGVERSION + HAVE_NATIVE_GCORE_TARGET + TARGET_OBS + subdirs ++RPM_LIBS ++RPM_CFLAGS ++PKG_CONFIG_LIBDIR ++PKG_CONFIG_PATH ++PKG_CONFIG + GDB_DATADIR + DEBUGDIR + MAKEINFO_EXTRA_FLAGS +@@ -786,6 +791,7 @@ with_gdb_datadir + with_relocated_sources + with_auto_load_dir + with_auto_load_safe_path ++with_rpm + enable_targets + enable_64_bit_bfd + enable_gdbcli +@@ -834,6 +840,11 @@ CPPFLAGS + CPP + MAKEINFO + MAKEINFOFLAGS ++PKG_CONFIG ++PKG_CONFIG_PATH ++PKG_CONFIG_LIBDIR ++RPM_CFLAGS ++RPM_LIBS + YACC + YFLAGS + XMKMF' +@@ -1504,6 +1515,8 @@ Optional Packages: + [--with-auto-load-dir] + --without-auto-load-safe-path + do not restrict auto-loaded files locations ++ --with-rpm query rpm database for missing debuginfos (yes/no, ++ def. auto=librpm.so) + --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets + --with-curses use the curses library instead of the termcap + library +@@ -1548,6 +1561,13 @@ Some influential environment variables: + MAKEINFO Parent configure detects if it is of sufficient version. + MAKEINFOFLAGS + Parameters for MAKEINFO. ++ PKG_CONFIG path to pkg-config utility ++ PKG_CONFIG_PATH ++ directories to add to pkg-config's search path ++ PKG_CONFIG_LIBDIR ++ path overriding pkg-config's built-in search path ++ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config ++ RPM_LIBS linker flags for RPM, overriding pkg-config + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. +@@ -5033,6 +5053,491 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 + $as_echo "$with_auto_load_safe_path" >&6; } + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++ ++# Check whether --with-rpm was given. ++if test "${with_rpm+set}" = set; then : ++ withval=$with_rpm; ++else ++ with_rpm="auto" ++fi ++ ++ ++ ++ ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 ++$as_echo_n "checking specific librpm version... " >&6; } ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error "cannot run test program while cross compiling ++See \`config.log' for more details." "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++#include ++#include ++#include ++ ++int ++main () ++{ ++ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 ++$as_echo "$DLOPEN_LIBRPM" >&6; } ++ fi ++ ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++ rm -f conftest.out ++ ++ ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ ++cat >>confdefs.h <<_ACEOF ++#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING ++_ACEOF ++ ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 ++ fi ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 ++$as_echo_n "checking for RPM... " >&6; } ++ ++if test -n "$RPM_CFLAGS"; then ++ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$RPM_LIBS"; then ++ pkg_cv_RPM_LIBS="$RPM_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1` ++ else ++ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$RPM_PKG_ERRORS" >&5 ++ ++ HAVE_LIBRPM=false ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ HAVE_LIBRPM=false ++else ++ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS ++ RPM_LIBS=$pkg_cv_RPM_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ HAVE_LIBRPM=true ++fi ++ ++ if $HAVE_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 ++$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} ++ fi ++ fi ++ fi ++fi ++ + + + subdirs="$subdirs testsuite" +Index: gdb-7.6/gdb/configure.ac +=================================================================== +--- gdb-7.6.orig/gdb/configure.ac 2013-07-17 19:51:01.666356964 +0200 ++++ gdb-7.6/gdb/configure.ac 2013-07-17 19:51:02.692357665 +0200 +@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap + [Directories safe to hold auto-loaded files.]) + AC_MSG_RESULT([$with_auto_load_safe_path]) + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++AC_ARG_WITH([rpm], ++ [AS_HELP_STRING([--with-rpm], ++ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) ++ ++m4_pattern_allow([^AC_MSG_ERROR$]) ++m4_pattern_allow([^AC_MSG_WARN$]) ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ AC_MSG_CHECKING([specific librpm version]) ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ AC_RUN_IFELSE(AC_LANG_PROGRAM([[ ++#include ++#include ++#include ++ ]], [[ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ]]), [ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ AC_MSG_RESULT($DLOPEN_LIBRPM) ++ fi ++ ]) ++ rm -f conftest.out ++ ++ m4_define([CHECK_LIBRPM_COMPAT], [ ++ AC_MSG_CHECKING([rpm library API compatibility]) ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ]]), [ ++ LIBRPM_COMPAT=true ++ AC_MSG_RESULT(yes) ++ ], [ ++ LIBRPM_COMPAT=false ++ AC_MSG_RESULT(no) ++ ]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.]) ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ else ++ AC_MSG_RESULT(no) ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.]) ++ fi ++ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false]) ++ ++ if $HAVE_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ AC_MSG_ERROR($RPM_PKG_ERRORS) ++ else ++ AC_MSG_WARN($RPM_PKG_ERRORS) ++ fi ++ fi ++ fi ++fi ++ + AC_CONFIG_SUBDIRS(testsuite) + + # Check whether to support alternative target configurations +Index: gdb-7.6/gdb/corelow.c +=================================================================== +--- gdb-7.6.orig/gdb/corelow.c 2013-07-17 19:51:02.608357607 +0200 ++++ gdb-7.6/gdb/corelow.c 2013-07-17 19:51:02.692357665 +0200 +@@ -314,7 +314,7 @@ build_id_locate_exec (int from_tty) + symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; + } + else +- debug_print_missing (_("the main executable file"), build_id_filename); ++ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); + + do_cleanups (back_to); + diff --git a/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch b/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch new file mode 100644 index 0000000..9ad7fcb --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -0,0 +1,59 @@ +Index: gdb-7.5.50.20130310/gdb/solib-svr4.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/solib-svr4.c 2013-03-10 16:37:49.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/solib-svr4.c 2013-03-10 16:43:45.498585091 +0100 +@@ -1225,14 +1225,27 @@ svr4_read_so_list (CORE_ADDR lm, struct + } + + { +- struct elf_build_id *build_id; ++ struct elf_build_id *build_id = NULL; + + strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); + new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; + /* May get overwritten below. */ + strcpy (new->so_name, new->so_original_name); + +- build_id = build_id_addr_get (new->lm_info->l_ld); ++ /* In the case the main executable was found according to its build-id ++ (from a core file) prevent loading a different build of a library ++ with accidentally the same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there instead) if ++ the on-disk files no longer match the running program version. ++ ++ If the main executable was not loaded according to its build-id do ++ not do any build-id checking of the libraries. There may be missing ++ build-ids dumped in the core file and we would map all the libraries ++ to the only existing file loaded that time - the executable. */ ++ if (symfile_objfile != NULL ++ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0) ++ build_id = build_id_addr_get (new->lm_info->l_ld); + if (build_id != NULL) + { + char *name, *build_id_filename; +@@ -1247,23 +1260,7 @@ svr4_read_so_list (CORE_ADDR lm, struct + xfree (name); + } + else +- { +- debug_print_missing (new->so_name, build_id_filename); +- +- /* In the case the main executable was found according to +- its build-id (from a core file) prevent loading +- a different build of a library with accidentally the +- same SO_NAME. +- +- It suppresses bogus backtraces (and prints "??" there +- instead) if the on-disk files no longer match the +- running program version. */ +- +- if (symfile_objfile != NULL +- && (symfile_objfile->flags +- & OBJF_BUILD_ID_CORE_LOADED) != 0) +- new->so_name[0] = 0; +- } ++ debug_print_missing (new->so_name, build_id_filename); + + xfree (build_id_filename); + xfree (build_id); diff --git a/SOURCES/gdb-6.6-buildid-locate.patch b/SOURCES/gdb-6.6-buildid-locate.patch new file mode 100644 index 0000000..de2485c --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate.patch @@ -0,0 +1,1124 @@ +Index: gdb-7.6/gdb/corelow.c +=================================================================== +--- gdb-7.6.orig/gdb/corelow.c 2013-01-31 19:37:37.000000000 +0100 ++++ gdb-7.6/gdb/corelow.c 2013-08-06 16:57:14.832517976 +0200 +@@ -46,6 +46,9 @@ + #include "progspace.h" + #include "objfiles.h" + #include "gdb_bfd.h" ++#include "auxv.h" ++#include "elf/common.h" ++#include "gdbcmd.h" + + #ifndef O_LARGEFILE + #define O_LARGEFILE 0 +@@ -271,6 +274,53 @@ add_to_thread_list (bfd *abfd, asection + inferior_ptid = ptid; /* Yes, make it current. */ + } + ++static int build_id_core_loads = 1; ++ ++static void ++build_id_locate_exec (int from_tty) ++{ ++ CORE_ADDR at_entry; ++ struct elf_build_id *build_id; ++ char *execfilename, *debug_filename; ++ char *build_id_filename; ++ struct cleanup *back_to; ++ ++ if (exec_bfd != NULL || symfile_objfile != NULL) ++ return; ++ ++ if (target_auxv_search (¤t_target, AT_ENTRY, &at_entry) <= 0) ++ return; ++ ++ build_id = build_id_addr_get (at_entry); ++ if (build_id == NULL) ++ return; ++ back_to = make_cleanup (xfree, build_id); ++ ++ /* SYMFILE_OBJFILE should refer to the main executable (not only to its ++ separate debug info file). gcc44+ keeps .eh_frame only in the main ++ executable without its duplicate .debug_frame in the separate debug info ++ file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer ++ directly to the separate debug info file. */ ++ ++ execfilename = build_id_to_filename (build_id, &build_id_filename, 0); ++ make_cleanup (xfree, build_id_filename); ++ ++ if (execfilename != NULL) ++ { ++ make_cleanup (xfree, execfilename); ++ exec_file_attach (execfilename, from_tty); ++ symbol_file_add_main (execfilename, from_tty); ++ if (symfile_objfile != NULL) ++ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; ++ } ++ else ++ debug_print_missing (_("the main executable file"), build_id_filename); ++ ++ do_cleanups (back_to); ++ ++ /* No automatic SOLIB_ADD as the libraries would get read twice. */ ++} ++ + /* This routine opens and sets up the core file bfd. */ + + static void +@@ -409,6 +459,14 @@ core_open (char *filename, int from_tty) + switch_to_thread (thread->ptid); + } + ++ /* Find the build_id identifiers. If it gets executed after ++ POST_CREATE_INFERIOR we would clash with asking to discard the already ++ loaded VDSO symbols. If it gets executed before bfd_map_over_sections ++ INFERIOR_PTID is still not set and libthread_db initialization crashes on ++ PID == 0 in ps_pglobal_lookup. */ ++ if (build_id_core_loads != 0) ++ build_id_locate_exec (from_tty); ++ + post_create_inferior (&core_ops, from_tty); + + /* Now go through the target stack looking for threads since there +@@ -978,4 +1036,11 @@ _initialize_corelow (void) + init_core_ops (); + + add_target (&core_ops); ++ ++ add_setshow_boolean_cmd ("build-id-core-loads", class_files, ++ &build_id_core_loads, _("\ ++Set whether CORE-FILE loads the build-id associated files automatically."), _("\ ++Show whether CORE-FILE loads the build-id associated files automatically."), ++ NULL, NULL, NULL, ++ &setlist, &showlist); + } +Index: gdb-7.6/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.6.orig/gdb/doc/gdb.texinfo 2013-08-06 16:57:14.531517553 +0200 ++++ gdb-7.6/gdb/doc/gdb.texinfo 2013-08-06 16:57:14.843517992 +0200 +@@ -16831,6 +16831,27 @@ information files. + + @end table + ++You can also adjust the current verbosity of the @dfn{build id} locating. ++ ++@table @code ++ ++@kindex set build-id-verbose ++@item set build-id-verbose 0 ++No additional messages are printed. ++ ++@item set build-id-verbose 1 ++Missing separate debug filenames are printed. ++ ++@item set build-id-verbose 2 ++Missing separate debug filenames are printed and also all the parsing of the ++binaries to find their @dfn{build id} content is printed. ++ ++@kindex show build-id-verbose ++@item show build-id-verbose ++Show the current verbosity value for the @dfn{build id} content locating. ++ ++@end table ++ + @cindex @code{.gnu_debuglink} sections + @cindex debug link sections + A debug link is a special section of the executable file named +Index: gdb-7.6/gdb/solib-svr4.c +=================================================================== +--- gdb-7.6.orig/gdb/solib-svr4.c 2013-01-31 14:52:52.000000000 +0100 ++++ gdb-7.6/gdb/solib-svr4.c 2013-08-06 16:57:14.917518096 +0200 +@@ -1224,9 +1224,52 @@ svr4_read_so_list (CORE_ADDR lm, struct + continue; + } + +- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); +- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- strcpy (new->so_original_name, new->so_name); ++ { ++ struct elf_build_id *build_id; ++ ++ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); ++ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ /* May get overwritten below. */ ++ strcpy (new->so_name, new->so_original_name); ++ ++ build_id = build_id_addr_get (new->lm_info->l_ld); ++ if (build_id != NULL) ++ { ++ char *name, *build_id_filename; ++ ++ /* Missing the build-id matching separate debug info file ++ would be handled while SO_NAME gets loaded. */ ++ name = build_id_to_filename (build_id, &build_id_filename, 0); ++ if (name != NULL) ++ { ++ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); ++ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ xfree (name); ++ } ++ else ++ { ++ debug_print_missing (new->so_name, build_id_filename); ++ ++ /* In the case the main executable was found according to ++ its build-id (from a core file) prevent loading ++ a different build of a library with accidentally the ++ same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there ++ instead) if the on-disk files no longer match the ++ running program version. */ ++ ++ if (symfile_objfile != NULL ++ && (symfile_objfile->flags ++ & OBJF_BUILD_ID_CORE_LOADED) != 0) ++ new->so_name[0] = 0; ++ } ++ ++ xfree (build_id_filename); ++ xfree (build_id); ++ } ++ } ++ + xfree (buffer); + + /* If this entry has no name, or its name matches the name +Index: gdb-7.6/gdb/elfread.c +=================================================================== +--- gdb-7.6.orig/gdb/elfread.c 2013-03-18 10:20:02.000000000 +0100 ++++ gdb-7.6/gdb/elfread.c 2013-08-06 16:57:19.548524529 +0200 +@@ -45,6 +45,11 @@ + #include "regcache.h" + #include "bcache.h" + #include "gdb_bfd.h" ++#include "libbfd.h" ++#include "gdbcore.h" ++#include "gdbcmd.h" ++#include "observer.h" ++#include + + extern void _initialize_elfread (void); + +@@ -1068,10 +1073,59 @@ elf_gnu_ifunc_resolver_return_stop (stru + update_breakpoint_locations (b, sals, sals_end); + } + +-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ ++#define BUILD_ID_VERBOSE_NONE 0 ++#define BUILD_ID_VERBOSE_FILENAMES 1 ++#define BUILD_ID_VERBOSE_BINARY_PARSE 2 ++static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; ++static void ++show_build_id_verbose (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"), ++ value); ++} ++ ++/* Locate NT_GNU_BUILD_ID and return its matching debug filename. ++ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ ++ ++static struct elf_build_id * ++build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size) ++{ ++ bfd_byte *p; ++ ++ p = buf; ++ while (p < buf + size) ++ { ++ /* FIXME: bad alignment assumption. */ ++ Elf_External_Note *xnp = (Elf_External_Note *) p; ++ size_t namesz = H_GET_32 (templ, xnp->namesz); ++ size_t descsz = H_GET_32 (templ, xnp->descsz); ++ bfd_byte *descdata = xnp->name + BFD_ALIGN (namesz, 4); ++ ++ if (H_GET_32 (templ, xnp->type) == NT_GNU_BUILD_ID ++ && namesz == sizeof "GNU" ++ && memcmp (xnp->name, "GNU", sizeof "GNU") == 0) ++ { ++ size_t size = descsz; ++ gdb_byte *data = (void *) descdata; ++ struct elf_build_id *retval; ++ ++ retval = xmalloc (sizeof *retval - 1 + size); ++ retval->size = size; ++ memcpy (retval->data, data, size); ++ ++ return retval; ++ } ++ p = descdata + BFD_ALIGN (descsz, 4); ++ } ++ return NULL; ++} ++ ++/* Separate debuginfo files have corrupted PHDR but SHDR is correct there. ++ Locate NT_GNU_BUILD_ID from ABFD and return its content. */ + + static const struct elf_build_id * +-build_id_bfd_get (bfd *abfd) ++build_id_bfd_shdr_get (bfd *abfd) + { + if (!bfd_check_format (abfd, bfd_object) + || bfd_get_flavour (abfd) != bfd_target_elf_flavour +@@ -1081,6 +1135,348 @@ build_id_bfd_get (bfd *abfd) + return elf_tdata (abfd)->build_id; + } + ++/* Core files may have missing (corrupt) SHDR but PDHR is correct there. ++ bfd_elf_bfd_from_remote_memory () has too much overhead by ++ allocating/reading all the available ELF PT_LOADs. */ ++ ++static struct elf_build_id * ++build_id_phdr_get (bfd *templ, bfd_vma loadbase, unsigned e_phnum, ++ Elf_Internal_Phdr *i_phdr) ++{ ++ int i; ++ struct elf_build_id *retval = NULL; ++ ++ for (i = 0; i < e_phnum; i++) ++ if (i_phdr[i].p_type == PT_NOTE && i_phdr[i].p_filesz > 0) ++ { ++ Elf_Internal_Phdr *hdr = &i_phdr[i]; ++ gdb_byte *buf; ++ int err; ++ ++ buf = xmalloc (hdr->p_filesz); ++ err = target_read_memory (loadbase + i_phdr[i].p_vaddr, buf, ++ hdr->p_filesz); ++ if (err == 0) ++ retval = build_id_buf_get (templ, buf, hdr->p_filesz); ++ else ++ retval = NULL; ++ xfree (buf); ++ if (retval != NULL) ++ break; ++ } ++ return retval; ++} ++ ++/* First we validate the file by reading in the ELF header and checking ++ the magic number. */ ++ ++static inline bfd_boolean ++elf_file_p (Elf64_External_Ehdr *x_ehdrp64) ++{ ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ gdb_assert (offsetof (Elf64_External_Ehdr, e_ident) ++ == offsetof (Elf32_External_Ehdr, e_ident)); ++ gdb_assert (sizeof (((Elf64_External_Ehdr *) 0)->e_ident) ++ == sizeof (((Elf32_External_Ehdr *) 0)->e_ident)); ++ ++ return ((x_ehdrp64->e_ident[EI_MAG0] == ELFMAG0) ++ && (x_ehdrp64->e_ident[EI_MAG1] == ELFMAG1) ++ && (x_ehdrp64->e_ident[EI_MAG2] == ELFMAG2) ++ && (x_ehdrp64->e_ident[EI_MAG3] == ELFMAG3)); ++} ++ ++/* Translate an ELF file header in external format into an ELF file header in ++ internal format. */ ++ ++#define H_GET_WORD(bfd, ptr) (is64 ? H_GET_64 (bfd, (ptr)) \ ++ : H_GET_32 (bfd, (ptr))) ++#define H_GET_SIGNED_WORD(bfd, ptr) (is64 ? H_GET_S64 (bfd, (ptr)) \ ++ : H_GET_S32 (bfd, (ptr))) ++ ++static void ++elf_swap_ehdr_in (bfd *abfd, ++ const Elf64_External_Ehdr *src64, ++ Elf_Internal_Ehdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Ehdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ memcpy (dst->e_ident, SRC (e_ident), EI_NIDENT); ++ dst->e_type = H_GET_16 (abfd, SRC (e_type)); ++ dst->e_machine = H_GET_16 (abfd, SRC (e_machine)); ++ dst->e_version = H_GET_32 (abfd, SRC (e_version)); ++ if (signed_vma) ++ dst->e_entry = H_GET_SIGNED_WORD (abfd, SRC (e_entry)); ++ else ++ dst->e_entry = H_GET_WORD (abfd, SRC (e_entry)); ++ dst->e_phoff = H_GET_WORD (abfd, SRC (e_phoff)); ++ dst->e_shoff = H_GET_WORD (abfd, SRC (e_shoff)); ++ dst->e_flags = H_GET_32 (abfd, SRC (e_flags)); ++ dst->e_ehsize = H_GET_16 (abfd, SRC (e_ehsize)); ++ dst->e_phentsize = H_GET_16 (abfd, SRC (e_phentsize)); ++ dst->e_phnum = H_GET_16 (abfd, SRC (e_phnum)); ++ dst->e_shentsize = H_GET_16 (abfd, SRC (e_shentsize)); ++ dst->e_shnum = H_GET_16 (abfd, SRC (e_shnum)); ++ dst->e_shstrndx = H_GET_16 (abfd, SRC (e_shstrndx)); ++ ++#undef SRC ++} ++ ++/* Translate an ELF program header table entry in external format into an ++ ELF program header table entry in internal format. */ ++ ++static void ++elf_swap_phdr_in (bfd *abfd, ++ const Elf64_External_Phdr *src64, ++ Elf_Internal_Phdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Phdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ ++ dst->p_type = H_GET_32 (abfd, SRC (p_type)); ++ dst->p_flags = H_GET_32 (abfd, SRC (p_flags)); ++ dst->p_offset = H_GET_WORD (abfd, SRC (p_offset)); ++ if (signed_vma) ++ { ++ dst->p_vaddr = H_GET_SIGNED_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_SIGNED_WORD (abfd, SRC (p_paddr)); ++ } ++ else ++ { ++ dst->p_vaddr = H_GET_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_WORD (abfd, SRC (p_paddr)); ++ } ++ dst->p_filesz = H_GET_WORD (abfd, SRC (p_filesz)); ++ dst->p_memsz = H_GET_WORD (abfd, SRC (p_memsz)); ++ dst->p_align = H_GET_WORD (abfd, SRC (p_align)); ++ ++#undef SRC ++} ++ ++#undef H_GET_SIGNED_WORD ++#undef H_GET_WORD ++ ++static Elf_Internal_Phdr * ++elf_get_phdr (bfd *templ, bfd_vma ehdr_vma, unsigned *e_phnum_pointer, ++ bfd_vma *loadbase_pointer) ++{ ++ /* sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr) */ ++ Elf64_External_Ehdr x_ehdr64; /* Elf file header, external form */ ++ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ ++ bfd_size_type x_phdrs_size; ++ gdb_byte *x_phdrs_ptr; ++ Elf_Internal_Phdr *i_phdrs; ++ int err; ++ unsigned int i; ++ bfd_vma loadbase; ++ int loadbase_set; ++ ++ gdb_assert (templ != NULL); ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ ++ /* Read in the ELF header in external format. */ ++ err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr64, sizeof x_ehdr64); ++ if (err) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Now check to see if we have a valid ELF file, and one that BFD can ++ make use of. The magic number must match, the address size ('class') ++ and byte-swapping must match our XVEC entry. */ ++ ++ if (! elf_file_p (&x_ehdr64) ++ || x_ehdr64.e_ident[EI_VERSION] != EV_CURRENT ++ || !((bfd_get_arch_size (templ) == 64 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS64) ++ || (bfd_get_arch_size (templ) == 32 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS32))) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Check that file's byte order matches xvec's */ ++ switch (x_ehdr64.e_ident[EI_DATA]) ++ { ++ case ELFDATA2MSB: /* Big-endian */ ++ if (! bfd_header_big_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "big-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATA2LSB: /* Little-endian */ ++ if (! bfd_header_little_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "little-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATANONE: /* No data encoding specified */ ++ default: /* Unknown data encoding specified */ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "ELF header endianity at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ elf_swap_ehdr_in (templ, &x_ehdr64, &i_ehdr); ++ ++ /* The file header tells where to find the program headers. ++ These are what we use to actually choose what to read. */ ++ ++ if (i_ehdr.e_phentsize != (bfd_get_arch_size (templ) == 64 ++ ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)) ++ || i_ehdr.e_phnum == 0) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Invalid ELF program headers from the ELF header " ++ "at address 0x%lx"), (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ x_phdrs_size = (bfd_get_arch_size (templ) == 64 ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)); ++ ++ i_phdrs = xmalloc (i_ehdr.e_phnum * (sizeof *i_phdrs + x_phdrs_size)); ++ x_phdrs_ptr = (void *) &i_phdrs[i_ehdr.e_phnum]; ++ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs_ptr, ++ i_ehdr.e_phnum * x_phdrs_size); ++ if (err) ++ { ++ free (i_phdrs); ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading " ++ "ELF program headers at address 0x%lx"), ++ (unsigned long) (ehdr_vma + i_ehdr.e_phoff)); ++ return NULL; ++ } ++ ++ loadbase = ehdr_vma; ++ loadbase_set = 0; ++ for (i = 0; i < i_ehdr.e_phnum; ++i) ++ { ++ elf_swap_phdr_in (templ, (Elf64_External_Phdr *) ++ (x_phdrs_ptr + i * x_phdrs_size), &i_phdrs[i]); ++ /* IA-64 vDSO may have two mappings for one segment, where one mapping ++ is executable only, and one is read only. We must not use the ++ executable one (PF_R is the first one, PF_X the second one). */ ++ if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R)) ++ { ++ /* Only the first PT_LOAD segment indicates the file bias. ++ Next segments may have P_VADDR arbitrarily higher. ++ If the first segment has P_VADDR zero any next segment must not ++ confuse us, the first one sets LOADBASE certainly enough. */ ++ if (!loadbase_set && i_phdrs[i].p_offset == 0) ++ { ++ loadbase = ehdr_vma - i_phdrs[i].p_vaddr; ++ loadbase_set = 1; ++ } ++ } ++ } ++ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Found ELF header at address 0x%lx, loadbase 0x%lx"), ++ (unsigned long) ehdr_vma, (unsigned long) loadbase); ++ ++ *e_phnum_pointer = i_ehdr.e_phnum; ++ *loadbase_pointer = loadbase; ++ return i_phdrs; ++} ++ ++/* BUILD_ID_ADDR_GET gets ADDR located somewhere in the object. ++ Find the first section before ADDR containing an ELF header. ++ We rely on the fact the sections from multiple files do not mix. ++ FIXME: We should check ADDR is contained _inside_ the section with possibly ++ missing content (P_FILESZ < P_MEMSZ). These omitted sections are currently ++ hidden by _BFD_ELF_MAKE_SECTION_FROM_PHDR. */ ++ ++static CORE_ADDR build_id_addr; ++struct build_id_addr_sect ++ { ++ struct build_id_addr_sect *next; ++ asection *sect; ++ }; ++static struct build_id_addr_sect *build_id_addr_sect; ++ ++static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj) ++{ ++ if (build_id_addr >= bfd_section_vma (abfd, sect)) ++ { ++ struct build_id_addr_sect *candidate; ++ ++ candidate = xmalloc (sizeof *candidate); ++ candidate->next = build_id_addr_sect; ++ build_id_addr_sect = candidate; ++ candidate->sect = sect; ++ } ++} ++ ++struct elf_build_id * ++build_id_addr_get (CORE_ADDR addr) ++{ ++ struct build_id_addr_sect *candidate; ++ struct elf_build_id *retval = NULL; ++ Elf_Internal_Phdr *i_phdr = NULL; ++ bfd_vma loadbase = 0; ++ unsigned e_phnum = 0; ++ ++ if (core_bfd == NULL) ++ return NULL; ++ ++ build_id_addr = addr; ++ gdb_assert (build_id_addr_sect == NULL); ++ bfd_map_over_sections (core_bfd, build_id_addr_candidate, NULL); ++ ++ /* Sections are sorted in the high-to-low VMAs order. ++ Stop the search on the first ELF header we find. ++ Do not continue the search even if it does not contain NT_GNU_BUILD_ID. */ ++ ++ for (candidate = build_id_addr_sect; candidate != NULL; ++ candidate = candidate->next) ++ { ++ i_phdr = elf_get_phdr (core_bfd, ++ bfd_section_vma (core_bfd, candidate->sect), ++ &e_phnum, &loadbase); ++ if (i_phdr != NULL) ++ break; ++ } ++ ++ if (i_phdr != NULL) ++ { ++ retval = build_id_phdr_get (core_bfd, loadbase, e_phnum, i_phdr); ++ xfree (i_phdr); ++ } ++ ++ while (build_id_addr_sect != NULL) ++ { ++ candidate = build_id_addr_sect; ++ build_id_addr_sect = candidate->next; ++ xfree (candidate); ++ } ++ ++ return retval; ++} ++ + /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ + + static int +@@ -1095,7 +1491,7 @@ build_id_verify (const char *filename, c + if (abfd == NULL) + return 0; + +- found = build_id_bfd_get (abfd); ++ found = build_id_bfd_shdr_get (abfd); + + if (found == NULL) + warning (_("File \"%s\" has no build-id, file skipped"), filename); +@@ -1112,16 +1508,53 @@ build_id_verify (const char *filename, c + } + + static char * +-build_id_to_debug_filename (const struct elf_build_id *build_id) ++link_resolve (const char *symlink, int level) ++{ ++ char buf[PATH_MAX + 1], *target, *retval; ++ ssize_t got; ++ ++ if (level > 10) ++ return xstrdup (symlink); ++ ++ got = readlink (symlink, buf, sizeof (buf)); ++ if (got < 0 || got >= sizeof (buf)) ++ return xstrdup (symlink); ++ buf[got] = '\0'; ++ ++ if (IS_ABSOLUTE_PATH (buf)) ++ target = xstrdup (buf); ++ else ++ { ++ char *dir = ldirname (symlink); ++ ++ if (dir == NULL) ++ return xstrdup (symlink); ++ target = xstrprintf ("%s" ++#ifndef HAVE_DOS_BASED_FILE_SYSTEM ++ "/" ++#else /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "\\" ++#endif /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "%s", dir, buf); ++ } ++ ++ retval = link_resolve (target, level + 1); ++ xfree (target); ++ return retval; ++} ++ ++char * ++build_id_to_filename (const struct elf_build_id *build_id, char **link_return, ++ int add_debug_suffix) + { + char *link, *debugdir, *retval = NULL; ++ char *link_all = NULL; + VEC (char_ptr) *debugdir_vec; + struct cleanup *back_to; + int ix; + + /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ +- link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 +- + 2 * build_id->size + (sizeof ".debug" - 1) + 1); ++ link = xmalloc (strlen (debug_file_directory) + 2 * build_id->size + 50); + + /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will + cause "/.build-id/..." lookups. */ +@@ -1134,7 +1567,10 @@ build_id_to_debug_filename (const struct + size_t debugdir_len = strlen (debugdir); + const gdb_byte *data = build_id->data; + size_t size = build_id->size; +- char *s; ++ unsigned seqno; ++ struct stat statbuf_trash; ++ /* Initialize it just to avoid a GCC false warning. */ ++ char *s, *link0 = NULL, *link0_resolved; + + memcpy (link, debugdir, debugdir_len); + s = &link[debugdir_len]; +@@ -1148,37 +1584,256 @@ build_id_to_debug_filename (const struct + *s++ = '/'; + while (size-- > 0) + s += sprintf (s, "%02x", (unsigned) *data++); +- strcpy (s, ".debug"); + +- /* lrealpath() is expensive even for the usually non-existent files. */ +- if (access (link, F_OK) == 0) +- retval = lrealpath (link); ++ for (seqno = 0;; seqno++) ++ { ++ char *s2; ++ ++ if (seqno) ++ { ++ /* There can be multiple build-id symlinks pointing to real files ++ with the same build-id (such as hard links). Some of the real ++ files may not be installed. */ ++ ++ s2 = s + sprintf (s, ".%u", seqno); ++ } ++ else ++ s2 = s; ++ ++ if (add_debug_suffix) ++ strcpy (s2, ".debug"); ++ else ++ *s2 = 0; ++ ++ if (!seqno) ++ { ++ /* If none of the real files is found report as missing file ++ always the non-.%u-suffixed file. */ ++ link0 = xstrdup (link); ++ } ++ ++ /* `access' automatically dereferences LINK. */ ++ if (lstat (link, &statbuf_trash) != 0) ++ { ++ /* Stop increasing SEQNO. */ ++ break; ++ } ++ ++ retval = lrealpath (link); ++ ++ if (retval != NULL && !build_id_verify (retval, build_id)) ++ { ++ xfree (retval); ++ retval = NULL; ++ } ++ ++ if (retval) ++ break; ++ } ++ ++ if (retval != NULL) ++ { ++ /* LINK_ALL is not used below in this non-NULL RETVAL case. */ ++ xfree (link0); ++ break; ++ } ++ ++ /* If the symlink has target request to install the target. ++ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. ++ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ ++ link0_resolved = link_resolve (link0, 0); ++ xfree (link0); + +- if (retval != NULL && !build_id_verify (retval, build_id)) ++ if (link_all == NULL) ++ link_all = xstrdup (link0_resolved); ++ else + { +- xfree (retval); +- retval = NULL; ++ size_t len_orig = strlen (link_all); ++ ++ link_all = xrealloc (link_all, ++ len_orig + 1 + strlen (link0_resolved) + 1); ++ ++ /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with ++ its possible use as an argument for installation command. */ ++ link_all[len_orig] = ' '; ++ ++ strcpy (&link_all[len_orig + 1], link0_resolved); + } ++ xfree (link0_resolved); ++ } + ++ if (link_return != NULL) ++ { + if (retval != NULL) +- break; ++ { ++ *link_return = link; ++ link = NULL; ++ } ++ else ++ { ++ *link_return = link_all; ++ link_all = NULL; ++ } + } ++ xfree (link); ++ xfree (link_all); + + do_cleanups (back_to); + return retval; + } + ++/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages ++ Try to install the hash file ... ++ avoidance. */ ++ ++struct missing_filepair ++ { ++ char *binary; ++ char *debug; ++ char data[1]; ++ }; ++ ++static struct htab *missing_filepair_hash; ++static struct obstack missing_filepair_obstack; ++ ++static void * ++missing_filepair_xcalloc (size_t nmemb, size_t nmemb_size) ++{ ++ void *retval; ++ size_t size = nmemb * nmemb_size; ++ ++ retval = obstack_alloc (&missing_filepair_obstack, size); ++ memset (retval, 0, size); ++ return retval; ++} ++ ++static hashval_t ++missing_filepair_hash_func (const struct missing_filepair *elem) ++{ ++ hashval_t retval = 0; ++ ++ retval ^= htab_hash_string (elem->binary); ++ if (elem->debug != NULL) ++ retval ^= htab_hash_string (elem->debug); ++ ++ return retval; ++} ++ ++static int ++missing_filepair_eq (const struct missing_filepair *elem1, ++ const struct missing_filepair *elem2) ++{ ++ return strcmp (elem1->binary, elem2->binary) == 0 ++ && ((elem1->debug == NULL) == (elem2->debug == NULL)) ++ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0); ++} ++ ++static void ++missing_filepair_change (void) ++{ ++ if (missing_filepair_hash != NULL) ++ { ++ obstack_free (&missing_filepair_obstack, NULL); ++ /* All their memory came just from missing_filepair_OBSTACK. */ ++ missing_filepair_hash = NULL; ++ } ++} ++ ++static void ++debug_print_executable_changed (void) ++{ ++ missing_filepair_change (); ++} ++ ++/* Notify user the file BINARY with (possibly NULL) associated separate debug ++ information file DEBUG is missing. DEBUG may or may not be the build-id ++ file such as would be: ++ /usr/lib/debug/.build-id/dd/b1d2ce632721c47bb9e8679f369e2295ce71be.debug ++ */ ++ ++void ++debug_print_missing (const char *binary, const char *debug) ++{ ++ size_t binary_len0 = strlen (binary) + 1; ++ size_t debug_len0 = debug ? strlen (debug) + 1 : 0; ++ struct missing_filepair missing_filepair_find; ++ struct missing_filepair *missing_filepair; ++ struct missing_filepair **slot; ++ ++ if (build_id_verbose < BUILD_ID_VERBOSE_FILENAMES) ++ return; ++ ++ if (missing_filepair_hash == NULL) ++ { ++ obstack_init (&missing_filepair_obstack); ++ missing_filepair_hash = htab_create_alloc (64, ++ (hashval_t (*) (const void *)) missing_filepair_hash_func, ++ (int (*) (const void *, const void *)) missing_filepair_eq, NULL, ++ missing_filepair_xcalloc, NULL); ++ } ++ ++ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with ++ obstack_free in the case of a (rare) match. The problem is ALLOC_F for ++ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance ++ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly ++ not to free only MISSING_FILEPAIR but also some such structures (allocated ++ during the htab_find_slot call). */ ++ ++ missing_filepair_find.binary = (char *) binary; ++ missing_filepair_find.debug = (char *) debug; ++ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash, ++ &missing_filepair_find, ++ INSERT); ++ ++ /* While it may be still printed duplicitely with the missing debuginfo file ++ * it is due to once printing about the binary file build-id link and once ++ * about the .debug file build-id link as both the build-id symlinks are ++ * located in the debuginfo package. */ ++ ++ if (*slot != NULL) ++ return; ++ ++ missing_filepair = obstack_alloc (&missing_filepair_obstack, ++ sizeof (*missing_filepair) - 1 ++ + binary_len0 + debug_len0); ++ missing_filepair->binary = missing_filepair->data; ++ memcpy (missing_filepair->binary, binary, binary_len0); ++ if (debug != NULL) ++ { ++ missing_filepair->debug = missing_filepair->binary + binary_len0; ++ memcpy (missing_filepair->debug, debug, debug_len0); ++ } ++ else ++ missing_filepair->debug = NULL; ++ ++ *slot = missing_filepair; ++ ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ fprintf_unfiltered (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), ++ debug); ++} ++ + static char * +-find_separate_debug_file_by_buildid (struct objfile *objfile) ++find_separate_debug_file_by_buildid (struct objfile *objfile, ++ char **build_id_filename_return) + { + const struct elf_build_id *build_id; + +- build_id = build_id_bfd_get (objfile->obfd); ++ if (build_id_filename_return) ++ *build_id_filename_return = NULL; ++ ++ build_id = build_id_bfd_shdr_get (objfile->obfd); + if (build_id != NULL) + { + char *build_id_name; + +- build_id_name = build_id_to_debug_filename (build_id); ++ build_id_name = build_id_to_filename (build_id, build_id_filename_return, ++ 1); + /* Prevent looping on a stripped .debug file. */ + if (build_id_name != NULL + && filename_cmp (build_id_name, objfile->name) == 0) +@@ -1188,7 +1843,7 @@ find_separate_debug_file_by_buildid (str + xfree (build_id_name); + } + else if (build_id_name != NULL) +- return build_id_name; ++ return build_id_name; + } + return NULL; + } +@@ -1426,9 +2081,10 @@ elf_symfile_read (struct objfile *objfil + && objfile->separate_debug_objfile == NULL + && objfile->separate_debug_objfile_backlink == NULL) + { +- char *debugfile; ++ char *debugfile, *build_id_filename; + +- debugfile = find_separate_debug_file_by_buildid (objfile); ++ debugfile = find_separate_debug_file_by_buildid (objfile, ++ &build_id_filename); + + if (debugfile == NULL) + debugfile = find_separate_debug_file_by_debuglink (objfile); +@@ -1442,6 +2098,12 @@ elf_symfile_read (struct objfile *objfil + 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") ++ != NULL) ++ debug_print_missing (objfile->name, build_id_filename); ++ ++ xfree (build_id_filename); + } + } + +@@ -1761,4 +2423,16 @@ _initialize_elfread (void) + + elf_objfile_gnu_ifunc_cache_data = register_objfile_data (); + gnu_ifunc_fns_p = &elf_gnu_ifunc_fns; ++ ++ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, ++ _("\ ++Set debugging level of the build-id locator."), _("\ ++Show debugging level of the build-id locator."), _("\ ++Level 1 (default) enables printing the missing debug filenames,\n\ ++level 2 also prints the parsing of binaries to find the identificators."), ++ NULL, ++ show_build_id_verbose, ++ &setlist, &showlist); ++ ++ observer_attach_executable_changed (debug_print_executable_changed); + } +Index: gdb-7.6/gdb/symfile.h +=================================================================== +--- gdb-7.6.orig/gdb/symfile.h 2013-02-03 17:20:18.000000000 +0100 ++++ gdb-7.6/gdb/symfile.h 2013-08-06 16:57:14.919518099 +0200 +@@ -593,6 +593,12 @@ void free_symfile_segment_data (struct s + + extern struct cleanup *increment_reading_symtab (void); + ++/* build-id support. */ ++extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr); ++extern char *build_id_to_filename (const struct elf_build_id *build_id, ++ char **link_return, int add_debug_suffix); ++extern void debug_print_missing (const char *binary, const char *debug); ++ + /* From dwarf2read.c */ + + /* Names for a dwarf2 debugging section. The field NORMAL is the normal +Index: gdb-7.6/gdb/testsuite/lib/gdb.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-08-06 16:57:14.298517226 +0200 ++++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-08-06 16:57:14.920518100 +0200 +@@ -1482,6 +1482,16 @@ proc default_gdb_start { } { + warning "Couldn't set the width to 0." + } + } ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re "$gdb_prompt $" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } + return 0; + } + +Index: gdb-7.6/gdb/testsuite/lib/mi-support.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/mi-support.exp 2013-01-22 00:57:59.000000000 +0100 ++++ gdb-7.6/gdb/testsuite/lib/mi-support.exp 2013-08-06 16:57:14.920518100 +0200 +@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } { + warning "Couldn't set the width to 0." + } + } ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "190-gdb-set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } + # If allowing the inferior to have its own PTY then assign the inferior + # its own terminal device here. + if { $separate_inferior_pty } { +Index: gdb-7.6/gdb/objfiles.h +=================================================================== +--- gdb-7.6.orig/gdb/objfiles.h 2013-02-28 20:00:31.000000000 +0100 ++++ gdb-7.6/gdb/objfiles.h 2013-08-06 16:57:14.920518100 +0200 +@@ -432,6 +432,10 @@ struct objfile + + #define OBJF_MAINLINE (1 << 5) + ++/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ ++ ++#define OBJF_BUILD_ID_CORE_LOADED (1 << 12) ++ + /* The object file that contains the runtime common minimal symbols + for SunOS4. Note that this objfile has no associated BFD. */ + +Index: gdb-7.6/gdb/testsuite/gdb.base/corefile.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/gdb.base/corefile.exp 2013-01-01 07:33:25.000000000 +0100 ++++ gdb-7.6/gdb/testsuite/gdb.base/corefile.exp 2013-08-06 16:57:14.921518102 +0200 +@@ -256,3 +256,33 @@ if ![is_remote target] { + + gdb_exit + } ++ ++ ++# Test auto-loading of binary files through build-id from the core file. ++set buildid [build_id_debug_filename_get $binfile] ++set wholetest "binfile found by build-id" ++if {$buildid == ""} { ++ untested "$wholetest (binary has no build-id)" ++} else { ++ gdb_exit ++ gdb_start ++ ++ regsub {\.debug$} $buildid {} buildid ++ set debugdir ${objdir}/${subdir}/${testfile}-debugdir ++ file delete -force -- $debugdir ++ file mkdir $debugdir/[file dirname $buildid] ++ file copy $binfile $debugdir/$buildid ++ ++ set test "show debug-file-directory" ++ gdb_test_multiple $test $test { ++ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" { ++ set debugdir_orig $expect_out(1,string) ++ pass $test ++ } ++ } ++ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory" ++ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.} ++ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable" ++ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" ++ pass $wholetest ++} diff --git a/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch b/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch new file mode 100644 index 0000000..c2d0180 --- /dev/null +++ b/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -0,0 +1,171 @@ +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/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch b/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch new file mode 100644 index 0000000..dbb9a82 --- /dev/null +++ b/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch @@ -0,0 +1,87 @@ +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. + + +Index: gdb-7.5.50.20130215/gdb/testsuite/gdb.arch/powerpc-power6.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.50.20130215/gdb/testsuite/gdb.arch/powerpc-power6.exp 2013-02-25 14:31:06.658827177 +0100 +@@ -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 *f0,f2,f0\r\n.*" "Power6 disassembly daddq" ++gdb_test "disass func" ":\tdsub *f1,f2,f1\r\n.*" "Power6 disassembly dsub" ++gdb_test "disass func" ":\tdsubq *f0,f2,f0\r\n.*" "Power6 disassembly dsubq" ++gdb_test "disass func" ":\tdmul *f1,f2,f1\r\n.*" "Power6 disassembly dmul" ++gdb_test "disass func" ":\tdmulq *f0,f2,f0\r\n.*" "Power6 disassembly dmulq" ++gdb_test "disass func" ":\tddiv *f1,f2,f1\r\n.*" "Power6 disassembly ddiv" ++gdb_test "disass func" ":\tddivq *f0,f2,f0\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,f0\r\n.*" "Power6 disassembly dcmpuq" +Index: gdb-7.5.50.20130215/gdb/testsuite/gdb.arch/powerpc-power6.s +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.50.20130215/gdb/testsuite/gdb.arch/powerpc-power6.s 2013-02-25 14:31:06.659827178 +0100 +@@ -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 0xfc020004 /* daddq f0,f2,f0 */ ++ .long 0xec220c04 /* dsub f1,f2,f1 */ ++ .long 0xfc020404 /* dsubq f0,f2,f0 */ ++ .long 0xec220844 /* dmul f1,f2,f1 */ ++ .long 0xfc020044 /* dmulq f0,f2,f0 */ ++ .long 0xec220c44 /* ddiv f1,f2,f1 */ ++ .long 0xfc020444 /* ddivq f0,f2,f0 */ ++ .long 0xec820d04 /* dcmpu cr1,f2,f1 */ ++ .long 0xfc820504 /* dcmpuq cr1,f2,f0 */ diff --git a/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch b/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch new file mode 100644 index 0000000..d7263ff --- /dev/null +++ b/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch @@ -0,0 +1,121 @@ +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/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch new file mode 100644 index 0000000..928c7fb --- /dev/null +++ b/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -0,0 +1,270 @@ +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/SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch b/SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch new file mode 100644 index 0000000..1132449 --- /dev/null +++ b/SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch @@ -0,0 +1,62 @@ +Index: gdb-7.5.50.20130118/gdb/infrun.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/infrun.c 2013-01-19 20:56:34.142917416 +0100 ++++ gdb-7.5.50.20130118/gdb/infrun.c 2013-01-19 20:56:34.662918474 +0100 +@@ -1628,7 +1628,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.5.50.20130118/gdb/testsuite/gdb.mi/mi-cli.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2013-01-01 07:41:24.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.mi/mi-cli.exp 2013-01-19 20:56:34.662918474 +0100 +@@ -163,7 +163,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.5.50.20130118/gdb/testsuite/gdb.mi/mi-logging.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2013-01-01 07:41:24.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.mi/mi-logging.exp 2013-01-19 20:56:34.662918474 +0100 +@@ -53,7 +53,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" +@@ -76,7 +76,7 @@ set chan [open $milogfile] + set logcontent [read $chan] + close $chan + +-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { ++if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { + pass "Redirect log file contents" + } else { + fail "Redirect log file contents" +Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.mi/mi-console.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.mi/mi-console.exp 2013-01-01 07:41:24.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.mi/mi-console.exp 2013-01-19 20:56:55.783961145 +0100 +@@ -45,6 +45,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\")?" \ diff --git a/SOURCES/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/SOURCES/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch new file mode 100644 index 0000000..4d4fd6b --- /dev/null +++ b/SOURCES/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -0,0 +1,205 @@ +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.5.50.20130215/gdb/inferior.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/inferior.h 2013-01-16 18:31:38.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/inferior.h 2013-02-15 22:31:42.993944957 +0100 +@@ -160,7 +160,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.5.50.20130215/gdb/infrun.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/infrun.c 2013-01-31 20:18:58.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/infrun.c 2013-02-15 22:34:07.132144519 +0100 +@@ -81,7 +81,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); +@@ -1709,7 +1709,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; +@@ -1727,7 +1728,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); +@@ -1760,9 +1761,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)); + +@@ -2140,7 +2145,7 @@ proceed (CORE_ADDR addr, enum gdb_signal + CORE_ADDR pc; + struct address_space *aspace; + /* GDB may force the inferior to step due to various reasons. */ +- int force_step = 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 +@@ -2180,13 +2185,13 @@ proceed (CORE_ADDR addr, enum gdb_signal + actually be executing the breakpoint insn anyway. + We'll be (un-)executing the previous instruction. */ + +- force_step = 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. */ +- force_step = 1; ++ resume_step = RESUME_STEP_USER; + } + else + { +@@ -2217,13 +2222,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)) +- force_step = 1; ++ resume_step = RESUME_STEP_USER; + } + + /* prepare_to_proceed may change the current thread. */ + tp = inferior_thread (); + +- if (force_step) ++ if (resume_step == RESUME_STEP_USER) + { + tp->control.trap_expected = 1; + /* If displaced stepping is enabled, we can step over the +@@ -2310,9 +2315,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 (force_step || 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. */ +@@ -5247,13 +5256,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.5.50.20130215/gdb/linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/linux-nat.c 2013-02-13 15:59:49.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/linux-nat.c 2013-02-15 22:31:42.997944967 +0100 +@@ -2971,7 +2971,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.5.50.20130215/gdb/linux-nat.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/linux-nat.h 2013-02-13 15:59:49.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/linux-nat.h 2013-02-15 22:31:42.998944969 +0100 +@@ -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/SOURCES/gdb-6.6-testsuite-timeouts.patch b/SOURCES/gdb-6.6-testsuite-timeouts.patch new file mode 100644 index 0000000..00f5d85 --- /dev/null +++ b/SOURCES/gdb-6.6-testsuite-timeouts.patch @@ -0,0 +1,26 @@ +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/SOURCES/gdb-6.6-threads-static-test.patch b/SOURCES/gdb-6.6-threads-static-test.patch new file mode 100644 index 0000000..3f8d16e --- /dev/null +++ b/SOURCES/gdb-6.6-threads-static-test.patch @@ -0,0 +1,18 @@ +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/SOURCES/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch b/SOURCES/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch new file mode 100644 index 0000000..9dc8a7b --- /dev/null +++ b/SOURCES/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch @@ -0,0 +1,703 @@ +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/SOURCES/gdb-6.7-charsign-test.patch b/SOURCES/gdb-6.7-charsign-test.patch new file mode 100644 index 0000000..793ff8a --- /dev/null +++ b/SOURCES/gdb-6.7-charsign-test.patch @@ -0,0 +1,118 @@ +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/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch new file mode 100644 index 0000000..761d10f --- /dev/null +++ b/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch @@ -0,0 +1,96 @@ +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/SOURCES/gdb-6.7-testsuite-stable-results.patch b/SOURCES/gdb-6.7-testsuite-stable-results.patch new file mode 100644 index 0000000..7e2fb39 --- /dev/null +++ b/SOURCES/gdb-6.7-testsuite-stable-results.patch @@ -0,0 +1,108 @@ +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/SOURCES/gdb-6.8-attach-signalled-detach-stopped.patch b/SOURCES/gdb-6.8-attach-signalled-detach-stopped.patch new file mode 100644 index 0000000..b98e2f3 --- /dev/null +++ b/SOURCES/gdb-6.8-attach-signalled-detach-stopped.patch @@ -0,0 +1,152 @@ +Index: gdb-7.5.50.20130215/gdb/linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/linux-nat.c 2013-02-15 22:38:05.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/linux-nat.c 2013-02-15 22:44:59.638985719 +0100 +@@ -181,6 +181,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 *); + +@@ -914,7 +917,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. */ + +@@ -1362,6 +1372,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 / +@@ -1790,6 +1801,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; + } + +@@ -1900,6 +1914,8 @@ linux_nat_detach (struct target_ops *ops + } + else + linux_ops->to_detach (ops, args, from_tty); ++ ++ pid_was_stopped = 0; + } + + /* Resume LP. */ +@@ -2086,6 +2102,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); + +@@ -4137,6 +4161,8 @@ linux_nat_mourn_inferior (struct target_ + + /* Let the arch-specific native code know this process is gone. */ + linux_nat_forget_process (pid); ++ ++ pid_was_stopped = 0; + } + + /* Convert a native/host siginfo object, into/from the siginfo in the +Index: gdb-7.5.50.20130215/gdb/testsuite/gdb.threads/attach-stopped.exp +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2013-01-01 07:41:27.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/testsuite/gdb.threads/attach-stopped.exp 2013-02-15 22:44:23.262930312 +0100 +@@ -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/SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch b/SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch new file mode 100644 index 0000000..4987714 --- /dev/null +++ b/SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch @@ -0,0 +1,25 @@ +Index: gdb-6.8.50.20090803/gdb/valops.c +=================================================================== +--- gdb-6.8.50.20090803.orig/gdb/valops.c 2009-08-04 06:30:45.000000000 +0200 ++++ gdb-6.8.50.20090803/gdb/valops.c 2009-08-04 06:33:05.000000000 +0200 +@@ -926,10 +926,18 @@ value_assign (struct value *toval, struc + struct gdbarch *gdbarch; + int value_reg; + +- /* Figure out which frame this is in currently. */ +- frame = frame_find_by_id (VALUE_FRAME_ID (toval)); + value_reg = VALUE_REGNUM (toval); + ++ /* Figure out which frame this is in currently. */ ++ frame = frame_find_by_id (VALUE_FRAME_ID (toval)); ++ /* "set $reg+=1" should work on programs with no debug info, ++ but frame_find_by_id returns NULL here (RH bug 436037). ++ Use current frame, it represents CPU state in this case. ++ If frame_find_by_id is changed to do it internally ++ (it is contemplated there), remove this. */ ++ if (!frame) ++ frame = get_current_frame (); ++ /* Probably never happens. */ + if (!frame) + error (_("Value being assigned to is no longer active.")); + diff --git a/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch b/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch new file mode 100644 index 0000000..1006588 --- /dev/null +++ b/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch @@ -0,0 +1,173 @@ +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/SOURCES/gdb-6.8-bz457187-largefile-test.patch b/SOURCES/gdb-6.8-bz457187-largefile-test.patch new file mode 100644 index 0000000..d2d6cf8 --- /dev/null +++ b/SOURCES/gdb-6.8-bz457187-largefile-test.patch @@ -0,0 +1,105 @@ +--- /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/SOURCES/gdb-6.8-quit-never-aborts.patch b/SOURCES/gdb-6.8-quit-never-aborts.patch new file mode 100644 index 0000000..74535be --- /dev/null +++ b/SOURCES/gdb-6.8-quit-never-aborts.patch @@ -0,0 +1,74 @@ +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.5.50.20130118/gdb/defs.h +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/defs.h 2013-01-01 07:32:41.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/defs.h 2013-01-21 16:40:29.889256633 +0100 +@@ -176,6 +176,7 @@ extern int check_quit_flag (void); + /* Set the quit flag. */ + extern void set_quit_flag (void); + ++extern int quit_flag_cleanup; + extern int immediate_quit; + + extern void quit (void); +Index: gdb-7.5.50.20130118/gdb/top.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/top.c 2013-01-21 14:56:12.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/top.c 2013-01-21 14:56:16.385710056 +0100 +@@ -1329,7 +1329,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.5.50.20130118/gdb/utils.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/utils.c 2013-01-21 14:56:12.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/utils.c 2013-01-21 16:41:02.225233493 +0100 +@@ -141,6 +141,11 @@ int quit_flag; + + int immediate_quit; + ++/* Nonzero means we are already processing the quitting cleanups and we should ++ no longer get aborted. */ ++ ++int quit_flag_cleanup; ++ + #ifndef HAVE_PYTHON + + /* Clear the quit flag. */ +@@ -164,6 +169,9 @@ set_quit_flag (void) + int + check_quit_flag (void) + { ++ if (quit_flag_cleanup) ++ return 0; ++ + /* This is written in a particular way to avoid races. */ + if (quit_flag) + { +Index: gdb-7.5.50.20130118/gdb/python/python.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/python/python.c 2013-01-21 16:39:03.000000000 +0100 ++++ gdb-7.5.50.20130118/gdb/python/python.c 2013-01-21 16:39:30.698299142 +0100 +@@ -181,6 +181,9 @@ set_quit_flag (void) + int + check_quit_flag (void) + { ++ if (quit_flag_cleanup) ++ return 0; ++ + return PyOS_InterruptOccurred (); + } + diff --git a/SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch b/SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch new file mode 100644 index 0000000..6df8c9a --- /dev/null +++ b/SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch @@ -0,0 +1,12 @@ +Index: gdb-7.4.50.20111218/gdb/sparc-tdep.c +=================================================================== +--- gdb-7.4.50.20111218.orig/gdb/sparc-tdep.c 2011-09-28 19:59:42.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/sparc-tdep.c 2011-12-19 01:25:29.294046199 +0100 +@@ -1316,6 +1316,7 @@ sparc32_store_return_value (struct type + if (sparc_floating_p (type) || sparc_complex_floating_p (type)) + { + /* Floating return values. */ ++ len = (len <= 8) ? len : 8; + memcpy (buf, valbuf, len); + regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf); + if (len > 4) diff --git a/SOURCES/gdb-6.8-watchpoint-conditionals-test.patch b/SOURCES/gdb-6.8-watchpoint-conditionals-test.patch new file mode 100644 index 0000000..b014074 --- /dev/null +++ b/SOURCES/gdb-6.8-watchpoint-conditionals-test.patch @@ -0,0 +1,78 @@ +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/SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch b/SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch new file mode 100644 index 0000000..d53ef03 --- /dev/null +++ b/SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch @@ -0,0 +1,51 @@ +Index: gdb-7.5.50.20130118/gdb/gdb_bfd.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/gdb_bfd.c 2013-01-18 23:11:18.158718709 +0100 ++++ gdb-7.5.50.20130118/gdb/gdb_bfd.c 2013-01-18 23:12:06.841787893 +0100 +@@ -27,12 +27,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. */ +@@ -205,6 +207,7 @@ free_one_bfd_section (bfd *abfd, asectio + + if (sect != NULL && sect->data != NULL) + { ++#ifndef __sparc__ + #ifdef HAVE_MMAP + if (sect->map_addr != NULL) + { +@@ -215,6 +218,7 @@ free_one_bfd_section (bfd *abfd, asectio + } + else + #endif ++#endif + xfree (sect->data); + } + } +@@ -360,6 +364,7 @@ gdb_bfd_map_section (asection *sectp, bf + if (descriptor->data != NULL) + goto done; + ++#ifndef __sparc__ + #ifdef HAVE_MMAP + if (!bfd_is_section_compressed (abfd, sectp)) + { +@@ -394,6 +399,7 @@ gdb_bfd_map_section (asection *sectp, bf + } + } + #endif /* HAVE_MMAP */ ++#endif + + /* Handle compressed sections, or ordinary uncompressed sections in + the no-mmap case. */ diff --git a/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch b/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch new file mode 100644 index 0000000..cbd9a36 --- /dev/null +++ b/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch @@ -0,0 +1,85 @@ +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/SOURCES/gdb-archer-pie-addons-keep-disabled.patch b/SOURCES/gdb-archer-pie-addons-keep-disabled.patch new file mode 100644 index 0000000..e67c336 --- /dev/null +++ b/SOURCES/gdb-archer-pie-addons-keep-disabled.patch @@ -0,0 +1,83 @@ +Index: gdb-7.5.50.20130215/gdb/breakpoint.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/breakpoint.c 2013-02-15 22:31:37.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/breakpoint.c 2013-02-15 22:37:08.216381988 +0100 +@@ -16020,6 +16020,50 @@ initialize_breakpoint_ops (void) + static struct cmd_list_element *enablebreaklist = NULL; + + void ++breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta) ++{ ++ struct bp_location *bl, **blp_tmp; ++ int changed = 0; ++ ++ gdb_assert (objfile->separate_debug_objfile_backlink == NULL); ++ ++ ALL_BP_LOCATIONS (bl, blp_tmp) ++ { ++ struct obj_section *osect; ++ ++ /* BL->SECTION can be correctly NULL for breakpoints with multiple ++ locations expanded through symtab. */ ++ ++ ALL_OBJFILE_OSECTIONS (objfile, osect) ++ { ++ CORE_ADDR relocated_address; ++ CORE_ADDR delta_offset; ++ ++ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index); ++ if (delta_offset == 0) ++ continue; ++ relocated_address = bl->address + delta_offset; ++ ++ if (obj_section_addr (osect) <= relocated_address ++ && relocated_address < obj_section_endaddr (osect)) ++ { ++ if (bl->inserted) ++ remove_breakpoint (bl, mark_uninserted); ++ ++ bl->address += delta_offset; ++ bl->requested_address += delta_offset; ++ ++ changed = 1; ++ } ++ } ++ } ++ ++ if (changed) ++ qsort (bp_location, bp_location_count, sizeof (*bp_location), ++ bp_location_compare); ++} ++ ++void + _initialize_breakpoint (void) + { + struct cmd_list_element *c; +Index: gdb-7.5.50.20130215/gdb/breakpoint.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/breakpoint.h 2013-02-03 16:57:06.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/breakpoint.h 2013-02-15 22:37:19.025395693 +0100 +@@ -1556,4 +1556,7 @@ extern void handle_solib_event (void); + + extern void breakpoint_free_objfile (struct objfile *objfile); + ++extern void breakpoints_relocate (struct objfile *objfile, ++ struct section_offsets *delta); ++ + #endif /* !defined (BREAKPOINT_H) */ +Index: gdb-7.5.50.20130215/gdb/objfiles.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/objfiles.c 2013-02-03 16:57:07.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/objfiles.c 2013-02-15 22:37:08.217381990 +0100 +@@ -831,6 +831,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/SOURCES/gdb-archer-pie-addons.patch b/SOURCES/gdb-archer-pie-addons.patch new file mode 100644 index 0000000..d099b5b --- /dev/null +++ b/SOURCES/gdb-archer-pie-addons.patch @@ -0,0 +1,82 @@ +Index: gdb-7.5.50.20130118/gdb/gdbtypes.h +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/gdbtypes.h 2013-01-18 23:07:03.488358315 +0100 ++++ gdb-7.5.50.20130118/gdb/gdbtypes.h 2013-01-18 23:08:10.286451570 +0100 +@@ -420,6 +420,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 */ +@@ -614,6 +615,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; + +@@ -1237,6 +1239,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) \ +@@ -1248,6 +1251,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)) +@@ -1264,6 +1268,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.5.50.20130118/gdb/jv-lang.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/jv-lang.c 2013-01-18 23:07:03.488358315 +0100 ++++ gdb-7.5.50.20130118/gdb/jv-lang.c 2013-01-18 23:08:10.286451570 +0100 +@@ -430,7 +430,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); +@@ -478,7 +479,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.5.50.20130118/gdb/value.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/value.c 2013-01-18 23:07:03.490358319 +0100 ++++ gdb-7.5.50.20130118/gdb/value.c 2013-01-18 23:08:10.287451543 +0100 +@@ -2624,7 +2624,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/SOURCES/gdb-archer.patch b/SOURCES/gdb-archer.patch new file mode 100644 index 0000000..ab0657f --- /dev/null +++ b/SOURCES/gdb-archer.patch @@ -0,0 +1,8489 @@ +http://sourceware.org/gdb/wiki/ProjectArcher +http://sourceware.org/gdb/wiki/ArcherBranchManagement + +GIT snapshot: +commit b1f8c6821303f6eb087fb7f57405483ac8812227 + +branch jankratochvil/fedora19 - the merge of branches: +jankratochvil/vla +tromey/python + + +diff --git a/README.archer b/README.archer +new file mode 100644 +index 0000000..1f7ab48 +--- /dev/null ++++ b/README.archer +@@ -0,0 +1,13 @@ ++Merge for Fedora 19: http://pkgs.fedoraproject.org/cgit/gdb.git/ ++ ++jankratochvil/vla ++tromey/python ++ ++================================================================ ++This branch originally held the Python code for gdb. It still exists ++because a small amount of code here has not yet been merged upstream. ++ ++================================================================ ++C variable length arrays / DW_FORM_block / Fortran dynamic arrays. ++implementation plan: http://sourceware.org/ml/gdb/2012-11/msg00094.html ++explanation of its merge status: http://sourceware.org/ml/gdb/2011-03/msg00021.html +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index ed30db5..4356be7 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1313,6 +1313,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/ada-lang.c b/gdb/ada-lang.c +index 75f1c3d..6243818 100644 +--- a/gdb/ada-lang.c ++++ b/gdb/ada-lang.c +@@ -12287,6 +12287,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) + { +@@ -12301,12 +12302,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/block.c b/gdb/block.c +index 2638de8..b296ae0 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 02e7e8b..2931401 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 d6f8bc5..8a14224 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -15653,6 +15653,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. +@@ -16636,4 +16654,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/c-typeprint.c b/gdb/c-typeprint.c +index ca8d89b..811ad72 100644 +--- a/gdb/c-typeprint.c ++++ b/gdb/c-typeprint.c +@@ -689,7 +689,13 @@ c_type_print_varspec_suffix (struct type *type, + + fprintf_filtered (stream, (is_vector ? + " __attribute__ ((vector_size(" : "[")); +- if (get_array_bounds (type, &low_bound, &high_bound)) ++ 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, "%s", + plongest (high_bound - low_bound + 1)); + fprintf_filtered (stream, (is_vector ? ")))" : "]")); +diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in +index d98ac77..f6a4b99 100644 +--- a/gdb/data-directory/Makefile.in ++++ b/gdb/data-directory/Makefile.in +@@ -53,16 +53,21 @@ PYTHON_DIR = python + PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) + PYTHON_FILES = \ + gdb/__init__.py \ +- gdb/types.py \ +- gdb/printing.py \ +- gdb/prompt.py \ + gdb/command/__init__.py \ ++ gdb/command/ignore_errors.py \ ++ gdb/command/pahole.py \ + gdb/command/type_printers.py \ + gdb/command/pretty_printers.py \ + gdb/command/prompt.py \ + gdb/command/explore.py \ + gdb/function/__init__.py \ +- gdb/function/strfns.py ++ gdb/function/strfns.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/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +index a607166..6913628 100644 +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -1216,6 +1216,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} +@@ -22804,8 +22814,6 @@ containing @code{end}. For example: + + @smallexample + (@value{GDBP}) python +-Type python script +-End with a line saying just "end". + >print 23 + >end + 23 +@@ -22819,6 +22827,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} +@@ -22840,6 +22856,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 +diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo +index 4a75c26..91446fe 100644 +--- a/gdb/doc/gdbint.texinfo ++++ b/gdb/doc/gdbint.texinfo +@@ -2101,6 +2101,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 +@@ -2193,6 +2205,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: +@@ -2294,6 +2307,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}). +@@ -2316,6 +2330,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 +@@ -2330,6 +2345,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 + +@@ -2415,6 +2431,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 +@@ -2486,6 +2503,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 +@@ -2508,6 +2526,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 +@@ -2519,10 +2538,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 adb7085..5ec5b5a 100644 +--- a/gdb/doc/observer.texi ++++ b/gdb/doc/observer.texi +@@ -249,6 +249,11 @@ The trace state variable @var{tsv} is deleted. If @var{tsv} is + The trace state value @var{tsv} is modified. + @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/dwarf2expr.c b/gdb/dwarf2expr.c +index 752d782..ab0a3eb 100644 +--- a/gdb/dwarf2expr.c ++++ b/gdb/dwarf2expr.c +@@ -1479,6 +1479,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 e85486a..e7ac799 100644 +--- a/gdb/dwarf2expr.h ++++ b/gdb/dwarf2expr.h +@@ -77,12 +77,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 8a61ae6..451a759 100644 +--- a/gdb/dwarf2loc.c ++++ b/gdb/dwarf2loc.c +@@ -298,6 +298,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. */ +@@ -361,16 +364,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; + +@@ -383,10 +384,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 +@@ -453,6 +467,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 * +@@ -1156,10 +1249,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; + +@@ -1167,10 +1262,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. */ + +@@ -2106,22 +2286,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 +@@ -2134,7 +2298,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); +@@ -2146,29 +2309,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; +@@ -2232,6 +2384,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) +@@ -4148,8 +4310,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, +@@ -4158,6 +4319,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 36641b3..1394578 100644 +--- a/gdb/dwarf2loc.h ++++ b/gdb/dwarf2loc.h +@@ -132,6 +132,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 df6298b..b11abf0 100644 +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -1624,6 +1624,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); +@@ -1656,6 +1659,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 *); + +@@ -1684,6 +1690,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, +@@ -11702,6 +11711,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. */ +@@ -11715,7 +11747,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; + const char *name; + +@@ -11768,17 +11800,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 +@@ -12413,29 +12447,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); + +@@ -12739,7 +12858,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + struct type *base_type, *orig_base_type; + struct type *range_type; + struct attribute *attr; +- LONGEST low, high; ++ LONGEST low; + int low_default_is_valid; + const char *name; + LONGEST negative_mask; +@@ -12798,42 +12917,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 +@@ -12872,24 +12955,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, orig_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, orig_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; ++ ++ 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; ++ } + +- /* Ada expects an empty array on no boundary attributes. */ +- if (attr == NULL && cu->language != language_ada) +- TYPE_HIGH_BOUND_UNDEFINED (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) +@@ -15749,10 +15971,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; +@@ -15793,6 +16017,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); +@@ -16602,6 +16828,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) + break; + } + ++ if (this_type) ++ finalize_type (this_type); ++ + return this_type; + } + +@@ -19046,62 +19275,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; + +- if (attr_form_is_section_offset (attr) ++ /* 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) + /* .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; + } + } + +@@ -19472,6 +19739,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. + +@@ -19496,6 +19782,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 +diff --git a/gdb/eval.c b/gdb/eval.c +index d7f80e2..8eca4c8 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" + +@@ -393,27 +394,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; + } + + +@@ -710,6 +901,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; +@@ -1776,6 +1968,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); + +@@ -1796,23 +1990,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: +@@ -2239,49 +2423,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]; +- +- array = value_subscripted_rvalue (array, index, +- f77_get_lowerbound (array_type)); +- } +- +- return array; +- } +- + case BINOP_LOGICAL_AND: + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); + if (noside == EVAL_SKIP) +@@ -2513,15 +2654,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)); +@@ -2530,12 +2679,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.")); + } +@@ -2545,9 +2700,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. */ +@@ -2960,7 +3120,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; + +@@ -2971,13 +3131,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); + } +@@ -3035,9 +3200,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); +@@ -3068,18 +3237,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/f-exp.y b/gdb/f-exp.y +index 846cc02..9283183 100644 +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y +@@ -297,7 +297,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 4ef1acf..8da016b 100644 +--- a/gdb/f-lang.h ++++ b/gdb/f-lang.h +@@ -29,6 +29,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, const struct type_print_options *); + ++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 aa33231..df998c4 100644 +--- a/gdb/f-typeprint.c ++++ b/gdb/f-typeprint.c +@@ -30,7 +30,7 @@ + #include "gdbcore.h" + #include "target.h" + #include "f-lang.h" +- ++#include "dwarf2loc.h" + #include "gdb_string.h" + #include + +@@ -47,6 +47,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 +@@ -56,6 +84,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') +@@ -162,6 +193,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 d01d6ec..8a21149 100644 +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -51,15 +51,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")); + +@@ -69,14 +71,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); +@@ -132,24 +137,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; + } + } + +@@ -171,37 +181,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, "..."); + } + } +@@ -267,6 +275,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 fb66e0f..45684f0 100644 +--- a/gdb/findvar.c ++++ b/gdb/findvar.c +@@ -34,6 +34,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 +@@ -437,7 +438,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,13 +450,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) + struct type *type = SYMBOL_TYPE (var); + CORE_ADDR addr; + +- /* 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); +- + if (symbol_read_needs_frame (var)) + gdb_assert (frame); + +@@ -492,7 +489,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) + 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)); +@@ -506,7 +502,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: +@@ -521,14 +516,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: +@@ -537,7 +530,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)); +@@ -563,7 +555,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 + { +@@ -612,7 +603,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; + +@@ -625,6 +615,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; +@@ -729,10 +723,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; + +@@ -747,7 +742,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/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in +index 05a38b2..9801fdf 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 ++ + if !$gdb_init_done + set variable $gdb_init_done = 1 + +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +index 12730d7..5a614e0 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. */ + +@@ -185,6 +188,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. */ +@@ -310,7 +350,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; + } +@@ -383,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; + } +@@ -806,6 +846,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; +@@ -926,6 +967,10 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound) + return 1; + } + ++static LONGEST type_length_get (struct type *type, struct type *target_type, ++ int full_span); ++ ++ + /* Create an array type using either a blank type supplied in + RESULT_TYPE, or creating a new type, inheriting the objfile from + RANGE_TYPE. +@@ -949,26 +994,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; + } +@@ -1489,6 +1539,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 +@@ -1655,52 +1804,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) +@@ -1708,6 +1842,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); +@@ -3384,33 +3519,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; +@@ -3425,9 +3569,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; +@@ -3438,6 +3583,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)) +@@ -3446,12 +3606,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++) + { +@@ -3460,8 +3656,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)); +@@ -3492,24 +3688,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 +@@ -3526,6 +3882,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. + +@@ -4090,6 +4457,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_zuinteger_cmd ("overload", no_class, &overload_debug, +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index 0ca7a87..c6029dc 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -226,6 +226,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 +@@ -309,6 +314,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. */ + +@@ -425,6 +474,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. */ +@@ -505,6 +563,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. +@@ -587,13 +659,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 +@@ -1053,9 +1146,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 +@@ -1063,11 +1156,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) \ +@@ -1084,7 +1182,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++ */ + +@@ -1529,6 +1634,18 @@ extern struct type *create_array_type (struct type *, struct type *, + struct type *); + extern struct type *lookup_array_range_type (struct type *, LONGEST, LONGEST); + ++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 *, LONGEST, LONGEST); +@@ -1574,6 +1691,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]) +@@ -1652,8 +1773,7 @@ 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); +diff --git a/gdb/main.c b/gdb/main.c +index 06f3feb..141a01b 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" +@@ -314,6 +315,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; +@@ -504,10 +507,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; + +@@ -525,6 +532,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; +@@ -733,7 +743,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 +@@ -1013,7 +1047,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) + { +@@ -1024,13 +1059,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. */ + } +@@ -1062,7 +1109,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 (_("\ +@@ -1104,7 +1156,13 @@ Options:\n\n\ + fputs_unfiltered (_(" files.\n\ + --nh Do not read "), stream); + fputs_unfiltered (gdbinit, stream); +- fputs_unfiltered (_(" file from home directory.\n\ ++ fputs_unfiltered (_(" file from home directory.\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/p-valprint.c b/gdb/p-valprint.c +index bcc055e..8a9d645 100644 +--- a/gdb/p-valprint.c ++++ b/gdb/p-valprint.c +@@ -38,6 +38,7 @@ + #include "cp-abi.h" + #include "cp-support.h" + #include "exceptions.h" ++#include "dwarf2loc.h" + + + /* Decorations for Pascal. */ +@@ -73,8 +74,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: +@@ -130,8 +154,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, "}"); + } +@@ -169,6 +193,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; + } + +@@ -270,6 +295,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + } + } + ++ do_cleanups (back_to); + return; + + case TYPE_CODE_REF: +@@ -410,6 +436,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 09c378b..93c434f 100644 +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -1757,6 +1757,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) +@@ -1796,7 +1797,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; + } + } +@@ -1814,7 +1815,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. */ +@@ -1827,24 +1829,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) + { +@@ -1859,7 +1864,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; +@@ -1890,8 +1897,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 8d25311..233ed46 100644 +--- a/gdb/parser-defs.h ++++ b/gdb/parser-defs.h +@@ -244,6 +244,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); +@@ -330,6 +332,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); +diff --git a/gdb/printcmd.c b/gdb/printcmd.c +index 155703d..545a615 100644 +--- a/gdb/printcmd.c ++++ b/gdb/printcmd.c +@@ -51,6 +51,7 @@ + #include "cli/cli-utils.h" + #include "format.h" + #include "source.h" ++#include "dwarf2loc.h" + + #ifdef TUI + #include "tui/tui.h" /* For tui_active et al. */ +@@ -967,6 +968,11 @@ print_command_1 (char *exp, 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)) + { +@@ -1039,6 +1045,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); +@@ -1467,6 +1476,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. +@@ -1964,6 +1991,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); +@@ -2613,4 +2644,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/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..636f99d +--- /dev/null ++++ b/gdb/python/lib/gdb/command/pahole.py +@@ -0,0 +1,81 @@ ++# pahole command for gdb ++ ++# Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++import gdb ++ ++class Pahole (gdb.Command): ++ """Show the holes in a structure. ++This command takes a single argument, a type name. ++It prints the type and displays comments showing where holes are.""" ++ ++ def __init__ (self): ++ super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE, ++ gdb.COMPLETE_SYMBOL) ++ ++ def maybe_print_hole(self, bitpos, field_bitpos): ++ if bitpos != field_bitpos: ++ hole = field_bitpos - bitpos ++ print ' /* XXX %d bit hole, try to pack */' % hole ++ ++ def pahole (self, type, level, name): ++ if name is None: ++ name = '' ++ tag = type.tag ++ if tag is None: ++ tag = '' ++ print '%sstruct %s {' % (' ' * (2 * level), tag) ++ bitpos = 0 ++ for field in type.fields (): ++ # Skip static fields. ++ if not hasattr (field, ('bitpos')): ++ continue ++ ++ ftype = field.type.strip_typedefs() ++ ++ self.maybe_print_hole(bitpos, field.bitpos) ++ bitpos = field.bitpos ++ if field.bitsize > 0: ++ fieldsize = field.bitsize ++ else: ++ # TARGET_CHAR_BIT here... ++ fieldsize = 8 * ftype.sizeof ++ ++ # TARGET_CHAR_BIT ++ print ' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), ++ bitpos = bitpos + fieldsize ++ ++ if ftype.code == gdb.TYPE_CODE_STRUCT: ++ self.pahole (ftype, level + 1, field.name) ++ else: ++ print ' ' * (2 + 2 * level), ++ print '%s %s' % (str (ftype), field.name) ++ ++ if level == 0: ++ self.maybe_print_hole(bitpos, 8 * type.sizeof) ++ ++ print ' ' * (14 + 2 * level), ++ print '} %s' % name ++ ++ def invoke (self, arg, from_tty): ++ type = gdb.lookup_type (arg) ++ type = type.strip_typedefs () ++ if type.code != gdb.TYPE_CODE_STRUCT: ++ raise TypeError, '%s is not a struct type' % arg ++ print ' ' * 14, ++ self.pahole (type, 0, '') ++ ++Pahole() +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 051cff0..e2f2ebe 100644 +--- a/gdb/python/py-type.c ++++ b/gdb/python/py-type.c +@@ -31,6 +31,8 @@ + #include "bcache.h" + #include "dwarf2loc.h" + #include "typeprint.h" ++#include "observer.h" ++#include "gdb_assert.h" + + typedef struct pyty_type_object + { +@@ -39,11 +41,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. */ +@@ -1192,8 +1202,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) + { +@@ -1211,12 +1276,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; + } +@@ -1227,43 +1293,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; + +- Py_TYPE (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). */ + +@@ -1483,7 +1534,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; + } +@@ -1563,6 +1617,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 11cc038..ef238f6 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 + +@@ -1385,6 +1386,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) + { +@@ -1395,6 +1409,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 cd8ddfb..e906c4f 100644 +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -67,6 +67,8 @@ 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" +@@ -1099,6 +1101,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) +@@ -1749,6 +1798,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 24e3077..0443087 100644 +--- a/gdb/python/python.h ++++ b/gdb/python/python.h +@@ -34,6 +34,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/stack.c b/gdb/stack.c +index f2aeb10..d20b2f1 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/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp +index e22cb3a..5e16186 100644 +--- a/gdb/testsuite/gdb.ada/packed_array.exp ++++ b/gdb/testsuite/gdb.ada/packed_array.exp +@@ -56,5 +56,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 2cc935b..30c7f85 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 387b34f..d5956ce 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 55e13cf..441c28b 100644 +--- a/gdb/testsuite/gdb.gdb/selftest.exp ++++ b/gdb/testsuite/gdb.gdb/selftest.exp +@@ -91,6 +91,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..99b6cc7 +--- /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=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,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 806da94..b22231a 100644 +--- a/gdb/testsuite/gdb.python/py-frame.exp ++++ b/gdb/testsuite/gdb.python/py-frame.exp +@@ -94,3 +94,5 @@ gdb_test "python print ('result = %s' % f0.read_var ('variable_which_surely_does + gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.read_var - success" + + gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame" ++ ++gdb_test "python print ('result = %s' % (f0.block ()))" "" "test Frame.block" +diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp +index 9142c72..2855220 100644 +--- a/gdb/testsuite/gdb.python/py-value.exp ++++ b/gdb/testsuite/gdb.python/py-value.exp +@@ -366,6 +366,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. +@@ -492,6 +501,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 8b16b38..f6e59b0 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -143,6 +143,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 569fb02..cacecf4 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 e9a40fc..de051c8 100644 +--- a/gdb/top.c ++++ b/gdb/top.c +@@ -350,6 +350,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 2d5a6af..5251e3f 100644 +--- a/gdb/typeprint.c ++++ b/gdb/typeprint.c +@@ -34,6 +34,7 @@ + #include "gdb_string.h" + #include "exceptions.h" + #include "valprint.h" ++#include "dwarf2loc.h" + #include + #include + #include "cli/cli-utils.h" +@@ -363,6 +364,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, &default_ptype_flags); + } + +@@ -410,6 +414,7 @@ whatis_exp (char *exp, int show) + struct value_print_options opts; + struct type_print_options flags = default_ptype_flags; + ++ /* Required at least for the object_address_set call. */ + old_chain = make_cleanup (null_cleanup, NULL); + + if (exp) +@@ -457,6 +462,7 @@ whatis_exp (char *exp, int show) + else + val = access_value_history (0); + ++ object_address_set (value_raw_address (val)); + type = value_type (val); + + get_user_print_options (&opts); +diff --git a/gdb/utils.c b/gdb/utils.c +index 4c2f08c..d1c8710 100644 +--- a/gdb/utils.c ++++ b/gdb/utils.c +@@ -1805,6 +1805,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/utils.h b/gdb/utils.h +index 52bcaff..6ab417b 100644 +--- a/gdb/utils.h ++++ b/gdb/utils.h +@@ -375,4 +375,6 @@ extern int myread (int, char *, int); + extern ULONGEST align_up (ULONGEST v, int n); + extern ULONGEST align_down (ULONGEST v, int n); + ++extern struct cleanup *make_cleanup_restore_selected_frame (void); ++ + #endif /* UTILS_H */ +diff --git a/gdb/valarith.c b/gdb/valarith.c +index 18c14fc..0a3a3aa 100644 +--- a/gdb/valarith.c ++++ b/gdb/valarith.c +@@ -195,7 +195,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) +@@ -255,6 +258,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 93c09d8..aef0991 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 unsigned int overload_debug; + /* Local functions. */ +@@ -903,6 +904,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 * +@@ -965,7 +1025,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 +@@ -998,13 +1059,24 @@ value_fetch_lazy (struct value *val) + } + else if (VALUE_LVAL (val) == lval_memory) + { +- CORE_ADDR addr = value_address (val); +- struct type *type = check_typedef (value_enclosing_type (val)); ++ CORE_ADDR addr = value_raw_address (val); + +- if (TYPE_LENGTH (type)) +- read_value_memory (val, 0, value_stack (val), +- addr, value_contents_all_raw (val), +- TYPE_LENGTH (type)); ++ 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) + { +@@ -1529,7 +1601,18 @@ address_of_variable (struct symbol *var, const 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); + } +@@ -1636,6 +1719,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 +@@ -1645,8 +1729,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 +@@ -3721,6 +3809,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); ++ + + { + struct type *element_type = TYPE_TARGET_TYPE (array_type); +diff --git a/gdb/valprint.c b/gdb/valprint.c +index 18cff49..89cb01a 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 + +@@ -287,7 +288,6 @@ scalar_type_p (struct type *type) + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_SET: +- case TYPE_CODE_STRING: + return 0; + default: + return 1; +@@ -1604,6 +1604,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 +@@ -1612,9 +1613,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)) +@@ -1701,6 +1726,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 4b70ece..7449c2a 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. */ + +@@ -1435,12 +1436,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; +@@ -1448,6 +1452,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); + } + + +@@ -1581,6 +1591,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. +@@ -2116,6 +2151,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 +@@ -2163,11 +2230,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); + } + +@@ -2182,7 +2248,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: +@@ -3280,10 +3346,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; +@@ -3405,4 +3488,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 c10c3ec..8d07348 100644 +--- a/gdb/value.h ++++ b/gdb/value.h +@@ -537,6 +537,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/SOURCES/gdb-attach-fail-reasons-5of5.patch b/SOURCES/gdb-attach-fail-reasons-5of5.patch new file mode 100644 index 0000000..a98e256 --- /dev/null +++ b/SOURCES/gdb-attach-fail-reasons-5of5.patch @@ -0,0 +1,245 @@ +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.50.20130215/gdb/common/linux-ptrace.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/common/linux-ptrace.c 2013-01-08 20:38:51.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/common/linux-ptrace.c 2013-02-15 22:38:05.782456279 +0100 +@@ -29,6 +29,10 @@ + #include "gdb_assert.h" + #include "gdb_wait.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. */ +@@ -48,6 +52,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__ +@@ -243,3 +249,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.50.20130215/gdb/common/linux-ptrace.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/common/linux-ptrace.h 2013-01-01 07:32:54.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/common/linux-ptrace.h 2013-02-15 22:38:05.782456279 +0100 +@@ -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.50.20130215/gdb/configure.ac +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/configure.ac 2013-02-15 22:37:57.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/configure.ac 2013-02-15 22:38:05.783456281 +0100 +@@ -2068,6 +2068,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.50.20130215/gdb/gdbserver/configure.ac +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/gdbserver/configure.ac 2013-01-01 07:33:00.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/gdbserver/configure.ac 2013-02-15 22:38:05.783456281 +0100 +@@ -451,6 +451,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.50.20130215/gdb/gdbserver/linux-low.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/gdbserver/linux-low.c 2013-02-04 18:47:00.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/gdbserver/linux-low.c 2013-02-15 22:39:54.256591069 +0100 +@@ -602,6 +602,29 @@ add_lwp (ptid_t ptid) + return lwp; + } + ++/* Execute PTRACE_TRACEME with error checking. */ ++ ++static void ++linux_traceme (const char *program) ++{ ++ int save_errno; ++ struct buffer buffer; ++ ++ errno = 0; ++ if (ptrace (PTRACE_TRACEME, 0, ++ (PTRACE_ARG3_TYPE) 0, (PTRACE_ARG4_TYPE) 0) == 0) ++ return; ++ ++ save_errno = errno; ++ buffer_init (&buffer); ++ linux_ptrace_create_warnings (&buffer); ++ buffer_grow_str0 (&buffer, ""); ++ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"), ++ buffer_finish (&buffer), program, strerror (save_errno)); ++ fflush (stderr); ++ _exit (0177); ++} ++ + /* Start an inferior process and returns its pid. + ALLARGS is a vector of program-name and args. */ + +@@ -642,7 +665,7 @@ linux_create_inferior (char *program, ch + + if (pid == 0) + { +- ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE) 0, (PTRACE_ARG4_TYPE) 0); ++ linux_traceme (program); + + #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */ + signal (__SIGRTMIN + 1, SIG_DFL); +@@ -4587,7 +4610,7 @@ linux_tracefork_grandchild (void *arg) + static int + linux_tracefork_child (void *arg) + { +- ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE) 0, (PTRACE_ARG4_TYPE) 0); ++ linux_traceme ("PTRACE_O_TRACEFORK test"); + kill (getpid (), SIGSTOP); + + #if !(defined(__UCLIBC__) && defined(HAS_NOMMU)) +Index: gdb-7.5.50.20130215/gdb/inf-ptrace.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/inf-ptrace.c 2013-01-01 07:32:45.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/inf-ptrace.c 2013-02-15 22:38:05.786456289 +0100 +@@ -104,7 +104,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.50.20130215/gdb/linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/linux-nat.c 2013-02-15 22:34:44.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/linux-nat.c 2013-02-15 22:38:05.787456291 +0100 +@@ -1557,6 +1557,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. */ +@@ -1581,7 +1582,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) +@@ -1593,6 +1597,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/SOURCES/gdb-attach-fail-reasons-5of5configure.patch b/SOURCES/gdb-attach-fail-reasons-5of5configure.patch new file mode 100644 index 0000000..76b80ee --- /dev/null +++ b/SOURCES/gdb-attach-fail-reasons-5of5configure.patch @@ -0,0 +1,186 @@ +Index: gdb-7.5.91.20130323/gdb/config.in +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/config.in 2013-03-23 19:48:18.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/config.in 2013-03-23 19:50:53.300066378 +0100 +@@ -216,6 +216,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 + +@@ -360,6 +363,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.5.91.20130323/gdb/configure +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/configure 2013-03-23 19:48:18.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/configure 2013-03-23 19:50:53.303066376 +0100 +@@ -12814,6 +12814,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.5.91.20130323/gdb/gdbserver/config.in +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/gdbserver/config.in 2013-03-11 09:35:09.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/gdbserver/config.in 2013-03-23 19:51:14.323052419 +0100 +@@ -73,6 +73,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 if the target supports branch tracing. */ + #undef HAVE_LINUX_BTRACE + +@@ -140,6 +143,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.5.91.20130323/gdb/gdbserver/configure +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/gdbserver/configure 2013-03-11 09:35:09.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/gdbserver/configure 2013-03-23 19:50:53.305066374 +0100 +@@ -5911,6 +5911,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/SOURCES/gdb-bz533176-fortran-omp-step.patch b/SOURCES/gdb-bz533176-fortran-omp-step.patch new file mode 100644 index 0000000..0725ad2 --- /dev/null +++ b/SOURCES/gdb-bz533176-fortran-omp-step.patch @@ -0,0 +1,125 @@ +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.5.50.20130118/gdb/infrun.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/infrun.c 2013-01-19 23:38:22.329371410 +0100 ++++ gdb-7.5.50.20130118/gdb/infrun.c 2013-01-19 23:39:03.322429041 +0100 +@@ -4918,6 +4918,16 @@ process_event_stop_test: + + if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL) + { ++ struct symbol *stop_fn = find_pc_function (stop_pc); ++ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc); ++ ++ if ((stop_fn == NULL ++ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL) ++ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */ ++ && (stopf == NULL ++ || strstr (SYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL)) ++{ /* ".omp_fn." */ ++ + /* We're doing a "next". + + Normal (forward) execution: set a breakpoint at the +@@ -4953,6 +4963,7 @@ process_event_stop_test: + + keep_going (ecs); + return; ++} /* ".omp_fn." */ + } + + /* If we are in a function call trampoline (a stub between the +Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp 2013-01-19 23:38:23.213372622 +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.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.f90 2013-01-19 23:38:23.213372622 +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/SOURCES/gdb-bz541866-rwatch-before-run.patch b/SOURCES/gdb-bz541866-rwatch-before-run.patch new file mode 100644 index 0000000..46650e3 --- /dev/null +++ b/SOURCES/gdb-bz541866-rwatch-before-run.patch @@ -0,0 +1,151 @@ +Index: gdb-7.5.91.20130323/gdb/config/i386/linux64.mh +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux64.mh 2013-03-11 09:25:58.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/config/i386/linux64.mh 2013-03-23 19:48:37.707761117 +0100 +@@ -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 linux-btrace.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.5.91.20130323/gdb/config/i386/linux.mh +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux.mh 2013-03-11 09:25:58.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/config/i386/linux.mh 2013-03-23 19:48:22.757990256 +0100 +@@ -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.5.91.20130323/gdb/config/i386/nm-linux.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux.h 2013-03-23 19:48:22.757990256 +0100 +@@ -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.5.91.20130323/gdb/config/i386/nm-linux64.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux64.h 2013-03-23 19:48:22.757990256 +0100 +@@ -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.5.91.20130323/gdb/target.h +=================================================================== +--- gdb-7.5.91.20130323.orig/gdb/target.h 2013-03-11 09:50:05.000000000 +0100 ++++ gdb-7.5.91.20130323/gdb/target.h 2013-03-23 19:48:22.758990238 +0100 +@@ -1563,8 +1563,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.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2013-03-23 19:48:22.758990238 +0100 +@@ -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/SOURCES/gdb-bz568248-oom-is-error.patch b/SOURCES/gdb-bz568248-oom-is-error.patch new file mode 100644 index 0000000..045d34e --- /dev/null +++ b/SOURCES/gdb-bz568248-oom-is-error.patch @@ -0,0 +1,68 @@ +http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html +Subject: [rfc patch] nomem: internal_error -> error + +Hi, + +unfortunately I see this problem reproducible only with the +archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]). +OTOH this branch I hopefully submit in some form for FSF GDB later. + +In this case (a general problem but tested for example on Fedora 13 i686): + +int +main (int argc, char **argv) +{ + char a[argc]; + return a[0]; +} + +(gdb) start +(gdb) print a +../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes. + +It is apparently because boundary for the variable `a' is not initialized +there. Users notice it due to Eclipse-CDT trying to automatically display all +the local variables on each step. + + +Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. +But is anone aware of the reasons to use internal_error there? +I find simple error as a perfectly reasonable there. +(history only tracks it since the initial import) + +IIRC this idea has been discussed with Tom Tromey, not sure of its origin. + +I understand it may be offtopic for FSF GDB but from some GDB crashes I am not +sure if it can happen only due to the VLA variables. + + +Thanks, +Jan + + +gdb/ +2010-06-01 Jan Kratochvil + 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/SOURCES/gdb-bz601887-dwarf4-rh-test.patch b/SOURCES/gdb-bz601887-dwarf4-rh-test.patch new file mode 100644 index 0000000..4774bda --- /dev/null +++ b/SOURCES/gdb-bz601887-dwarf4-rh-test.patch @@ -0,0 +1,240 @@ +--- /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/SOURCES/gdb-bz634108-solib_address.patch b/SOURCES/gdb-bz634108-solib_address.patch new file mode 100644 index 0000000..a555872 --- /dev/null +++ b/SOURCES/gdb-bz634108-solib_address.patch @@ -0,0 +1,31 @@ +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/SOURCES/gdb-ccache-workaround.patch b/SOURCES/gdb-ccache-workaround.patch new file mode 100644 index 0000000..1e5ebe1 --- /dev/null +++ b/SOURCES/gdb-ccache-workaround.patch @@ -0,0 +1,17 @@ +--- 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/SOURCES/gdb-core-open-vdso-warning.patch b/SOURCES/gdb-core-open-vdso-warning.patch new file mode 100644 index 0000000..cafd844 --- /dev/null +++ b/SOURCES/gdb-core-open-vdso-warning.patch @@ -0,0 +1,131 @@ +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.5.50.20130118/gdb/solib-svr4.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/solib-svr4.c 2013-01-18 23:05:19.414210015 +0100 ++++ gdb-7.5.50.20130118/gdb/solib-svr4.c 2013-01-18 23:05:34.813231664 +0100 +@@ -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.5.50.20130118/gdb/solib.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/solib.c 2013-01-18 23:05:19.415210017 +0100 ++++ gdb-7.5.50.20130118/gdb/solib.c 2013-01-18 23:05:57.421263173 +0100 +@@ -666,7 +666,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(); +@@ -837,6 +837,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.5.50.20130118/gdb/testsuite/gdb.base/corefile.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/corefile.exp 2013-01-18 23:05:19.416210020 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/corefile.exp 2013-01-18 23:05:34.814231667 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.base/solib-symbol.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2013-01-18 23:05:19.416210020 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/solib-symbol.exp 2013-01-18 23:05:34.814231667 +0100 +@@ -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/SOURCES/gdb-dlopen-stap-probe-1of9.patch b/SOURCES/gdb-dlopen-stap-probe-1of9.patch new file mode 100644 index 0000000..2419dc9 --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-1of9.patch @@ -0,0 +1,102 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00012.html + +### src/gdb/ChangeLog 2013/06/04 02:44:34 1.15680 +### src/gdb/ChangeLog 2013/06/04 12:50:20 1.15681 +## -1,3 +1,11 @@ ++2013-06-04 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. ++ + 2013-06-04 Alan Modra + + * ppc-tdep.h (ppc_insns_match_pattern): Update prototype. +--- src/gdb/probe.c 2013/05/30 17:39:34 1.8 ++++ src/gdb/probe.c 2013/06/04 12:50:20 1.9 +@@ -611,28 +611,55 @@ + + /* 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. */ +--- src/gdb/probe.h 2013/01/01 06:32:49 1.4 ++++ src/gdb/probe.h 2013/06/04 12:50:21 1.5 +@@ -214,6 +214,16 @@ + + 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/SOURCES/gdb-dlopen-stap-probe-2of9.patch b/SOURCES/gdb-dlopen-stap-probe-2of9.patch new file mode 100644 index 0000000..131a79a --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-2of9.patch @@ -0,0 +1,181 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00013.html + +### src/gdb/ChangeLog 2013/06/04 12:50:20 1.15681 +### src/gdb/ChangeLog 2013/06/04 12:53:33 1.15682 +## -1,5 +1,24 @@ + 2013-06-04 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): Removed field ++ "objfiles_changed_p". New fields "new_objfiles_available", ++ "section_map_dirty" and "inhibit_updates". ++ (allocate_objfile): Set new_objfiles_available. ++ (free_objfile): Set section_map_dirty. ++ (objfile_relocate1): Likewise. ++ (in_plt_section): Likewise. ++ (find_pc_section): Update the conditions under which the ++ section map will be updated. ++ (inhibit_section_map_updates): New function. ++ (resume_section_map_updates): Likewise. ++ (resume_section_map_updates_cleanup): Likewise. ++ ++2013-06-04 Gary Benson ++ + * probe.h (get_probe_argument_count): New declaration. + (evaluate_probe_argument): Likewise. + * probe.c (get_probe_argument_count): New function. +--- src/gdb/objfiles.c 2013/05/06 19:15:17 1.160 ++++ src/gdb/objfiles.c 2013/06/04 12:53:34 1.161 +@@ -67,9 +67,18 @@ + + struct objfile_pspace_info + { +- int objfiles_changed_p; + struct obj_section **sections; + int num_sections; ++ ++ /* Nonzero if object files have been added since the section map ++ was last updated. */ ++ int new_objfiles_available; ++ ++ /* Nonzero if the section map MUST be updated before use. */ ++ int section_map_dirty; ++ ++ /* Nonzero if section map updates should be inhibited if possible. */ ++ int inhibit_updates; + }; + + /* Per-program-space data key. */ +@@ -317,7 +326,7 @@ + objfile->flags |= flags; + + /* Rebuild section map next time we need it. */ +- get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1; ++ get_objfile_pspace_data (objfile->pspace)->new_objfiles_available = 1; + + return objfile; + } +@@ -646,7 +655,7 @@ + obstack_free (&objfile->objfile_obstack, 0); + + /* Rebuild section map next time we need it. */ +- get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1; ++ get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1; + + xfree (objfile); + } +@@ -826,7 +835,7 @@ + } + + /* Rebuild section map next time we need it. */ +- get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1; ++ get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1; + + /* Update the table in exec_ops, used to read memory. */ + ALL_OBJFILE_OSECTIONS (objfile, s) +@@ -1291,11 +1300,14 @@ + update_section_map (struct program_space *pspace, + struct obj_section ***pmap, int *pmap_size) + { ++ struct objfile_pspace_info *pspace_info; + int alloc_size, map_size, i; + struct obj_section *s, **map; + struct objfile *objfile; + +- gdb_assert (get_objfile_pspace_data (pspace)->objfiles_changed_p != 0); ++ pspace_info = get_objfile_pspace_data (pspace); ++ gdb_assert (pspace_info->section_map_dirty != 0 ++ || pspace_info->new_objfiles_available != 0); + + map = *pmap; + xfree (map); +@@ -1365,7 +1377,9 @@ + return s; + + pspace_info = get_objfile_pspace_data (current_program_space); +- if (pspace_info->objfiles_changed_p != 0) ++ if (pspace_info->section_map_dirty ++ || (pspace_info->new_objfiles_available ++ && !pspace_info->inhibit_updates)) + { + update_section_map (current_program_space, + &pspace_info->sections, +@@ -1373,7 +1387,8 @@ + + /* Don't need updates to section map until objfiles are added, + removed or relocated. */ +- pspace_info->objfiles_changed_p = 0; ++ pspace_info->new_objfiles_available = 0; ++ pspace_info->section_map_dirty = 0; + } + + /* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to +@@ -1414,14 +1429,38 @@ + } + + +-/* Set objfiles_changed_p so section map will be rebuilt next time it ++/* Set section_map_dirty so section map will be rebuilt next time it + is used. Called by reread_symbols. */ + + void + objfiles_changed (void) + { + /* Rebuild section map next time we need it. */ +- get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; ++ get_objfile_pspace_data (current_program_space)->section_map_dirty = 1; ++} ++ ++/* See comments in objfiles.h. */ ++ ++void ++inhibit_section_map_updates (struct program_space *pspace) ++{ ++ get_objfile_pspace_data (pspace)->inhibit_updates = 1; ++} ++ ++/* See comments in objfiles.h. */ ++ ++void ++resume_section_map_updates (struct program_space *pspace) ++{ ++ get_objfile_pspace_data (pspace)->inhibit_updates = 0; ++} ++ ++/* See comments in objfiles.h. */ ++ ++void ++resume_section_map_updates_cleanup (void *arg) ++{ ++ resume_section_map_updates (arg); + } + + /* The default implementation for the "iterate_over_objfiles_in_search_order" +--- src/gdb/objfiles.h 2013/05/06 19:15:17 1.106 ++++ src/gdb/objfiles.h 2013/06/04 12:53:34 1.107 +@@ -501,6 +501,22 @@ + modules. */ + DECLARE_REGISTRY(objfile); + ++/* 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 (struct program_space *pspace); ++ ++/* Resume automatically rebuilding the section map as required. */ ++extern void resume_section_map_updates (struct program_space *pspace); ++ ++/* 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, diff --git a/SOURCES/gdb-dlopen-stap-probe-3of9.patch b/SOURCES/gdb-dlopen-stap-probe-3of9.patch new file mode 100644 index 0000000..951f4bd --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-3of9.patch @@ -0,0 +1,298 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00014.html + +### src/gdb/gdbserver/ChangeLog 2013/05/31 19:14:33 1.720 +### src/gdb/gdbserver/ChangeLog 2013/06/04 12:59:20 1.721 +## -1,3 +1,12 @@ ++2013-06-04 Gary Benson ++ ++ * server.c (handle_query): Add "augmented-libraries-svr4-read+" ++ to qSupported response when appropriate. ++ (handle_qxfer_libraries_svr4): Allow qXfer:libraries-svr4:read ++ with nonzero-length annex. ++ * linux-low.c (linux_qxfer_libraries_svr4): Parse and handle ++ arguments supplied in annex. ++ + 2013-05-31 Doug Evans + + * linux-x86-low.c (ps_get_thread_area): Properly extend address to +--- src/gdb/gdbserver/linux-low.c 2013/05/23 17:17:50 1.237 ++++ src/gdb/gdbserver/linux-low.c 2013/06/04 12:59:21 1.238 +@@ -5728,6 +5728,12 @@ + }; + const struct link_map_offsets *lmo; + unsigned int machine; ++ int ptr_size; ++ CORE_ADDR lm_addr = 0, lm_prev = 0; ++ int allocated = 1024; ++ char *p; ++ CORE_ADDR l_name, l_addr, l_ld, l_next, l_prev; ++ int header_done = 0; + + if (writebuf != NULL) + return -2; +@@ -5738,128 +5744,144 @@ + xsnprintf (filename, sizeof filename, "/proc/%d/exe", pid); + is_elf64 = elf_64_file_p (filename, &machine); + lmo = is_elf64 ? &lmo_64bit_offsets : &lmo_32bit_offsets; ++ ptr_size = is_elf64 ? 8 : 4; + +- if (priv->r_debug == 0) +- priv->r_debug = get_r_debug (pid, is_elf64); +- +- /* We failed to find DT_DEBUG. Such situation will not change for this +- inferior - do not retry it. Report it to GDB as E01, see for the reasons +- at the GDB solib-svr4.c side. */ +- if (priv->r_debug == (CORE_ADDR) -1) +- return -1; +- +- if (priv->r_debug == 0) ++ while (annex[0] != '\0') + { +- document = xstrdup ("\n"); ++ const char *sep; ++ CORE_ADDR *addrp; ++ int len; ++ ++ sep = strchr (annex, '='); ++ if (sep == NULL) ++ break; ++ ++ len = sep - annex; ++ if (len == 5 && strncmp (annex, "start", 5) == 0) ++ addrp = &lm_addr; ++ else if (len == 4 && strncmp (annex, "prev", 4) == 0) ++ addrp = &lm_prev; ++ else ++ { ++ annex = strchr (sep, ';'); ++ if (annex == NULL) ++ break; ++ annex++; ++ continue; ++ } ++ ++ annex = decode_address_to_semicolon (addrp, sep + 1); + } +- else ++ ++ if (lm_addr == 0) + { +- int allocated = 1024; +- char *p; +- const int ptr_size = is_elf64 ? 8 : 4; +- CORE_ADDR lm_addr, lm_prev, l_name, l_addr, l_ld, l_next, l_prev; +- int r_version, header_done = 0; +- +- document = xmalloc (allocated); +- strcpy (document, "r_debug + lmo->r_version_offset, +- (unsigned char *) &r_version, +- sizeof (r_version)) != 0 +- || r_version != 1) ++ int r_version = 0; ++ ++ if (priv->r_debug == 0) ++ priv->r_debug = get_r_debug (pid, is_elf64); ++ ++ /* We failed to find DT_DEBUG. Such situation will not change ++ for this inferior - do not retry it. Report it to GDB as ++ E01, see for the reasons at the GDB solib-svr4.c side. */ ++ if (priv->r_debug == (CORE_ADDR) -1) ++ return -1; ++ ++ if (priv->r_debug != 0) + { +- warning ("unexpected r_debug version %d", r_version); +- goto done; ++ if (linux_read_memory (priv->r_debug + lmo->r_version_offset, ++ (unsigned char *) &r_version, ++ sizeof (r_version)) != 0 ++ || r_version != 1) ++ { ++ warning ("unexpected r_debug version %d", r_version); ++ } ++ else if (read_one_ptr (priv->r_debug + lmo->r_map_offset, ++ &lm_addr, ptr_size) != 0) ++ { ++ warning ("unable to read r_map from 0x%lx", ++ (long) priv->r_debug + lmo->r_map_offset); ++ } + } ++ } ++ ++ document = xmalloc (allocated); ++ strcpy (document, "l_name_offset, ++ &l_name, ptr_size) == 0 ++ && read_one_ptr (lm_addr + lmo->l_addr_offset, ++ &l_addr, ptr_size) == 0 ++ && read_one_ptr (lm_addr + lmo->l_ld_offset, ++ &l_ld, ptr_size) == 0 ++ && read_one_ptr (lm_addr + lmo->l_prev_offset, ++ &l_prev, ptr_size) == 0 ++ && read_one_ptr (lm_addr + lmo->l_next_offset, ++ &l_next, ptr_size) == 0) ++ { ++ unsigned char libname[PATH_MAX]; + +- if (read_one_ptr (priv->r_debug + lmo->r_map_offset, +- &lm_addr, ptr_size) != 0) ++ if (lm_prev != l_prev) + { +- warning ("unable to read r_map from 0x%lx", +- (long) priv->r_debug + lmo->r_map_offset); +- goto done; ++ warning ("Corrupted shared library list: 0x%lx != 0x%lx", ++ (long) lm_prev, (long) l_prev); ++ break; + } + +- lm_prev = 0; +- while (read_one_ptr (lm_addr + lmo->l_name_offset, +- &l_name, ptr_size) == 0 +- && read_one_ptr (lm_addr + lmo->l_addr_offset, +- &l_addr, ptr_size) == 0 +- && read_one_ptr (lm_addr + lmo->l_ld_offset, +- &l_ld, ptr_size) == 0 +- && read_one_ptr (lm_addr + lmo->l_prev_offset, +- &l_prev, ptr_size) == 0 +- && read_one_ptr (lm_addr + lmo->l_next_offset, +- &l_next, ptr_size) == 0) ++ /* Not checking for error because reading may stop before ++ we've got PATH_MAX worth of characters. */ ++ libname[0] = '\0'; ++ linux_read_memory (l_name, libname, sizeof (libname) - 1); ++ libname[sizeof (libname) - 1] = '\0'; ++ if (libname[0] != '\0') + { +- unsigned char libname[PATH_MAX]; ++ /* 6x the size for xml_escape_text below. */ ++ size_t len = 6 * strlen ((char *) libname); ++ char *name; + +- if (lm_prev != l_prev) ++ if (!header_done) + { +- warning ("Corrupted shared library list: 0x%lx != 0x%lx", +- (long) lm_prev, (long) l_prev); +- break; ++ /* Terminate `", +- name, (unsigned long) lm_addr, +- (unsigned long) l_addr, (unsigned long) l_ld); +- free (name); +- } +- else if (lm_prev == 0) +- { +- sprintf (p, " main-lm=\"0x%lx\"", (unsigned long) lm_addr); +- p = p + strlen (p); +- } ++ /* Expand to guarantee sufficient storage. */ ++ uintptr_t document_len = p - document; + +- if (l_next == 0) +- break; ++ document = xrealloc (document, 2 * allocated); ++ allocated *= 2; ++ p = document + document_len; ++ } + +- lm_prev = lm_addr; +- lm_addr = l_next; ++ name = xml_escape_text ((char *) libname); ++ p += sprintf (p, "", ++ name, (unsigned long) lm_addr, ++ (unsigned long) l_addr, (unsigned long) l_ld); ++ free (name); + } +- done: +- if (!header_done) ++ else if (lm_prev == 0) + { +- /* Empty list; terminate `"); ++ sprintf (p, " main-lm=\"0x%lx\"", (unsigned long) lm_addr); ++ p = p + strlen (p); + } +- else +- strcpy (p, ""); ++ ++ lm_prev = lm_addr; ++ lm_addr = l_next; + } + ++ if (!header_done) ++ { ++ /* Empty list; terminate `"); ++ } ++ else ++ strcpy (p, ""); ++ + document_len = strlen (document); + if (offset < document_len) + document_len -= offset; +--- src/gdb/gdbserver/server.c 2013/05/24 11:28:06 1.191 ++++ src/gdb/gdbserver/server.c 2013/06/04 12:59:21 1.192 +@@ -1115,8 +1115,7 @@ + if (writebuf != NULL) + return -2; + +- if (annex[0] != '\0' || !target_running () +- || the_target->qxfer_libraries_svr4 == NULL) ++ if (!target_running () || the_target->qxfer_libraries_svr4 == NULL) + return -1; + + return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, offset, len); +@@ -1743,7 +1742,8 @@ + PBUFSIZ - 1); + + if (the_target->qxfer_libraries_svr4 != NULL) +- strcat (own_buf, ";qXfer:libraries-svr4:read+"); ++ strcat (own_buf, ";qXfer:libraries-svr4:read+" ++ ";augmented-libraries-svr4-read+"); + else + { + /* We do not have any hook to indicate whether the non-SVR4 target diff --git a/SOURCES/gdb-dlopen-stap-probe-4of9.patch b/SOURCES/gdb-dlopen-stap-probe-4of9.patch new file mode 100644 index 0000000..859c581 --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-4of9.patch @@ -0,0 +1,35 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00015.html + +### src/gdb/ChangeLog 2013/06/04 12:53:33 1.15682 +### src/gdb/ChangeLog 2013/06/04 13:02:15 1.15683 +## -1,5 +1,9 @@ + 2013-06-04 Gary Benson + ++ * NEWS: Update. ++ ++2013-06-04 Gary Benson ++ + * objfiles.h (inhibit_section_map_updates): New function + declaration. + (resume_section_map_updates): Likewise. +Index: gdb-7.6/gdb/NEWS +=================================================================== +--- gdb-7.6.orig/gdb/NEWS 2013-06-10 14:27:02.071184153 +0200 ++++ gdb-7.6/gdb/NEWS 2013-06-10 14:28:34.391145339 +0200 +@@ -4,6 +4,16 @@ + * Newly installed $prefix/bin/gcore acts as a shell interface for the + GDB command gcore. + ++* New remote packets ++ ++qXfer:libraries-svr4:read's annex ++ The previously unused annex of the qXfer:libraries-svr4:read packet ++ is now used to support passing an argument list. The remote stub ++ reports support for this argument list to GDB's qSupported query. ++ The defined arguments are "start" and "prev", used to reduce work ++ necessary for library list updating, resulting in significant ++ speedup. ++ + *** Changes in GDB 7.6 + + * Target record has been renamed to record-full. diff --git a/SOURCES/gdb-dlopen-stap-probe-5of9.patch b/SOURCES/gdb-dlopen-stap-probe-5of9.patch new file mode 100644 index 0000000..aab598f --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-5of9.patch @@ -0,0 +1,91 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00016.html + +### src/gdb/doc/ChangeLog 2013/05/24 04:50:26 1.1463 +### src/gdb/doc/ChangeLog 2013/06/04 13:07:45 1.1464 +## -1,3 +1,12 @@ ++2013-06-04 Gary Benson ++ ++ * gdb.texinfo (General Query Packets/qSupported): Added ++ "qXfer:libraries-svr4:read" and "augmented-libraries-svr4-read". ++ to the table of currently defined stub features. ++ Added a more detailed entry for "augmented-libraries-svr4-read". ++ (General Query Packets/qXfer:libraries-svr4:read): Documented ++ the augmented form of this packet. ++ + 2013-05-23 Joel Brobecker + + * gdb.texinfo (System-wide Configuration Scripts): Renames +--- src/gdb/doc/gdb.texinfo 2013/05/24 04:50:26 1.1093 ++++ src/gdb/doc/gdb.texinfo 2013/06/04 13:07:45 1.1094 +@@ -38594,6 +38594,16 @@ + @tab @samp{-} + @tab Yes + ++@item @samp{qXfer:libraries-svr4:read} ++@tab No ++@tab @samp{-} ++@tab Yes ++ ++@item @samp{augmented-libraries-svr4-read} ++@tab No ++@tab @samp{-} ++@tab No ++ + @item @samp{qXfer:memory-map:read} + @tab No + @tab @samp{-} +@@ -38770,6 +38780,11 @@ + The remote stub understands the @samp{qXfer:libraries-svr4:read} packet + (@pxref{qXfer svr4 library list read}). + ++@item augmented-libraries-svr4-read ++The remote stub understands the augmented form of the ++@samp{qXfer:libraries-svr4:read} packet ++(@pxref{qXfer svr4 library list read}). ++ + @item qXfer:memory-map:read + The remote stub understands the @samp{qXfer:memory-map:read} packet + (@pxref{qXfer memory map read}). +@@ -39065,7 +39080,10 @@ + @anchor{qXfer svr4 library list read} + Access the target's list of loaded libraries when the target is an SVR4 + platform. @xref{Library List Format for SVR4 Targets}. The annex part +-of the generic @samp{qXfer} packet must be empty (@pxref{qXfer read}). ++of the generic @samp{qXfer} packet must be empty unless the remote ++stub indicated it supports the augmented form of this packet ++by supplying an appropriate @samp{qSupported} response ++(@pxref{qXfer read}, @ref{qSupported}). + + This packet is optional for better performance on SVR4 targets. + @value{GDBN} uses memory read packets to read the SVR4 library list otherwise. +@@ -39073,6 +39091,30 @@ + This packet is not probed by default; the remote stub must request it, + by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}). + ++If the remote stub indicates it supports the augmented form of this ++packet then the annex part of the generic @samp{qXfer} packet may ++contain a semicolon-separated list of @samp{@var{name}=@var{value}} ++arguments. The currently supported arguments are: ++ ++@table @code ++@item start=@var{address} ++A hexadecimal number specifying the address of the @samp{struct ++link_map} to start reading the library list from. If unset or zero ++then the first @samp{struct link_map} in the library list will be ++chosen as the starting point. ++ ++@item prev=@var{address} ++A hexadecimal number specifying the address of the @samp{struct ++link_map} immediately preceding the @samp{struct link_map} ++specified by the @samp{start} argument. If unset or zero then ++the remote stub will expect that no @samp{struct link_map} ++exists prior to the starting point. ++ ++@end table ++ ++Arguments that are not understood by the remote stub will be silently ++ignored. ++ + @item qXfer:memory-map:read::@var{offset},@var{length} + @anchor{qXfer memory map read} + Access the target's @dfn{memory-map}. @xref{Memory Map Format}. The diff --git a/SOURCES/gdb-dlopen-stap-probe-6of9.patch b/SOURCES/gdb-dlopen-stap-probe-6of9.patch new file mode 100644 index 0000000..1a1c338 --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-6of9.patch @@ -0,0 +1,132 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00017.html + +### src/gdb/ChangeLog 2013/06/04 13:02:15 1.15683 +### src/gdb/ChangeLog 2013/06/04 13:10:53 1.15684 +## -1,5 +1,21 @@ + 2013-06-04 Gary Benson + ++ * target.h (target_ops): New field ++ "to_augmented_libraries_svr4_read". ++ (target_augmented_libraries_svr4_read): New macro. ++ * target.c (update_current_target): Handle ++ to_augmented_libraries_svr4_read. ++ * remote.c (remote_state): New field ++ "augmented_libraries_svr4_read". ++ (remote_augmented_libraries_svr4_read_feature): New function. ++ (remote_protocol_features): Add entry for ++ "augmented-libraries-svr4-read". ++ (remote_augmented_libraries_svr4_read): New function. ++ (init_remote_ops): Initialize ++ remote_ops.to_augmented_libraries_svr4_read. ++ ++2013-06-04 Gary Benson ++ + * NEWS: Update. + + 2013-06-04 Gary Benson +--- src/gdb/remote.c 2013/05/30 09:29:18 1.552 ++++ src/gdb/remote.c 2013/06/04 13:10:53 1.553 +@@ -361,6 +361,10 @@ + /* True if the stub can collect strings using tracenz bytecode. */ + int string_tracing; + ++ /* True if the stub supports qXfer:libraries-svr4:read with a ++ non-empty annex. */ ++ int augmented_libraries_svr4_read; ++ + /* Nonzero if the user has pressed Ctrl-C, but the target hasn't + responded to that. */ + int ctrlc_pending_p; +@@ -3949,6 +3953,16 @@ + rs->string_tracing = (support == PACKET_ENABLE); + } + ++static void ++remote_augmented_libraries_svr4_read_feature ++ (const struct protocol_feature *feature, ++ enum packet_support support, const char *value) ++{ ++ struct remote_state *rs = get_remote_state (); ++ ++ rs->augmented_libraries_svr4_read = (support == PACKET_ENABLE); ++} ++ + static struct protocol_feature remote_protocol_features[] = { + { "PacketSize", PACKET_DISABLE, remote_packet_size, -1 }, + { "qXfer:auxv:read", PACKET_DISABLE, remote_supported_packet, +@@ -3959,6 +3973,8 @@ + PACKET_qXfer_libraries }, + { "qXfer:libraries-svr4:read", PACKET_DISABLE, remote_supported_packet, + PACKET_qXfer_libraries_svr4 }, ++ { "augmented-libraries-svr4-read", PACKET_DISABLE, ++ remote_augmented_libraries_svr4_read_feature, -1 }, + { "qXfer:memory-map:read", PACKET_DISABLE, remote_supported_packet, + PACKET_qXfer_memory_map }, + { "qXfer:spu:read", PACKET_DISABLE, remote_supported_packet, +@@ -11439,6 +11455,14 @@ + return btrace; + } + ++static int ++remote_augmented_libraries_svr4_read (void) ++{ ++ struct remote_state *rs = get_remote_state (); ++ ++ return rs->augmented_libraries_svr4_read; ++} ++ + static void + init_remote_ops (void) + { +@@ -11561,6 +11585,8 @@ + remote_ops.to_disable_btrace = remote_disable_btrace; + remote_ops.to_teardown_btrace = remote_teardown_btrace; + remote_ops.to_read_btrace = remote_read_btrace; ++ remote_ops.to_augmented_libraries_svr4_read = ++ remote_augmented_libraries_svr4_read; + } + + /* Set up the extended remote vector by making a copy of the standard +--- src/gdb/target.c 2013/05/14 20:33:36 1.335 ++++ src/gdb/target.c 2013/06/04 13:10:53 1.336 +@@ -731,6 +731,7 @@ + INHERIT (to_traceframe_info, t); + INHERIT (to_use_agent, t); + INHERIT (to_can_use_agent, t); ++ INHERIT (to_augmented_libraries_svr4_read, t); + INHERIT (to_magic, t); + INHERIT (to_supports_evaluation_of_breakpoint_conditions, t); + INHERIT (to_can_run_breakpoint_commands, t); +@@ -975,6 +976,9 @@ + de_fault (to_can_use_agent, + (int (*) (void)) + return_zero); ++ de_fault (to_augmented_libraries_svr4_read, ++ (int (*) (void)) ++ return_zero); + de_fault (to_execution_direction, default_execution_direction); + + #undef de_fault +--- src/gdb/target.h 2013/05/14 20:33:36 1.262 ++++ src/gdb/target.h 2013/06/04 13:10:53 1.263 +@@ -941,6 +941,10 @@ + (inclusive) to function END (exclusive). */ + void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags); + ++ /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a ++ non-empty annex. */ ++ int (*to_augmented_libraries_svr4_read) (void); ++ + int to_magic; + /* Need sub-structure for target machine related rather than comm related? + */ +@@ -1809,6 +1813,9 @@ + #define target_can_use_agent() \ + (*current_target.to_can_use_agent) () + ++#define target_augmented_libraries_svr4_read() \ ++ (*current_target.to_augmented_libraries_svr4_read) () ++ + /* Command logging facility. */ + + #define target_log_command(p) \ diff --git a/SOURCES/gdb-dlopen-stap-probe-7of9.patch b/SOURCES/gdb-dlopen-stap-probe-7of9.patch new file mode 100644 index 0000000..9cd5f56 --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-7of9.patch @@ -0,0 +1,1107 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00018.html + +### src/gdb/ChangeLog 2013/06/04 13:10:53 1.15684 +### src/gdb/ChangeLog 2013/06/04 13:17:05 1.15685 +## -1,5 +1,58 @@ + 2013-06-04 Gary Benson + ++ * breakpoint.h (handle_solib_event): Moved function declaration ++ to solib.h. ++ * breakpoint.c (handle_solib_event): Moved function to solib.c. ++ (bpstat_stop_status): Pass new argument to handle_solib_event. ++ * solib.h (update_solib_breakpoints): New function declaration. ++ (handle_solib_event): Moved function declaration from ++ breakpoint.h. ++ * solib.c (update_solib_breakpoints): New function. ++ (handle_solib_event): Moved function from breakpoint.c. ++ Updated to call solib_ops->handle_event if not NULL. ++ * solist.h (target_so_ops): New fields "update_breakpoints" and ++ "handle_event". ++ * 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. ++ (svr4_free_library_list): New forward declaration. ++ (probe_action): New enum. ++ (probe_info): New struct. ++ (probe_info): New static variable. ++ (NUM_PROBES): New definition. ++ (svr4_info): New fields "using_xfer", "probes_table" and ++ "solib_list". ++ (free_probes_table): New function. ++ (free_solib_list): New function. ++ (svr4_pspace_data_cleanup): Free probes table and solib list. ++ (svr4_copy_library_list): New function. ++ (svr4_current_sos_via_xfer_libraries): New parameter "annex". ++ (svr4_read_so_list): New parameter "prev_lm". ++ (svr4_current_sos_direct): Renamed from "svr4_current_sos". ++ (svr4_current_sos): New function. ++ (probe_and_action): New struct. ++ (hash_probe_and_action): New function. ++ (equal_probe_and_action): Likewise. ++ (register_solib_event_probe): Likewise. ++ (solib_event_probe_at): Likewise. ++ (solib_event_probe_action): Likewise. ++ (solist_update_full): Likewise. ++ (solist_update_incremental): Likewise. ++ (disable_probes_interface_cleanup): Likewise. ++ (svr4_handle_solib_event): Likewise. ++ (svr4_update_solib_event_breakpoint): Likewise. ++ (svr4_update_solib_event_breakpoints): Likewise. ++ (svr4_create_solib_event_breakpoints): Likewise. ++ (enable_break): Free probes table before creating breakpoints. ++ Use svr4_create_solib_event_breakpoints to create breakpoints. ++ (svr4_solib_create_inferior_hook): Free the solib list. ++ (_initialize_svr4_solib): Initialise ++ svr4_so_ops.handle_solib_event and svr4_so_ops.update_breakpoints. ++ ++2013-06-04 Gary Benson ++ + * target.h (target_ops): New field + "to_augmented_libraries_svr4_read". + (target_augmented_libraries_svr4_read): New macro. +Index: gdb-7.6/gdb/breakpoint.h +=================================================================== +--- gdb-7.6.orig/gdb/breakpoint.h 2013-06-10 14:44:37.455812656 +0200 ++++ gdb-7.6/gdb/breakpoint.h 2013-06-10 14:44:37.709812579 +0200 +@@ -1552,8 +1552,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 breakpoint_free_objfile (struct objfile *objfile); + + extern void breakpoints_relocate (struct objfile *objfile, +Index: gdb-7.6/gdb/infrun.c +=================================================================== +--- gdb-7.6.orig/gdb/infrun.c 2013-06-10 14:44:37.427812664 +0200 ++++ gdb-7.6/gdb/infrun.c 2013-06-10 14:44:37.711812579 +0200 +@@ -370,6 +370,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) +@@ -7335,7 +7345,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.6/gdb/solib-svr4.c +=================================================================== +--- gdb-7.6.orig/gdb/solib-svr4.c 2013-06-10 14:44:37.392812675 +0200 ++++ gdb-7.6/gdb/solib-svr4.c 2013-06-10 14:44:37.712812578 +0200 +@@ -46,10 +46,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 void svr4_free_library_list (void *p_list); + + /* Link map info to include in an allocated so_list entry. */ + +@@ -106,6 +108,55 @@ static const char * const main_name_lis + NULL + }; + ++/* What to do when a probe stop occurs. */ ++ ++enum probe_action ++{ ++ /* Something went seriously wrong. Stop using probes and ++ revert to using the older interface. */ ++ PROBES_INTERFACE_FAILED, ++ ++ /* No action is required. The shared object list is still ++ valid. */ ++ DO_NOTHING, ++ ++ /* The shared object list should be reloaded entirely. */ ++ FULL_RELOAD, ++ ++ /* Attempt to incrementally update the shared object list. If ++ the update fails or is not possible, fall back to reloading ++ the list in full. */ ++ 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 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", DO_NOTHING }, ++ { "init_complete", FULL_RELOAD }, ++ { "map_start", DO_NOTHING }, ++ { "map_failed", DO_NOTHING }, ++ { "reloc_complete", UPDATE_OR_RELOAD }, ++ { "unmap_start", DO_NOTHING }, ++ { "unmap_complete", FULL_RELOAD }, ++}; ++ ++#define NUM_PROBES ARRAY_SIZE (probe_info) ++ + /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent + the same shared library. */ + +@@ -313,17 +364,58 @@ struct svr4_info + CORE_ADDR interp_text_sect_high; + CORE_ADDR interp_plt_sect_low; + CORE_ADDR interp_plt_sect_high; ++ ++ /* Nonzero if the list of objects was last obtained from the target ++ via qXfer:libraries-svr4:read. */ ++ int using_xfer; ++ ++ /* Table of struct probe_and_action instances, used by the ++ probes-based interface to map breakpoint addresses to probes ++ and their associated actions. Lookup is performed using ++ probe_and_action->probe->address. */ ++ htab_t probes_table; ++ ++ /* List of objects loaded into the inferior, used by the probes- ++ based interface. */ ++ struct so_list *solib_list; + }; + + /* Per-program-space data key. */ + static const struct program_space_data *solib_svr4_pspace_data; + ++/* Free the probes table. */ ++ ++static void ++free_probes_table (struct svr4_info *info) ++{ ++ if (info->probes_table == NULL) ++ return; ++ ++ htab_delete (info->probes_table); ++ info->probes_table = NULL; ++} ++ ++/* Free the solib list. */ ++ ++static void ++free_solib_list (struct svr4_info *info) ++{ ++ svr4_free_library_list (&info->solib_list); ++ info->solib_list = 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_table (info); ++ free_solib_list (info); ++ + xfree (info); + } + +@@ -982,6 +1074,34 @@ svr4_free_library_list (void *p_list) + } + } + ++/* Copy library list. */ ++ ++static struct so_list * ++svr4_copy_library_list (struct so_list *src) ++{ ++ struct so_list *dst = NULL; ++ struct so_list **link = &dst; ++ ++ while (src != NULL) ++ { ++ struct so_list *new; ++ ++ new = xmalloc (sizeof (struct so_list)); ++ memcpy (new, src, sizeof (struct so_list)); ++ ++ new->lm_info = xmalloc (sizeof (struct lm_info)); ++ memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info)); ++ ++ new->next = NULL; ++ *link = new; ++ link = &new->next; ++ ++ src = src->next; ++ } ++ ++ return dst; ++} ++ + #ifdef HAVE_LIBEXPAT + + #include "xml-support.h" +@@ -1097,23 +1217,30 @@ svr4_parse_libraries (const char *docume + return 0; + } + +-/* Attempt to get so_list from target via qXfer:libraries:read packet. ++/* Attempt to get so_list from target via qXfer:libraries-svr4:read packet. + + Return 0 if packet not supported, *SO_LIST_RETURN is not modified in such + case. Return 1 if *SO_LIST_RETURN contains the library list, it may be +- empty, caller is responsible for freeing all its entries. */ ++ empty, caller is responsible for freeing all its entries. ++ ++ Note that ANNEX must be NULL if the remote does not explicitly allow ++ qXfer:libraries-svr4:read packets with non-empty annexes. Support for ++ this can be checked using target_augmented_libraries_svr4_read (). */ + + static int +-svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list) ++svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list, ++ const char *annex) + { + char *svr4_library_document; + int result; + struct cleanup *back_to; + ++ gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ()); ++ + /* Fetch the list of shared libraries. */ + svr4_library_document = target_read_stralloc (¤t_target, + TARGET_OBJECT_LIBRARIES_SVR4, +- NULL); ++ annex); + if (svr4_library_document == NULL) + return 0; + +@@ -1127,7 +1254,8 @@ svr4_current_sos_via_xfer_libraries (str + #else + + static int +-svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list) ++svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list, ++ const char *annex) + { + return 0; + } +@@ -1161,15 +1289,19 @@ 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. If zero is returned the ++ entries stored to LINK_PTR_PTR are still valid although they may ++ represent only part of the inferior library list. */ + +-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) + { +@@ -1185,7 +1317,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; +@@ -1196,7 +1328,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 +@@ -1291,17 +1423,21 @@ 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 full list of currently loaded shared objects directly ++ from the inferior, without referring to any libraries read and ++ stored by the probes interface. Handle special cases relating ++ to the first elements of the list. */ + + static struct so_list * +-svr4_current_sos (void) ++svr4_current_sos_direct (struct svr4_info *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; + struct svr4_library_list library_list; +@@ -1314,19 +1450,16 @@ svr4_current_sos (void) + Unfortunately statically linked inferiors will also fall back through this + suboptimal code path. */ + +- if (svr4_current_sos_via_xfer_libraries (&library_list)) ++ info->using_xfer = svr4_current_sos_via_xfer_libraries (&library_list, ++ NULL); ++ if (info->using_xfer) + { + if (library_list.main_lm) +- { +- info = get_svr4_info (); +- info->main_lm_addr = library_list.main_lm; +- } ++ info->main_lm_addr = library_list.main_lm; + + return library_list.head ? library_list.head : svr4_default_sos (); + } + +- info = get_svr4_info (); +- + /* Always locate the debug struct, in case it has moved. */ + info->debug_base = 0; + locate_base (info); +@@ -1349,7 +1482,7 @@ svr4_current_sos (void) + `struct so_list' nodes. */ + lm = solib_svr4_r_map (info); + if (lm) +- svr4_read_so_list (lm, &link_ptr, ignore_first); ++ 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 +@@ -1357,7 +1490,7 @@ svr4_current_sos (void) + for skipping dynamic linker resolver code. */ + lm = solib_svr4_r_ldsomap (info); + if (lm) +- svr4_read_so_list (lm, &link_ptr, 0); ++ svr4_read_so_list (lm, 0, &link_ptr, 0); + + discard_cleanups (back_to); + +@@ -1367,6 +1500,22 @@ svr4_current_sos (void) + return head; + } + ++/* Implement the "current_sos" target_so_ops method. */ ++ ++static struct so_list * ++svr4_current_sos (void) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ ++ /* If the solib list has been read and stored by the probes ++ interface then we return a copy of the stored list. */ ++ if (info->solib_list != NULL) ++ return svr4_copy_library_list (info->solib_list); ++ ++ /* Otherwise obtain the solib list directly from the inferior. */ ++ return svr4_current_sos_direct (info); ++} ++ + /* Get the address of the link_map for a given OBJFILE. */ + + CORE_ADDR +@@ -1449,6 +1598,476 @@ exec_entry_point (struct bfd *abfd, stru + return gdbarch_addr_bits_remove (target_gdbarch (), addr); + } + ++/* A probe and its associated action. */ ++ ++struct probe_and_action ++{ ++ /* The probe. */ ++ struct probe *probe; ++ ++ /* The action. */ ++ enum probe_action action; ++}; ++ ++/* Returns a hash code for the probe_and_action referenced by p. */ ++ ++static hashval_t ++hash_probe_and_action (const void *p) ++{ ++ const struct probe_and_action *pa = p; ++ ++ return (hashval_t) pa->probe->address; ++} ++ ++/* Returns non-zero if the probe_and_actions referenced by p1 and p2 ++ are equal. */ ++ ++static int ++equal_probe_and_action (const void *p1, const void *p2) ++{ ++ const struct probe_and_action *pa1 = p1; ++ const struct probe_and_action *pa2 = p2; ++ ++ return pa1->probe->address == pa2->probe->address; ++} ++ ++/* Register a solib event probe and its associated action in the ++ probes table. */ ++ ++static void ++register_solib_event_probe (struct probe *probe, enum probe_action action) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ struct probe_and_action lookup, *pa; ++ void **slot; ++ ++ /* Create the probes table, if necessary. */ ++ if (info->probes_table == NULL) ++ info->probes_table = htab_create_alloc (1, hash_probe_and_action, ++ equal_probe_and_action, ++ xfree, xcalloc, xfree); ++ ++ lookup.probe = probe; ++ slot = htab_find_slot (info->probes_table, &lookup, INSERT); ++ gdb_assert (*slot == HTAB_EMPTY_ENTRY); ++ ++ pa = XCNEW (struct probe_and_action); ++ pa->probe = probe; ++ pa->action = action; ++ ++ *slot = pa; ++} ++ ++/* Get the solib event probe at the specified location, and the ++ action associated with it. Returns NULL if no solib event probe ++ was found. */ ++ ++static struct probe_and_action * ++solib_event_probe_at (struct svr4_info *info, CORE_ADDR address) ++{ ++ struct probe lookup_probe; ++ struct probe_and_action lookup; ++ void **slot; ++ ++ lookup_probe.address = address; ++ lookup.probe = &lookup_probe; ++ slot = htab_find_slot (info->probes_table, &lookup, NO_INSERT); ++ ++ if (slot == NULL) ++ return NULL; ++ ++ return (struct probe_and_action *) *slot; ++} ++ ++/* Decide what action to take when the specified solib event probe is ++ hit. */ ++ ++static enum probe_action ++solib_event_probe_action (struct probe_and_action *pa) ++{ ++ enum probe_action action; ++ unsigned probe_argc; ++ ++ action = pa->action; ++ if (action == DO_NOTHING || action == PROBES_INTERFACE_FAILED) ++ return action; ++ ++ gdb_assert (action == FULL_RELOAD || action == 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 (pa->probe); ++ if (probe_argc == 2) ++ action = FULL_RELOAD; ++ else if (probe_argc < 2) ++ action = PROBES_INTERFACE_FAILED; ++ ++ return action; ++} ++ ++/* Populate the shared object list by reading the entire list of ++ shared objects from the inferior. Handle special cases relating ++ to the first elements of the list. Returns nonzero on success. */ ++ ++static int ++solist_update_full (struct svr4_info *info) ++{ ++ free_solib_list (info); ++ info->solib_list = svr4_current_sos_direct (info); ++ ++ return 1; ++} ++ ++/* Update the shared object list 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 ++solist_update_incremental (struct svr4_info *info, CORE_ADDR lm) ++{ ++ struct so_list *tail; ++ CORE_ADDR prev_lm; ++ ++ /* svr4_current_sos_direct contains logic to handle a number of ++ special cases relating to the first elements of the list. To ++ avoid duplicating this logic we defer to solist_update_full ++ if the list is empty. */ ++ if (info->solib_list == NULL) ++ return 0; ++ ++ /* Fall back to a full update if we are using a remote target ++ that does not support incremental transfers. */ ++ if (info->using_xfer && !target_augmented_libraries_svr4_read ()) ++ return 0; ++ ++ /* Walk to the end of the list. */ ++ for (tail = info->solib_list; tail->next != NULL; tail = tail->next) ++ /* Nothing. */; ++ prev_lm = tail->lm_info->lm_addr; ++ ++ /* Read the new objects. */ ++ if (info->using_xfer) ++ { ++ struct svr4_library_list library_list; ++ char annex[64]; ++ ++ xsnprintf (annex, sizeof (annex), "start=%s;prev=%s", ++ phex_nz (lm, sizeof (lm)), ++ phex_nz (prev_lm, sizeof (prev_lm))); ++ if (!svr4_current_sos_via_xfer_libraries (&library_list, annex)) ++ return 0; ++ ++ tail->next = library_list.head; ++ } ++ else ++ { ++ struct so_list **link = &tail->next; ++ ++ /* IGNORE_FIRST may safely be set to zero here because the ++ above check and deferral to solist_update_full ensures ++ that this call to svr4_read_so_list will never see the ++ first element. */ ++ if (!svr4_read_so_list (lm, prev_lm, &link, 0)) ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/* Disable the probes-based linker interface and revert to the ++ original interface. We don't reset the breakpoints as the ++ ones set up for the probes-based interface are adequate. */ ++ ++static void ++disable_probes_interface_cleanup (void *arg) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ ++ warning (_("Probes-based dynamic linker interface failed.\n" ++ "Reverting to original interface.\n")); ++ ++ free_probes_table (info); ++ free_solib_list (info); ++} ++ ++/* Update the solib list as appropriate when using the ++ probes-based linker interface. Do nothing if using the ++ standard interface. */ ++ ++static void ++svr4_handle_solib_event (void) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ struct probe_and_action *pa; ++ enum probe_action action; ++ struct cleanup *old_chain, *usm_chain; ++ struct value *val; ++ CORE_ADDR pc, debug_base, lm = 0; ++ int is_initial_ns; ++ ++ /* Do nothing if not using the probes interface. */ ++ if (info->probes_table == NULL) ++ return; ++ ++ /* If anything goes wrong we revert to the original linker ++ interface. */ ++ old_chain = make_cleanup (disable_probes_interface_cleanup, NULL); ++ ++ pc = regcache_read_pc (get_current_regcache ()); ++ pa = solib_event_probe_at (info, pc); ++ if (pa == NULL) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ ++ action = solib_event_probe_action (pa); ++ if (action == PROBES_INTERFACE_FAILED) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ ++ if (action == DO_NOTHING) ++ { ++ discard_cleanups (old_chain); ++ 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 (current_program_space); ++ usm_chain = make_cleanup (resume_section_map_updates_cleanup, ++ current_program_space); ++ ++ val = evaluate_probe_argument (pa->probe, 1); ++ if (val == NULL) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ ++ debug_base = value_as_address (val); ++ if (debug_base == 0) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ ++ /* Always locate the debug struct, in case it moved. */ ++ info->debug_base = 0; ++ if (locate_base (info) == 0) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ ++ /* GDB does not currently support libraries loaded via dlmopen ++ into namespaces other than the initial one. We must ignore ++ any namespace other than the initial namespace here until ++ support for this is added to GDB. */ ++ if (debug_base != info->debug_base) ++ action = DO_NOTHING; ++ ++ if (action == UPDATE_OR_RELOAD) ++ { ++ val = evaluate_probe_argument (pa->probe, 2); ++ if (val != NULL) ++ lm = value_as_address (val); ++ ++ if (lm == 0) ++ action = FULL_RELOAD; ++ } ++ ++ /* Resume section map updates. */ ++ do_cleanups (usm_chain); ++ ++ if (action == UPDATE_OR_RELOAD) ++ { ++ if (!solist_update_incremental (info, lm)) ++ action = FULL_RELOAD; ++ } ++ ++ if (action == FULL_RELOAD) ++ { ++ if (!solist_update_full (info)) ++ { ++ do_cleanups (old_chain); ++ return; ++ } ++ } ++ ++ discard_cleanups (old_chain); ++} ++ ++/* Helper function for svr4_update_solib_event_breakpoints. */ ++ ++static int ++svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg) ++{ ++ struct bp_location *loc; ++ ++ if (b->type != bp_shlib_event) ++ { ++ /* Continue iterating. */ ++ return 0; ++ } ++ ++ for (loc = b->loc; loc != NULL; loc = loc->next) ++ { ++ struct svr4_info *info; ++ struct probe_and_action *pa; ++ ++ info = program_space_data (loc->pspace, solib_svr4_pspace_data); ++ if (info == NULL || info->probes_table == NULL) ++ continue; ++ ++ pa = solib_event_probe_at (info, loc->address); ++ if (pa == NULL) ++ continue; ++ ++ if (pa->action == DO_NOTHING) ++ { ++ if (b->enable_state == bp_disabled && stop_on_solib_events) ++ enable_breakpoint (b); ++ else if (b->enable_state == bp_enabled && !stop_on_solib_events) ++ disable_breakpoint (b); ++ } ++ ++ break; ++ } ++ ++ /* Continue iterating. */ ++ return 0; ++} ++ ++/* 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) ++{ ++ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL); ++} ++ ++/* Create and register solib event breakpoints. PROBES is an array ++ of NUM_PROBES elements, each of which is vector of probes. A ++ solib event breakpoint will be created and registered for each ++ probe. */ ++ ++static void ++svr4_create_probe_breakpoints (struct gdbarch *gdbarch, ++ VEC (probe_p) **probes) ++{ ++ int i; ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ { ++ enum probe_action action = probe_info[i].action; ++ struct probe *probe; ++ int ix; ++ ++ for (ix = 0; ++ VEC_iterate (probe_p, probes[i], ix, probe); ++ ++ix) ++ { ++ create_solib_event_breakpoint (gdbarch, probe->address); ++ register_solib_event_probe (probe, action); ++ } ++ } ++ ++ svr4_update_solib_event_breakpoints (); ++} ++ ++/* 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 obj_section *os; ++ ++ os = find_pc_section (address); ++ if (os != NULL) ++ { ++ int with_prefix; ++ ++ for (with_prefix = 0; with_prefix <= 1; with_prefix++) ++ { ++ VEC (probe_p) *probes[NUM_PROBES]; ++ int all_probes_found = 1; ++ int i; ++ ++ memset (probes, 0, sizeof (probes)); ++ for (i = 0; i < NUM_PROBES; i++) ++ { ++ const char *name = probe_info[i].name; ++ char buf[32]; ++ ++ /* Fedora 17 and Red Hat Enterprise Linux 6.2-6.4 ++ shipped with an early version of the probes code in ++ which the probes' names were prefixed with "rtld_" ++ and the "map_failed" probe did not exist. The ++ locations of the probes are otherwise the same, so ++ we check for probes with prefixed names if probes ++ with unprefixed names are not present. */ ++ if (with_prefix) ++ { ++ xsnprintf (buf, sizeof (buf), "rtld_%s", name); ++ name = buf; ++ } ++ ++ probes[i] = find_probes_in_objfile (os->objfile, "rtld", name); ++ ++ /* The "map_failed" probe did not exist in early ++ versions of the probes code in which the probes' ++ names were prefixed with "rtld_". */ ++ if (strcmp (name, "rtld_map_failed") == 0) ++ continue; ++ ++ if (VEC_empty (probe_p, probes[i])) ++ { ++ all_probes_found = 0; ++ break; ++ } ++ } ++ ++ if (all_probes_found) ++ svr4_create_probe_breakpoints (gdbarch, probes); ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ VEC_free (probe_p, probes[i]); ++ ++ if (all_probes_found) ++ return; ++ } ++ } ++ ++ create_solib_event_breakpoint (gdbarch, address); ++} ++ + /* Helper function for gdb_bfd_lookup_symbol. */ + + static int +@@ -1532,7 +2151,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 +@@ -1570,7 +2189,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; + } + } +@@ -1728,7 +2347,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; + } +@@ -1754,7 +2374,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; + } + } +@@ -1770,7 +2390,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; + } + } +@@ -2266,6 +2886,10 @@ svr4_solib_create_inferior_hook (int fro + + info = get_svr4_info (); + ++ /* Clear the probes-based interface's state. */ ++ free_probes_table (info); ++ free_solib_list (info); ++ + /* Relocate the main executable if necessary. */ + svr4_relocate_main_executable (); + +@@ -2507,4 +3131,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.update_breakpoints = svr4_update_solib_event_breakpoints; ++ svr4_so_ops.handle_event = svr4_handle_solib_event; + } +Index: gdb-7.6/gdb/solib.c +=================================================================== +--- gdb-7.6.orig/gdb/solib.c 2013-06-10 14:44:37.392812675 +0200 ++++ gdb-7.6/gdb/solib.c 2013-06-10 14:44:37.713812578 +0200 +@@ -1221,6 +1221,37 @@ no_shared_libraries (char *ignored, int + objfile_purge_solibs (); + } + ++/* See solib.h. */ ++ ++void ++update_solib_breakpoints (void) ++{ ++ const struct target_so_ops *ops = solib_ops (target_gdbarch ()); ++ ++ if (ops->update_breakpoints != NULL) ++ ops->update_breakpoints (); ++} ++ ++/* See solib.h. */ ++ ++void ++handle_solib_event (void) ++{ ++ const struct target_so_ops *ops = solib_ops (target_gdbarch ()); ++ ++ if (ops->handle_event != NULL) ++ ops->handle_event (); ++ ++ 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 (); ++ solib_add (NULL, 0, ¤t_target, auto_solib_add); ++ target_terminal_inferior (); ++} ++ + /* Reload shared libraries, but avoid reloading the same symbol file + we already have loaded. */ + +Index: gdb-7.6/gdb/solib.h +=================================================================== +--- gdb-7.6.orig/gdb/solib.h 2013-01-01 07:32:51.000000000 +0100 ++++ gdb-7.6/gdb/solib.h 2013-06-10 14:44:37.713812578 +0200 +@@ -90,4 +90,12 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f + void *), + void *data); + ++/* Enable or disable optional solib event breakpoints as appropriate. */ ++ ++extern void update_solib_breakpoints (void); ++ ++/* Handle an solib event by calling solib_add. */ ++ ++extern void handle_solib_event (void); ++ + #endif /* SOLIB_H */ +Index: gdb-7.6/gdb/solist.h +=================================================================== +--- gdb-7.6.orig/gdb/solist.h 2013-01-01 07:32:51.000000000 +0100 ++++ gdb-7.6/gdb/solist.h 2013-06-10 14:44:37.713812578 +0200 +@@ -148,6 +148,19 @@ struct target_so_ops + core file (in particular, for readonly sections). */ + int (*keep_data_in_core) (CORE_ADDR vaddr, + unsigned long size); ++ ++ /* 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); ++ ++ /* Target-specific processing of solib events that will be ++ performed before solib_add is called. This pointer can be ++ NULL, in which case no specific preprocessing is necessary ++ for this target. */ ++ void (*handle_event) (void); + }; + + /* Free the memory associated with a (so_list *). */ +Index: gdb-7.6/gdb/breakpoint.c +=================================================================== +--- gdb-7.6.orig/gdb/breakpoint.c 2013-06-10 14:44:37.500812642 +0200 ++++ gdb-7.6/gdb/breakpoint.c 2013-06-10 14:44:57.301806708 +0200 +@@ -5348,25 +5348,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. */ diff --git a/SOURCES/gdb-dlopen-stap-probe-8of9.patch b/SOURCES/gdb-dlopen-stap-probe-8of9.patch new file mode 100644 index 0000000..3b6638a --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-8of9.patch @@ -0,0 +1,462 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00019.html + +### src/gdb/testsuite/ChangeLog 2013/05/30 00:25:16 1.3682 +### src/gdb/testsuite/ChangeLog 2013/06/04 13:23:31 1.3683 +## -1,3 +1,19 @@ ++2013-06-04 Jan Kratochvil ++ Gary Benson ++ ++ * lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthread, ++ gdb_compile_shlib or gdb_compile_shlib_pthreads where appropriate. ++ * lib/prelink-support.exp (build_executable_own_libs): Allow INTERP ++ to be set to "no" to indicate that no ld.so copy should be made. ++ * 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.threads/dlopen-libpthread.exp: New file. ++ * gdb.threads/dlopen-libpthread.c: Likewise. ++ * gdb.threads/dlopen-libpthread-lib.c: Likewise. ++ * gdb.base/solib-corrupted.exp: Disable test if GDB is using probes. ++ + 2013-05-30 Yao Qi + + * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): +Index: gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/gdb.base/break-interp.exp 2013-06-10 14:29:24.815123941 +0200 ++++ gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp 2013-06-10 14:30:18.086102375 +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.6/gdb/testsuite/gdb.base/solib-corrupted.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-06-10 14:29:24.816123941 +0200 ++++ gdb-7.6/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-06-10 14:30:18.086102375 +0200 +@@ -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. +Index: gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2013-06-10 14:30:18.086102375 +0200 +@@ -0,0 +1,40 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2011-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2013-06-10 14:30:18.087102375 +0200 +@@ -0,0 +1,46 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2011-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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.6/gdb/testsuite/gdb.threads/dlopen-libpthread.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2013-06-10 14:30:18.087102375 +0200 +@@ -0,0 +1,74 @@ ++# Copyright 2011-2013 Free Software Foundation, Inc. ++# ++# This program is free software; you can 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.6/gdb/testsuite/lib/gdb.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-06-10 14:29:24.819123940 +0200 ++++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-06-10 14:30:44.654092140 +0200 +@@ -4011,22 +4011,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++" +@@ -4034,6 +4018,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.6/gdb/testsuite/lib/prelink-support.exp +=================================================================== +--- gdb-7.6.orig/gdb/testsuite/lib/prelink-support.exp 2013-06-10 14:29:24.819123940 +0200 ++++ gdb-7.6/gdb/testsuite/lib/prelink-support.exp 2013-06-10 14:30:18.089102374 +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/SOURCES/gdb-dlopen-stap-probe-9of9.patch b/SOURCES/gdb-dlopen-stap-probe-9of9.patch new file mode 100644 index 0000000..c2bb897 --- /dev/null +++ b/SOURCES/gdb-dlopen-stap-probe-9of9.patch @@ -0,0 +1,415 @@ +http://sourceware.org/ml/gdb-cvs/2013-06/msg00020.html + +### src/gdb/testsuite/ChangeLog 2013/06/04 13:23:31 1.3683 +### src/gdb/testsuite/ChangeLog 2013/06/04 13:31:00 1.3684 +## -1,3 +1,13 @@ ++2013-06-04 Gary Benson ++ ++ * 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. ++ + 2013-06-04 Jan Kratochvil + Gary Benson + +--- src/gdb/testsuite/gdb.base/break-probes-solib.c ++++ src/gdb/testsuite/gdb.base/break-probes-solib.c 2013-06-10 12:15:11.548935413 +0000 +@@ -0,0 +1,22 @@ ++/* Copyright 2012-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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) ++{ ++ return n * n / 17; ++} +--- src/gdb/testsuite/gdb.base/break-probes.c ++++ src/gdb/testsuite/gdb.base/break-probes.c 2013-06-10 12:15:12.047717383 +0000 +@@ -0,0 +1,30 @@ ++/* Copyright 2012-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 ++ ++int ++main (void) ++{ ++ void *handle = dlopen (SHLIB_NAME, RTLD_LAZY); ++ ++ assert (handle != NULL); ++ ++ dlclose (handle); ++ ++ return 0; ++} +--- src/gdb/testsuite/gdb.base/break-probes.exp ++++ src/gdb/testsuite/gdb.base/break-probes.exp 2013-06-10 12:15:12.620368040 +0000 +@@ -0,0 +1,78 @@ ++# Copyright 2012-2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 ++} ++ ++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" ++ ++# Start the inferior and run to the first stop ++gdb_run_cmd ++gdb_test "" ".*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 $" { ++ untested "probes not present on this system" ++ } ++ -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 not_loaded_library 1 ++ while { $not_loaded_library } { ++ set not_loaded_library 0 ++ gdb_test_multiple "c" $test { ++ -re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" { ++ pass $test ++ } ++ -re "Stopped due to shared library event\\M.*$gdb_prompt $" { ++ set not_loaded_library 1 ++ } ++ } ++ } ++ ++ # Call something to ensure that relocation occurred ++ gdb_test "call foo(23)" "\\\$.* = 31.*\\\M.*" ++} +--- src/gdb/testsuite/gdb.base/info-shared-solib1.c ++++ src/gdb/testsuite/gdb.base/info-shared-solib1.c 2013-06-10 12:15:14.399129288 +0000 +@@ -0,0 +1,24 @@ ++/* Copyright 2012-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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; ++} +--- src/gdb/testsuite/gdb.base/info-shared-solib2.c ++++ src/gdb/testsuite/gdb.base/info-shared-solib2.c 2013-06-10 12:15:14.930135742 +0000 +@@ -0,0 +1,24 @@ ++/* Copyright 2012-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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; ++} +--- src/gdb/testsuite/gdb.base/info-shared.c ++++ src/gdb/testsuite/gdb.base/info-shared.c 2013-06-10 12:15:15.395474819 +0000 +@@ -0,0 +1,52 @@ ++/* Copyright 2012-2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 ++stop (void) ++{ ++} ++ ++int ++main (void) ++{ ++ void *handle1, *handle2; ++ void (*func)(int); ++ ++ handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY); ++ assert (handle1 != NULL); ++ stop (); ++ ++ handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY); ++ assert (handle2 != NULL); ++ 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; ++} +--- src/gdb/testsuite/gdb.base/info-shared.exp ++++ src/gdb/testsuite/gdb.base/info-shared.exp 2013-06-10 12:15:15.891450285 +0000 +@@ -0,0 +1,146 @@ ++# Copyright 2012-2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 ++} ++ ++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 ++ } ++ } ++ } ++} ++ ++# Start the inferior, and check neither of the libraries are loaded at ++# the start. ++if ![runto_main] { ++ return 0 ++} ++check_info_shared "info sharedlibrary #1" 0 0 ++ ++# Set up breakpoints. ++gdb_breakpoint "stop" ++gdb_breakpoint "foo" allow-pending ++gdb_breakpoint "bar" allow-pending ++ ++# Run to the first stop and check that only the first library is loaded. ++gdb_continue_to_breakpoint "library load #1" "stop .*" ++check_info_shared "info sharedlibrary #2" 1 0 ++ ++# Run to the second stop and check that both libraries are loaded. ++gdb_continue_to_breakpoint "library load #2" "stop .*" ++check_info_shared "info sharedlibrary #3" 1 1 ++ ++# Check that the next stop is in foo. ++gdb_continue_to_breakpoint "library function #1" "foo .*" ++ ++# Check that the next stop is in bar. ++gdb_continue_to_breakpoint "library function #2" "bar .*" ++ ++# 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_run_cmd ++gdb_test_multiple "" $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 ++ } ++} ++ ++# Check that neither library is loaded. ++check_info_shared "info sharedlibrary #4" 0 0 ++ ++# Run to the first stop and check that only the first library is loaded. ++gdb_continue_to_breakpoint "library load #3" "stop .*" ++check_info_shared "info sharedlibrary #5" 1 0 ++ ++# Run to the second stop and check that both libraries are loaded. ++gdb_continue_to_breakpoint "library load #4" "stop .*" ++check_info_shared "info sharedlibrary #6" 1 1 ++ ++# Check that the next stop is in foo. ++gdb_continue_to_breakpoint "library function #3" "foo .*" ++ ++# Check that the next stop is in bar. ++gdb_continue_to_breakpoint "library function #4" "bar .*" ++ ++# Run to the next stop and check that the first library has been unloaded. ++gdb_continue_to_breakpoint "library unload #1" "stop .*" ++check_info_shared "info sharedlibrary #7" 0 1 ++ ++# Run to the last stop and check that both libraries are gone. ++gdb_continue_to_breakpoint "library unload #2" "stop .*" ++check_info_shared "info sharedlibrary #8" 0 0 diff --git a/SOURCES/gdb-enable-count-crash.patch b/SOURCES/gdb-enable-count-crash.patch new file mode 100644 index 0000000..9461ee9 --- /dev/null +++ b/SOURCES/gdb-enable-count-crash.patch @@ -0,0 +1,86 @@ +http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html +Subject: [PATCH] "enable count" user input error handling (PR gdb/15678) + +Typing "enable count" by itself crashes GDB. Also, if you omit the +breakpoint number/range, the error message is not very clear: + +(gdb) enable count 2 +warning: bad breakpoint number at or near '' +(gdb) enable count +Segmentation fault (core dumped) + +With this patch, the error messages are slightly more helpful: + +(gdb) enable count 2 +Argument required (one or more breakpoint numbers). +(gdb) enable count +Argument required (hit count). + +They are not as helpful to the user as I would like, but it's better +than crashing. Suggestions are welcome. + +Simon + +gdb/ChangeLog: +2013-06-26 Simon Marchi + + * breakpoint.c (map_breakpoint_numbers): Check for empty args + string. + (enable_count_command): Check args for NULL value. + +gdb/testsuite/ChangeLog: +2013-06-26 Simon Marchi + + * gdb.base/ena-dis-br.exp: Test "enable count" for bad user input. +--- + gdb/breakpoint.c | 9 +++++++-- + gdb/testsuite/gdb.base/ena-dis-br.exp | 8 ++++++++ + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index ccd05d9..5a0c5ab 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -14389,7 +14389,7 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *, + int match; + struct get_number_or_range_state state; + +- if (args == 0) ++ if (args == 0 || *args == '\0') + error_no_arg (_("one or more breakpoint numbers")); + + init_number_or_range (&state, args); +@@ -14713,7 +14713,12 @@ do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr) + static void + enable_count_command (char *args, int from_tty) + { +- int count = get_number (&args); ++ int count; ++ ++ if (args == NULL) ++ error_no_arg (_("hit count")); ++ ++ count = get_number (&args); + + map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count); + } +diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp +index b08b709..82aef64 100644 +--- a/gdb/testsuite/gdb.base/ena-dis-br.exp ++++ b/gdb/testsuite/gdb.base/ena-dis-br.exp +@@ -173,6 +173,14 @@ set bp [break_at $bp_location7 "line $bp_location7"] + + set bp2 [break_at marker1 " line ($bp_location15|$bp_location16)"] + ++gdb_test "enable count" \ ++ "Argument required \\(hit count\\)\\." \ ++ "enable count missing arguments" ++ ++gdb_test "enable count 2" \ ++ "Argument required \\(one or more breakpoint numbers\\)\\." \ ++ "enable count missing last argument" ++ + gdb_test_no_output "enable count 2 $bp" "disable break with count" + + gdb_test "continue" \ + diff --git a/SOURCES/gdb-follow-child-stale-parent.patch b/SOURCES/gdb-follow-child-stale-parent.patch new file mode 100644 index 0000000..336790c --- /dev/null +++ b/SOURCES/gdb-follow-child-stale-parent.patch @@ -0,0 +1,27 @@ +Problem occurs with python and its get_current_arch () as it selects +selected_frame and current_frame while still inferior_ptid is valid for the +original parent. But since this place it is already attached and later +unwinders try to access it, breaking: + -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork + -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork + -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork + -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork + -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish + +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork + +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork + +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork + +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork + +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish + +--- ./gdb/infrun.c 2009-12-21 20:26:30.000000000 +0100 ++++ ./gdb/infrun.c 2009-12-21 20:26:11.000000000 +0100 +@@ -375,6 +375,9 @@ follow_fork (void) + } + else + { ++ /* Possibly referenced PARENT is no longer valid. */ ++ reinit_frame_cache (); ++ + /* This pending follow fork event is now handled, one way + or another. The previous selected thread may be gone + from the lists by now, but if it is still around, need diff --git a/SOURCES/gdb-gdb-add-index-script.patch b/SOURCES/gdb-gdb-add-index-script.patch new file mode 100644 index 0000000..966cd6c --- /dev/null +++ b/SOURCES/gdb-gdb-add-index-script.patch @@ -0,0 +1,206 @@ +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.5.91.20130407/gdb/Makefile.in +=================================================================== +--- gdb-7.5.91.20130407.orig/gdb/Makefile.in 2013-04-11 16:52:51.000000000 +0200 ++++ gdb-7.5.91.20130407/gdb/Makefile.in 2013-04-11 16:53:59.199279388 +0200 +@@ -1053,6 +1053,15 @@ install-only: install-gstack $(CONFIG_IN + $(INSTALL_PROGRAM) gcore \ + $(DESTDIR)$(bindir)/$$transformed_name; \ + fi ++ transformed_name=`t='$(program_transform_name)'; \ ++ echo gdb-add-index | sed -e "$$t"` ; \ ++ if test "x$$transformed_name" = x; then \ ++ 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.5.91.20130407/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.5.91.20130407.orig/gdb/doc/gdb.texinfo 2013-04-11 16:53:00.000000000 +0200 ++++ gdb-7.5.91.20130407/gdb/doc/gdb.texinfo 2013-04-11 16:55:07.004278842 +0200 +@@ -17159,6 +17159,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 + +@@ -41730,6 +41738,7 @@ switch (die->tag) + * gdbserver man:: Remote Server for the GNU Debugger man page + * gcore man:: Generate a core file of a running program + * gdbinit man:: gdbinit scripts ++* gdb-add-index man:: Add index files to speed up GDB + @end menu + + @node gdb man +@@ -42382,6 +42391,54 @@ gdb(1), @code{info -f gdb -n Startup} + The full documentation for @value{GDBN} is maintained as a Texinfo manual. + If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo + documentation are properly installed at your site, the command ++ ++@smallexample ++info gdb ++@end smallexample ++ ++should give you access to the complete manual. ++ ++@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++Richard M. Stallman and Roland H. Pesch, July 1991. ++@end ifset ++@c man end ++ ++@node gdb-add-index man ++@heading gdb-add-index ++ ++@c man title gdb-add-index Add index files to speed up GDB ++ ++@c man begin SYNOPSIS gdb-add-index ++gdb-add-index @var{filename} ++@c man end ++ ++@c man begin DESCRIPTION gdb-add-index ++When GDB finds a symbol file, it scans the symbols in the file in order ++to construct an internal symbol table. This lets most GDB operations ++work quickly--at the cost of a delay early on. For large programs, ++this delay can be quite lengthy, so GDB provides a way to build an ++index, which speeds up startup. ++ ++To determine whether a file contains such an index, use the command ++@command{readelf -S filename}: the index is stored in a section named ++@code{.gdb_index}. Note that the index is never generated for files that do ++not contain DWARF debug information (sections named @code{.debug_*}). ++ ++See more in ++@ifset man ++the @value{GDBN} manual in node @code{Index Files} ++-- shell command @code{info -f gdb -n 'Index Files'}. ++@end ifset ++@ifclear man ++@ref{Index Files}. ++@end ifclear ++@c man end ++ ++@c man begin SEEALSO gdb-add-index ++@ifset man ++The full documentation for @value{GDBN} is maintained as a Texinfo manual. ++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo ++documentation are properly installed at your site, the command + + @smallexample + info gdb +Index: gdb-7.5.91.20130407/gdb/gdb-add-index +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.91.20130407/gdb/gdb-add-index 2013-04-11 16:53:21.524279909 +0200 +@@ -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 -iex 'set auto-load no' --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 +Index: gdb-7.5.91.20130407/gdb/doc/Makefile.in +=================================================================== +--- gdb-7.5.91.20130407.orig/gdb/doc/Makefile.in 2013-04-11 16:50:33.202286928 +0200 ++++ gdb-7.5.91.20130407/gdb/doc/Makefile.in 2013-04-11 16:55:06.993279304 +0200 +@@ -177,7 +177,7 @@ POD2MAN5 = pod2man --center="GNU Develop + --release="gdb-`sed q $(srcdir)/../version.in`" --section=5 + + # List of man pages generated from gdb.texi +-MAN1S = gdb.1 gdbserver.1 gcore.1 ++MAN1S = gdb.1 gdbserver.1 gcore.1 gdb-add-index.1 + MAN5S = gdbinit.5 + MANS = $(MAN1S) $(MAN5S) + +@@ -626,6 +626,13 @@ gcore.1: $(GDB_DOC_FILES) + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gcore.pod + ++gdb-add-index.1: $(GDB_DOC_FILES) ++ touch $@ ++ -$(TEXI2POD) $(MANCONF) -Dgdb-add-index < $(srcdir)/gdb.texinfo > gdb-add-index.pod ++ -($(POD2MAN1) gdb-add-index.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ ++ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) ++ rm -f gdb-add-index.pod ++ + gdbinit.5: $(GDB_DOC_FILES) + touch $@ + -$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod diff --git a/SOURCES/gdb-glibc-strstr-workaround.patch b/SOURCES/gdb-glibc-strstr-workaround.patch new file mode 100644 index 0000000..83f6b09 --- /dev/null +++ b/SOURCES/gdb-glibc-strstr-workaround.patch @@ -0,0 +1,143 @@ +Index: gdb-7.5.50.20130118/gdb/dwarf2read.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/dwarf2read.c 2013-01-19 21:16:22.437961789 +0100 ++++ gdb-7.5.50.20130118/gdb/dwarf2read.c 2013-01-19 21:24:22.242969266 +0100 +@@ -15987,6 +15987,25 @@ new_symbol_full (struct die_info *die, s + /* Cache this symbol's name and the name's demangled form (if any). */ + SYMBOL_SET_LANGUAGE (sym, cu->language); + 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 +Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2013-01-19 21:23:09.119827963 +0100 +@@ -0,0 +1,108 @@ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# 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)" ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } ++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \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)" ++ } ++ -re " = {} $addr <__libc_strstr>\r\n$gdb_prompt $" { ++ pass "$test (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/SOURCES/gdb-glibc-vdso-workaround.patch b/SOURCES/gdb-glibc-vdso-workaround.patch new file mode 100644 index 0000000..48646d7 --- /dev/null +++ b/SOURCES/gdb-glibc-vdso-workaround.patch @@ -0,0 +1,30 @@ +http://sourceware.org/ml/gdb-patches/2011-08/msg00331.html +Subject: [RFC] Work around PR libc/13097 "linux-vdso.so.1" #2 + +Hi, + +missed the x86_64-m32 case: + +gdb/ +2011-08-16 Jan Kratochvil + + 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/SOURCES/gdb-gstack.man b/SOURCES/gdb-gstack.man new file mode 100644 index 0000000..1f4e406 --- /dev/null +++ b/SOURCES/gdb-gstack.man @@ -0,0 +1,48 @@ +.\" +.\" gstack manual page. +.\" Copyright (c) 1999 Ross Thompson +.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc. +.\" +.\" Original author: Ross Thompson +.\" +.\" This program is free software; you can 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, or (at your option) +.\" any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program; see the file COPYING. If not, write to +.\" the Free Software Foundation, 59 Temple Place - Suite 330, +.\" Boston, MA 02111-1307, USA. +.\" +.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual" + +.SH NAME +gstack \- print a stack trace of a running process + +.SH SYNOPSIS +.B gstack +pid + +.SH DESCRIPTION + +\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on +the command line, and prints out an execution stack trace. If ELF +symbols exist in the binary (usually the case unless you have run +strip(1)), then symbolic addresses are printed as well. + +If the process is part of a thread group, then \f3gstack\f1 will print +out a stack trace for each of the threads in the group. + +.SH SEE ALSO +nm(1), ptrace(2), gdb(1) + +.SH AUTHORS +Ross Thompson + +Red Hat, Inc. diff --git a/SOURCES/gdb-lineno-makeup-test.patch b/SOURCES/gdb-lineno-makeup-test.patch new file mode 100644 index 0000000..073662a --- /dev/null +++ b/SOURCES/gdb-lineno-makeup-test.patch @@ -0,0 +1,151 @@ +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/SOURCES/gdb-moribund-utrace-workaround.patch b/SOURCES/gdb-moribund-utrace-workaround.patch new file mode 100644 index 0000000..6b50a8e --- /dev/null +++ b/SOURCES/gdb-moribund-utrace-workaround.patch @@ -0,0 +1,16 @@ +https://bugzilla.redhat.com/show_bug.cgi?id=590623 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593 + +Bug in FSF GDB exploited by the ptrace-on-utrace interaction. + +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -9084,6 +9084,8 @@ update_global_location_list (int should_insert) + traps we can no longer explain. */ + + old_loc->events_till_retirement = 3 * (thread_count () + 1); ++ /* Red Hat Bug 590623. */ ++ old_loc->events_till_retirement *= 10; + old_loc->owner = NULL; + + VEC_safe_push (bp_location_p, moribund_locations, old_loc); diff --git a/SOURCES/gdb-orphanripper.c b/SOURCES/gdb-orphanripper.c new file mode 100644 index 0000000..2653dd2 --- /dev/null +++ b/SOURCES/gdb-orphanripper.c @@ -0,0 +1,752 @@ +/* + * 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. + * + * Reap any leftover children possibly holding file descriptors. + * Children are identified by the stale file descriptor or PGID / SID. + * Both can be missed but only the stale file descriptors are important for us. + * PGID / SID may be set by the children on their own. + * If we fine a candidate we kill it will all its process tree (grandchildren). + * The child process is run with `2>&1' redirection (due to forkpty(3)). + * 2007-07-10 Jan Kratochvil + */ + +/* For getpgid(2). */ +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LENGTH(x) (sizeof (x) / sizeof (*(x))) + +static const char *progname; + +static volatile pid_t child; + +static void signal_chld (int signo) +{ +} + +static volatile int signal_alrm_hit = 0; + +static void signal_alrm (int signo) +{ + signal_alrm_hit = 1; +} + +static char childptyname[LINE_MAX]; + +static void print_child_error (const char *reason, char **argv) +{ + char **sp; + + fprintf (stderr, "%s: %d %s:", progname, (int) child, reason); + for (sp = argv; *sp != NULL; sp++) + { + fputc (' ', stderr); + fputs (*sp, stderr); + } + fputc ('\n', stderr); +} + +static int read_out (int amaster) +{ + char buf[LINE_MAX]; + ssize_t buf_got; + + buf_got = read (amaster, buf, sizeof buf); + if (buf_got == 0) + return 0; + /* Weird but at least after POLLHUP we get EIO instead of just EOF. */ + if (buf_got == -1 && errno == EIO) + return 0; + if (buf_got == -1 && errno == EAGAIN) + return 0; + if (buf_got < 0) + { + perror ("read (amaster)"); + exit (EXIT_FAILURE); + } + if (write (STDOUT_FILENO, buf, buf_got) != buf_got) + { + perror ("write(2)"); + exit (EXIT_FAILURE); + } + return 1; +} + +/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */ + +static int child_exited (void) +{ + char buf[200]; + int fd, i, retval; + ssize_t got; + char state[3]; + + snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child); + fd = open (buf, O_RDONLY); + if (fd == -1) + { + perror ("open (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + got = read (fd, buf, sizeof(buf)); + if (got <= 0) + { + perror ("read (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + if (close (fd) != 0) + { + perror ("close (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + /* RHEL-5 does not support %ms. */ + i = sscanf (buf, "%*d%*s%2s", state); + if (i != 1) + { + perror ("sscanf (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + retval = strcmp (state, "Z") == 0; + return retval; +} + +static int spawn (char **argv, int timeout) +{ + pid_t child_got; + int status, amaster, i, rc; + struct sigaction act; + sigset_t set; + struct termios termios; + unsigned alarm_orig; + + /* We do not use signal(2) to be sure we do not have SA_RESTART. */ + memset (&act, 0, sizeof (act)); + act.sa_handler = signal_chld; + i = sigemptyset (&act.sa_mask); + assert (i == 0); + act.sa_flags = 0; /* !SA_RESTART */ + i = sigaction (SIGCHLD, &act, NULL); + assert (i == 0); + + i = sigemptyset (&set); + assert (i == 0); + i = sigaddset (&set, SIGCHLD); + assert (i == 0); + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* With TERMP passed as NULL we get "\n" -> "\r\n". */ + termios.c_iflag = IGNBRK | IGNPAR; + termios.c_oflag = 0; + termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600; + termios.c_lflag = IEXTEN | NOFLSH; + memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc)); + termios.c_cc[VTIME] = 0; + termios.c_cc[VMIN ] = 1; + cfmakeraw (&termios); +#ifdef FLUSHO + /* Workaround a readline deadlock bug in _get_tty_settings(). */ + termios.c_lflag &= ~FLUSHO; +#endif + child = forkpty (&amaster, childptyname, &termios, NULL); + switch (child) + { + case -1: + perror ("forkpty(3)"); + exit (EXIT_FAILURE); + case 0: + /* Do not replace STDIN as inferiors query its termios. */ +#if 0 + i = close (STDIN_FILENO); + assert (i == 0); + i = open ("/dev/null", O_RDONLY); + assert (i == STDIN_FILENO); +#endif + + i = sigemptyset (&set); + assert (i == 0); + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* Do not setpgrp(2) in the parent process as the process-group + is shared for the whole sh(1) pipeline we could be a part + of. The process-group is set according to PID of the first + command in the pipeline. + We would rip even vi(1) in the case of: + ./orphanripper sh -c 'sleep 1&' | vi - + */ + /* Do not setpgrp(2) as our pty would not be ours and we would + get `SIGSTOP' later, particularly after spawning gdb(1). + setsid(3) was already executed by forkpty(3) and it would fail if + executed again. */ + if (getpid() != getpgrp ()) + { + perror ("getpgrp(2)"); + exit (EXIT_FAILURE); + } + execvp (argv[0], argv); + perror ("execvp(2)"); + exit (EXIT_FAILURE); + default: + break; + } + i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK); + if (i != 0) + { + perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)"); + exit (EXIT_FAILURE); + } + + /* We do not use signal(2) to be sure we do not have SA_RESTART. */ + act.sa_handler = signal_alrm; + i = sigaction (SIGALRM, &act, NULL); + assert (i == 0); + + alarm_orig = alarm (timeout); + assert (alarm_orig == 0); + + i = sigemptyset (&set); + assert (i == 0); + + while (!signal_alrm_hit) + { + struct pollfd pollfd; + + pollfd.fd = amaster; + pollfd.events = POLLIN; + i = ppoll (&pollfd, 1, NULL, &set); + if (i == -1 && errno == EINTR) + { + if (child_exited ()) + break; + /* Non-CHILD child may have exited. */ + continue; + } + assert (i == 1); + /* Data available? Process it first. */ + if (pollfd.revents & POLLIN) + { + if (!read_out (amaster)) + { + fprintf (stderr, "%s: Unexpected EOF\n", progname); + exit (EXIT_FAILURE); + } + } + if (pollfd.revents & POLLHUP) + break; + if ((pollfd.revents &= ~POLLIN) != 0) + { + fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname, + (unsigned) pollfd.revents); + exit (EXIT_FAILURE); + } + /* Child exited? */ + if (child_exited ()) + break; + } + + if (signal_alrm_hit) + { + i = kill (child, SIGKILL); + assert (i == 0); + } + else + alarm (0); + + /* WNOHANG still could fail. */ + child_got = waitpid (child, &status, 0); + if (child != child_got) + { + fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got); + exit (EXIT_FAILURE); + } + if (signal_alrm_hit) + { + char *buf; + + if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1) + { + print_child_error (buf, argv); + free (buf); + } + rc = 128 + SIGALRM; + } + else if (WIFEXITED (status)) + rc = WEXITSTATUS (status); + else if (WIFSIGNALED (status)) + { + print_child_error (strsignal (WTERMSIG (status)), argv); + rc = 128 + WTERMSIG (status); + } + else if (WIFSTOPPED (status)) + { + fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n", + (int) child, WSTOPSIG (status)); + exit (EXIT_FAILURE); + } + else + { + fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status); + exit (EXIT_FAILURE); + } + + /* Not used in fact. */ + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* Do not unset O_NONBLOCK as a stale child (the whole purpose of this + program) having open its output pty would block us in read_out. */ +#if 0 + i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */); + if (i != 0) + { + perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)"); + exit (EXIT_FAILURE); + } +#endif + + while (read_out (amaster)); + + /* Do not close the master FD as the child would have `/dev/pts/23 (deleted)' + entries which are not expected (and expecting ` (deleted)' would be + a race. */ +#if 0 + i = close (amaster); + if (i != 0) + { + perror ("close (forkpty ()'s amaster)"); + exit (EXIT_FAILURE); + } +#endif + + return rc; +} + +/* Detected commandline may look weird due to a race: + Original command: + ./orphanripper sh -c 'sleep 1&' & + Correct output: + [1] 29610 + ./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1 + Raced output (sh(1) child still did not update its argv[]): + [1] 29613 + ./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1& + We could delay a bit before ripping the children. */ +static const char *read_cmdline (pid_t pid) +{ + char cmdline_fname[32]; + static char cmdline[LINE_MAX]; + int fd; + ssize_t got; + char *s; + + if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline", + (int) pid) < 0) + return NULL; + fd = open (cmdline_fname, O_RDONLY); + if (fd == -1) + { + /* It may have already exited - ENOENT. */ +#if 0 + fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname); +#endif + return NULL; + } + got = read (fd, cmdline, sizeof (cmdline) - 1); + if (got == -1) + fprintf (stderr, "%s: read (\"%s\"): %m\n", progname, + cmdline_fname); + if (close (fd) != 0) + fprintf (stderr, "%s: close (\"%s\"): %m\n", progname, + cmdline_fname); + if (got < 0) + return NULL; + /* Convert '\0' argument delimiters to spaces. */ + for (s = cmdline; s < cmdline + got; s++) + if (!*s) + *s = ' '; + /* Trim the trailing spaces (typically single '\0'->' '). */ + while (s > cmdline && isspace (s[-1])) + s--; + *s = 0; + return cmdline; +} + +static int dir_scan (const char *dirname, + int (*callback) (struct dirent *dirent, const char *pathname)) +{ + DIR *dir; + struct dirent *dirent; + int rc = 0; + + dir = opendir (dirname); + if (dir == NULL) + { + if (errno == EACCES || errno == ENOENT) + return rc; + fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + while ((errno = 0, dirent = readdir (dir))) + { + char pathname[LINE_MAX]; + int pathname_len; + + pathname_len = snprintf (pathname, sizeof pathname, "%s/%s", + dirname, dirent->d_name); + if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname) + { + fprintf (stderr, "entry file name too long: `%s' / `%s'\n", + dirname, dirent->d_name); + continue; + } + /* RHEL-4.5 on s390x never fills in D_TYPE. */ + if (dirent->d_type == DT_UNKNOWN) + { + struct stat statbuf; + int i; + + /* We are not interested in the /proc/PID/fd/ links targets. */ + i = lstat (pathname, &statbuf); + if (i == -1) + { + if (errno == EACCES || errno == ENOENT) + continue; + fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname); + exit (EXIT_FAILURE); + } + if (S_ISDIR (statbuf.st_mode)) + dirent->d_type = DT_DIR; + if (S_ISLNK (statbuf.st_mode)) + dirent->d_type = DT_LNK; + /* No other D_TYPE types used in this code. */ + } + rc = (*callback) (dirent, pathname); + if (rc != 0) + { + errno = 0; + break; + } + } + if (errno != 0) + { + fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + if (closedir (dir) != 0) + { + fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + return rc; +} + +static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link)) +{ + char dirname[64]; + + if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0) + { + perror ("snprintf(3)"); + exit (EXIT_FAILURE); + } + + int callback (struct dirent *dirent, const char *pathname) + { + char buf[LINE_MAX]; + ssize_t buf_len; + + if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK) + || (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0 + && strcmp (dirent->d_name, "..") != 0) + || (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789") + != strlen (dirent->d_name))) + { + fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)" + " on readdir (\"%s\"): %m\n", + dirent->d_name, (unsigned) dirent->d_type, dirname); + return 0; + } + if (dirent->d_type == DT_DIR) + return 0; + buf_len = readlink (pathname, buf, sizeof buf - 1); + if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1) + { + if (errno != ENOENT && errno != EACCES) + fprintf (stderr, "Error reading link \"%s\": %m\n", pathname); + return 0; + } + buf[buf_len] = 0; + return (*func) (pid, buf); + } + + return dir_scan (dirname, callback); +} + +static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data) +{ + int callback (struct dirent *dirent, const char *pathname) + { + if (dirent->d_type != DT_DIR + || strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name)) + return 0; + (*func) (atoi (dirent->d_name), data); + return 0; + } + + dir_scan ("/proc", callback); +} + +static int rip_check_ptyname (pid_t pid, const char *link) +{ + assert (pid != getpid ()); + + return strcmp (link, childptyname) == 0; +} + +struct pid + { + struct pid *next; + pid_t pid; + }; +static struct pid *pid_list; + +static int pid_found (pid_t pid) +{ + struct pid *entry; + + for (entry = pid_list; entry != NULL; entry = entry->next) + if (entry->pid == pid) + return 1; + return 0; +} + +/* Single pass is not enough, a (multithreaded) process was seen to survive. + Repeated killing of the same process is not enough, zombies can be killed. + */ +static int cleanup_acted; + +static void pid_record (pid_t pid) +{ + struct pid *entry; + + if (pid_found (pid)) + return; + cleanup_acted = 1; + + entry = malloc (sizeof (*entry)); + if (entry == NULL) + { + fprintf (stderr, "%s: malloc: %m\n", progname); + exit (EXIT_FAILURE); + } + entry->pid = pid; + entry->next = pid_list; + pid_list = entry; +} + +static void pid_forall (void (*func) (pid_t pid)) +{ + struct pid *entry; + + for (entry = pid_list; entry != NULL; entry = entry->next) + (*func) (entry->pid); +} + +/* Returns 0 on failure. */ +static pid_t pid_get_parent (pid_t pid) +{ + char fname[64]; + FILE *f; + char line[LINE_MAX]; + pid_t retval = 0; + + if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0) + { + perror ("snprintf(3)"); + exit (EXIT_FAILURE); + } + f = fopen (fname, "r"); + if (f == NULL) + { + return 0; + } + while (errno = 0, fgets (line, sizeof line, f) == line) + { + if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0) + continue; + retval = atoi (line + sizeof "PPid:\t" - 1); + errno = 0; + break; + } + if (errno != 0) + { + fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname); + exit (EXIT_FAILURE); + } + if (fclose (f) != 0) + { + fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname); + exit (EXIT_FAILURE); + } + return retval; +} + +static void killtree (pid_t pid); + +static void killtree_pid_fs_scan (pid_t pid, void *data) +{ + pid_t parent_pid = *(pid_t *) data; + + /* Do not optimize it as we could miss some newly spawned processes. + Always traverse all the leaves. */ +#if 0 + /* Optimization. */ + if (pid_found (pid)) + return; +#endif + + if (pid_get_parent (pid) != parent_pid) + return; + + killtree (pid); +} + +static void killtree (pid_t pid) +{ + pid_record (pid); + pid_fs_scan (killtree_pid_fs_scan, &pid); +} + +static void rip_pid_fs_scan (pid_t pid, void *data) +{ + pid_t pgid; + + /* Shouldn't happen. */ + if (pid == getpid ()) + return; + + /* Check both PGID and the stale file descriptors. */ + pgid = getpgid (pid); + if (pgid == child + || fd_fs_scan (pid, rip_check_ptyname) != 0) + killtree (pid); +} + +static void killproc (pid_t pid) +{ + const char *cmdline; + + cmdline = read_cmdline (pid); + /* Avoid printing the message for already gone processes. */ + if (kill (pid, 0) != 0 && errno == ESRCH) + return; + if (cmdline == NULL) + cmdline = ""; + fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline); + if (kill (pid, SIGKILL) == 0) + cleanup_acted = 1; + else if (errno != ESRCH) + fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid); + /* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */ + kill (pid, SIGCONT); + /* Do not waitpid(2) as it cannot be our direct descendant and it gets + cleaned up by init(8). */ +#if 0 + pid_t pid_got; + pid_got = waitpid (pid, NULL, 0); + if (pid != pid_got) + { + fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname, + (int) pid, (int) pid_got); + return; + } +#endif +} + +static void rip (void) +{ + cleanup_acted = 0; + do + { + if (cleanup_acted) + usleep (1000000 / 10); + cleanup_acted = 0; + pid_fs_scan (rip_pid_fs_scan, NULL); + pid_forall (killproc); + } + while (cleanup_acted); +} + +int main (int argc, char **argv) +{ + int timeout = 0; + int rc; + + progname = *argv++; + argc--; + + if (argc < 1 || strcmp (*argv, "-h") == 0 + || strcmp (*argv, "--help") == 0) + { + puts ("Syntax: orphanripper [-t ] "); + exit (EXIT_FAILURE); + } + if ((*argv)[0] == '-' && (*argv)[1] == 't') + { + char *timeout_s = NULL; + + if ((*argv)[2] == 0) + timeout_s = *++argv; + else if (isdigit ((*argv)[2])) + timeout_s = (*argv) + 2; + if (timeout_s != NULL) + { + long l; + char *endptr; + + argv++; + l = strtol (timeout_s, &endptr, 0); + timeout = l; + if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l) + { + fprintf (stderr, "%s: Invalid timeout value: %s\n", progname, + timeout_s); + exit (EXIT_FAILURE); + } + } + } + + rc = spawn (argv, timeout); + rip (); + return rc; +} diff --git a/SOURCES/gdb-power8-1of2.patch b/SOURCES/gdb-power8-1of2.patch new file mode 100644 index 0000000..704d603 --- /dev/null +++ b/SOURCES/gdb-power8-1of2.patch @@ -0,0 +1,731 @@ +[PATCH] Full POWER8 binutils support +http://sourceware.org/ml/binutils/2013-05/msg00235.html +http://sourceware.org/ml/binutils-cvs/2013-05/msg00095.html + +### src/opcodes/ChangeLog 2013/05/17 12:57:15 1.1964 +### src/opcodes/ChangeLog 2013/05/21 01:36:46 1.1965 +## -1,3 +1,28 @@ ++2013-05-20 Peter Bergner ++ ++ * ppc-dis.c (powerpc_init_dialect): Set default dialect to power8. ++ * ppc-opc.c (BHRBE, ST, SIX, PS, SXL, VXPS_MASK, XX1RB_MASK, ++ XLS_MASK, PPCVSX2): New defines. ++ (powerpc_opcodes) : New instructions. ++ : New extended mnemonics. ++ + 2013-05-17 Alan Modra + + * ia64-raw.tbl: Replace non-ASCII char. +--- src/opcodes/ppc-dis.c 2013/01/11 02:25:36 1.62 ++++ src/opcodes/ppc-dis.c 2013/05/21 01:36:46 1.63 +@@ -315,10 +315,7 @@ + dialect = (PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_VLE); + break; + default: +- dialect = (PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_64 +- | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 +- | PPC_OPCODE_POWER7 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX +- | PPC_OPCODE_ANY); ++ dialect = ppc_parse_cpu (dialect, &sticky, "power8") | PPC_OPCODE_ANY; + } + + arg = info->disassembler_options; +--- src/opcodes/ppc-opc.c 2013/05/09 04:32:55 1.159 ++++ src/opcodes/ppc-opc.c 2013/05/21 01:36:46 1.160 +@@ -315,14 +315,18 @@ + { 0xfffc, 0, NULL, NULL, + PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DS }, + +- /* The DUIS field in a XFX form instruction, 10 bits unsigned imediate */ ++ /* The DUIS or BHRBE fields in a XFX form instruction, 10 bits ++ unsigned imediate */ + #define DUIS DS + 1 ++#define BHRBE DUIS + { 0x3ff, 11, NULL, NULL, 0 }, + + /* The E field in a wrteei instruction. */ + /* And the W bit in the pair singles instructions. */ ++ /* And the ST field in a VX form instruction. */ + #define E DUIS + 1 + #define PSW E ++#define ST E + { 0x1, 15, NULL, NULL, 0 }, + + /* The FL1 field in a POWER SC form instruction. */ +@@ -695,8 +699,16 @@ + #define UIMM3 UIMM + 1 + { 0x7, 16, NULL, NULL, 0 }, + ++ /* The SIX field in a VX form instruction. */ ++#define SIX UIMM3 + 1 ++ { 0xf, 11, NULL, NULL, 0 }, ++ ++ /* The PS field in a VX form instruction. */ ++#define PS SIX + 1 ++ { 0x1, 9, NULL, NULL, 0 }, ++ + /* The SHB field in a VA form instruction. */ +-#define SHB UIMM3 + 1 ++#define SHB PS + 1 + { 0xf, 6, NULL, NULL, 0 }, + + /* The other UIMM field in a half word EVX form instruction. */ +@@ -751,8 +763,12 @@ + #define S SP + 1 + { 0x1, 20, NULL, NULL, 0 }, + ++ /* The S field in a XL form instruction. */ ++#define SXL S + 1 ++ { 0x1, 11, NULL, NULL, PPC_OPERAND_OPTIONAL }, ++ + /* SH field starting at bit position 16. */ +-#define SH16 S + 1 ++#define SH16 SXL + 1 + /* The DCM and DGM fields in a Z form instruction. */ + #define DCM SH16 + #define DGM DCM +@@ -2325,6 +2341,9 @@ + /* A VX_MASK with a UIMM2 field. */ + #define VXUIMM2_MASK (VX_MASK | (0x7 << 18)) + ++/* A VX_MASK with a PS field. */ ++#define VXPS_MASK (VX_MASK & ~(0x1 << 9)) ++ + /* A VA form instruction. */ + #define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) + +@@ -2379,6 +2398,9 @@ + /* The mask for an XX1 form instruction. */ + #define XX1_MASK X (0x3f, 0x3ff) + ++/* An XX1_MASK with the RB field fixed. */ ++#define XX1RB_MASK (XX1_MASK | RB_MASK) ++ + /* The mask for an XX2 form instruction. */ + #define XX2_MASK (XX2 (0x3f, 0x1ff) | (0x1f << 16)) + +@@ -2516,6 +2538,9 @@ + /* The mask for an XL form instruction. */ + #define XL_MASK XLLK (0x3f, 0x3ff, 1) + ++/* An XL_MASK with the RT, RA and RB fields fixed, but S bit clear. */ ++#define XLS_MASK ((XL_MASK | RT_MASK | RA_MASK | RB_MASK) & ~(1 << 11)) ++ + /* An XL form instruction which explicitly sets the BO field. */ + #define XLO(op, bo, xop, lk) \ + (XLLK ((op), (xop), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21)) +@@ -2699,6 +2724,7 @@ + #define PPCVEC PPC_OPCODE_ALTIVEC + #define PPCVEC2 PPC_OPCODE_ALTIVEC2 + #define PPCVSX PPC_OPCODE_VSX ++#define PPCVSX2 PPC_OPCODE_VSX + #define POWER PPC_OPCODE_POWER + #define POWER2 PPC_OPCODE_POWER | PPC_OPCODE_POWER2 + #define PWR2COM PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_COMMON +@@ -2845,6 +2871,7 @@ + {"vperm", VXA(4, 43), VXA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB, VC}}, + {"vsldoi", VXA(4, 44), VXASHB_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB, SHB}}, + {"ps_sel", A (4, 23,0), A_MASK, PPCPS, PPCNONE, {FRT, FRA, FRC, FRB}}, ++{"vpermxor", VXA(4, 45), VXA_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, VC}}, + {"vmaddfp", VXA(4, 46), VXA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VC, VB}}, + {"ps_sel.", A (4, 23,1), A_MASK, PPCPS, PPCNONE, {FRT, FRA, FRC, FRB}}, + {"vnmsubfp", VXA(4, 47), VXA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VC, VB}}, +@@ -2863,6 +2890,10 @@ + {"ps_nmadd", A (4, 31,0), A_MASK, PPCPS, PPCNONE, {FRT, FRA, FRC, FRB}}, + {"ps_nmadd.", A (4, 31,1), A_MASK, PPCPS, PPCNONE, {FRT, FRA, FRC, FRB}}, + {"ps_cmpo0", X (4, 32), X_MASK|(3<<21), PPCPS, PPCNONE, {BF, FRA, FRB}}, ++{"vaddeuqm", VXA(4, 60), VXA_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, VC}}, ++{"vaddecuq", VXA(4, 61), VXA_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, VC}}, ++{"vsubeuqm", VXA(4, 62), VXA_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, VC}}, ++{"vsubecuq", VXA(4, 63), VXA_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, VC}}, + {"vadduhm", VX (4, 64), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vmaxuh", VX (4, 66), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vrlh", VX (4, 68), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -2886,6 +2917,8 @@ + {"vmaxuw", VX (4, 130), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vrlw", VX (4, 132), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vcmpequw", VXR(4, 134,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmulouw", VX (4, 136), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vmuluwm", VX (4, 137), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vmrghw", VX (4, 140), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vpkuhus", VX (4, 142), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"ps_mr", XRC(4, 72,0), XRA_MASK, PPCPS, PPCNONE, {FRT, FRB}}, +@@ -2893,12 +2926,17 @@ + {"machhwsu", XO (4, 76,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"machhwsu.", XO (4, 76,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"ps_cmpo1", X (4, 96), X_MASK|(3<<21), PPCPS, PPCNONE, {BF, FRA, FRB}}, ++{"vaddudm", VX (4, 192), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vmaxud", VX (4, 194), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vrld", VX (4, 196), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpeqfp", VXR(4, 198,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vcmpequd", VXR(4, 199,0), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vpkuwus", VX (4, 206), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"machhws", XO (4, 108,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"machhws.", XO (4, 108,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmachhws", XO (4, 110,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmachhws.", XO (4, 110,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, ++{"vadduqm", VX (4, 256), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vmaxsb", VX (4, 258), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vslb", VX (4, 260), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vmulosb", VX (4, 264), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -2911,6 +2949,7 @@ + {"mulchwu.", XRC(4, 136,1), X_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"macchwu", XO (4, 140,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"macchwu.", XO (4, 140,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, ++{"vaddcuq", VX (4, 320), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vmaxsh", VX (4, 322), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vslh", VX (4, 324), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vmulosh", VX (4, 328), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -2926,11 +2965,13 @@ + {"vaddcuw", VX (4, 384), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vmaxsw", VX (4, 386), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vslw", VX (4, 388), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmulosw", VX (4, 392), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vexptefp", VX (4, 394), VXVA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB}}, + {"vmrglw", VX (4, 396), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vpkshss", VX (4, 398), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"macchwsu", XO (4, 204,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"macchwsu.", XO (4, 204,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, ++{"vmaxsd", VX (4, 450), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vsl", VX (4, 452), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vcmpgefp", VXR(4, 454,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vlogefp", VX (4, 458), VXVA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB}}, +@@ -3014,6 +3055,7 @@ + {"evfsnabs", VX (4, 645), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evfsneg", VX (4, 646), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"vcmpgtuw", VXR(4, 646,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmuleuw", VX (4, 648), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evfsmul", VX (4, 648), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evfsdiv", VX (4, 649), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vrfip", VX (4, 650), VXVA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB}}, +@@ -3039,11 +3081,13 @@ + {"cput", APU(4, 348,0), APU_RT_MASK, PPC405, PPCNONE, {RA, FSL}}, + {"efsadd", VX (4, 704), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"efssub", VX (4, 705), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vminud", VX (4, 706), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"efsabs", VX (4, 708), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA}}, + {"vsr", VX (4, 708), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"efsnabs", VX (4, 709), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA}}, + {"efsneg", VX (4, 710), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA}}, + {"vcmpgtfp", VXR(4, 710,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vcmpgtud", VXR(4, 711,0), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"efsmul", VX (4, 712), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"efsdiv", VX (4, 713), VX_MASK, PPCEFS|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vrfim", VX (4, 714), VXVA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB}}, +@@ -3163,12 +3207,16 @@ + {"vminsw", VX (4, 898), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vsraw", VX (4, 900), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vcmpgtsw", VXR(4, 902,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmulesw", VX (4, 904), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vctuxs", VX (4, 906), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB, UIMM}}, + {"vcfpuxws", VX (4, 906), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB, UIMM}}, + {"vspltisw", VX (4, 908), VXVB_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, SIMM}}, + {"maclhwsu", XO (4, 460,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"maclhwsu.", XO (4, 460,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, ++{"vminsd", VX (4, 962), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vsrad", VX (4, 964), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpbfp", VXR(4, 966,0), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vcmpgtsd", VXR(4, 967,0), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vctsxs", VX (4, 970), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB, UIMM}}, + {"vcfpsxws", VX (4, 970), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB, UIMM}}, + {"vupklpx", VX (4, 974), VXVA_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VB}}, +@@ -3177,6 +3225,7 @@ + {"nmaclhws", XO (4, 494,0,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmaclhws.", XO (4, 494,0,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"vsububm", VX (4,1024), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"bcdadd.", VX (4,1025), VXPS_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, PS}}, + {"vavgub", VX (4,1026), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vabsdub", VX (4,1027), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmhessf", VX (4,1027), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, +@@ -3185,6 +3234,7 @@ + {"udi0fcm.", APU(4, 515,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"udi0fcm", APU(4, 515,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"evmhossf", VX (4,1031), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vpmsumb", VX (4,1032), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmheumi", VX (4,1032), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhesmi", VX (4,1033), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vmaxfp", VX (4,1034), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -3206,6 +3256,7 @@ + {"evmhosmia", VX (4,1069), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhosmfa", VX (4,1071), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vsubuhm", VX (4,1088), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"bcdsub.", VX (4,1089), VXPS_MASK, PPCVEC2, PPCNONE, {VD, VA, VB, PS}}, + {"vavguh", VX (4,1090), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"vabsduh", VX (4,1091), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vandc", VX (4,1092), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -3213,11 +3264,13 @@ + {"udi1fcm.", APU(4, 547,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"udi1fcm", APU(4, 547,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"evmwhssf", VX (4,1095), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vpmsumh", VX (4,1096), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwlumi", VX (4,1096), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vminfp", VX (4,1098), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"evmwhumi", VX (4,1100), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vsro", VX (4,1100), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"evmwhsmi", VX (4,1101), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vpkudum", VX (4,1102), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwhsmf", VX (4,1103), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmwssf", VX (4,1107), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"machhwo", XO (4, 44,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, +@@ -3243,6 +3296,7 @@ + {"vabsduw", VX (4,1155), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vmr", VX (4,1156), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VBA}}, + {"vor", VX (4,1156), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vpmsumw", VX (4,1160), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpequw.", VXR(4, 134,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi2fcm.", APU(4, 579,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"udi2fcm", APU(4, 579,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, +@@ -3250,6 +3304,7 @@ + {"machhwsuo.", XO (4, 76,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"ps_merge10", XOPS(4,592,0), XOPS_MASK, PPCPS, PPCNONE, {FRT, FRA, FRB}}, + {"ps_merge10.", XOPS(4,592,1), XOPS_MASK, PPCPS, PPCNONE, {FRT, FRA, FRB}}, ++{"vsubudm", VX (4,1216), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evaddusiaaw", VX (4,1216), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evaddssiaaw", VX (4,1217), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evsubfusiaaw",VX (4,1218), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, +@@ -3259,18 +3314,22 @@ + {"evdivws", VX (4,1222), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vcmpeqfp.", VXR(4, 198,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi3fcm.", APU(4, 611,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, ++{"vcmpequd.", VXR(4, 199,1), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"udi3fcm", APU(4, 611,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"evdivwu", VX (4,1223), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vpmsumd", VX (4,1224), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evaddumiaaw", VX (4,1224), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evaddsmiaaw", VX (4,1225), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evsubfumiaaw",VX (4,1226), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, + {"evsubfsmiaaw",VX (4,1227), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA}}, ++{"vpkudus", VX (4,1230), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"machhwso", XO (4, 108,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"machhwso.", XO (4, 108,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmachhwso", XO (4, 110,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmachhwso.", XO (4, 110,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"ps_merge11", XOPS(4,624,0), XOPS_MASK, PPCPS, PPCNONE, {FRT, FRA, FRB}}, + {"ps_merge11.", XOPS(4,624,1), XOPS_MASK, PPCPS, PPCNONE, {FRT, FRA, FRB}}, ++{"vsubuqm", VX (4,1280), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmheusiaaw", VX (4,1280), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhessiaaw", VX (4,1281), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vavgsb", VX (4,1282), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, +@@ -3283,8 +3342,11 @@ + {"udi4fcm", APU(4, 643,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"evmhossfaaw", VX (4,1287), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmheumiaaw", VX (4,1288), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vcipher", VX (4,1288), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vcipherlast", VX (4,1289), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmhesmiaaw", VX (4,1289), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhesmfaaw", VX (4,1291), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vgbbd", VX (4,1292), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"evmhoumiaaw", VX (4,1292), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhosmiaaw", VX (4,1293), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhosmfaaw", VX (4,1295), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, +@@ -3296,13 +3358,19 @@ + {"evmhogumiaa", VX (4,1324), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhogsmiaa", VX (4,1325), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhogsmfaa", VX (4,1327), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vsubcuq", VX (4,1344), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwlusiaaw", VX (4,1344), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmwlssiaaw", VX (4,1345), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vavgsh", VX (4,1346), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vorc", VX (4,1348), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"udi5fcm.", APU(4, 675,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"udi5fcm", APU(4, 675,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, ++{"vncipher", VX (4,1352), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwlumiaaw", VX (4,1352), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vncipherlast",VX (4,1353), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwlsmiaaw", VX (4,1353), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vbpermq", VX (4,1356), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vpksdus", VX (4,1358), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwssfaa", VX (4,1363), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"macchwo", XO (4, 172,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"evmwumiaa", VX (4,1368), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, +@@ -3316,6 +3384,7 @@ + {"evmhessianw", VX (4,1409), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"vavgsw", VX (4,1410), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"evmhessfanw", VX (4,1411), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vnand", VX (4,1412), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmhousianw", VX (4,1412), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmhossianw", VX (4,1413), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"udi6fcm.", APU(4, 707,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, +@@ -3337,11 +3406,14 @@ + {"evmhogsmfan", VX (4,1455), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmwlusianw", VX (4,1472), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmwlssianw", VX (4,1473), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vsld", VX (4,1476), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpgefp.", VXR(4, 454,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi7fcm.", APU(4, 739,0), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, + {"udi7fcm", APU(4, 739,1), APU_MASK, PPC405|PPC440, PPC476, {URT, URA, URB}}, ++{"vsbox", VX (4,1480), VXVB_MASK, PPCVEC2, PPCNONE, {VD, VA}}, + {"evmwlumianw", VX (4,1480), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"evmwlsmianw", VX (4,1481), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, ++{"vpksdss", VX (4,1486), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"evmwssfan", VX (4,1491), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, + {"macchwso", XO (4, 236,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"evmwumian", VX (4,1496), VX_MASK, PPCSPE|PPCVLE, PPCNONE, {RS, RA, RB}}, +@@ -3362,15 +3434,25 @@ + {"vsum4shs", VX (4,1608), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi9fcm.", APU(4, 804,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"udi9fcm", APU(4, 804,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, ++{"vupkhsw", VX (4,1614), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vsubuws", VX (4,1664), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vshasigmaw", VX (4,1666), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, ST, SIX}}, ++{"veqv", VX (4,1668), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpgtuw.", VXR(4, 646,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi10fcm.", APU(4, 835,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"udi10fcm", APU(4, 835,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"vsum2sws", VX (4,1672), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmrgow", VX (4,1676), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, ++{"vshasigmad", VX (4,1730), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, ST, SIX}}, ++{"vsrd", VX (4,1732), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"vcmpgtfp.", VXR(4, 710,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi11fcm.", APU(4, 867,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, ++{"vcmpgtud.", VXR(4, 711,1), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"udi11fcm", APU(4, 867,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, ++{"vupklsw", VX (4,1742), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vsubsbs", VX (4,1792), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vclzb", VX (4,1794), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, ++{"vpopcntb", VX (4,1795), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vcmpgtsb.", VXR(4, 774,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi12fcm.", APU(4, 899,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"udi12fcm", APU(4, 899,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, +@@ -3378,6 +3460,8 @@ + {"maclhwuo", XO (4, 396,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"maclhwuo.", XO (4, 396,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"vsubshs", VX (4,1856), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vclzh", VX (4,1858), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, ++{"vpopcnth", VX (4,1859), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vcmpgtsh.", VXR(4, 838,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi13fcm.", APU(4, 931,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"udi13fcm", APU(4, 931,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, +@@ -3386,14 +3470,20 @@ + {"nmaclhwo", XO (4, 430,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"nmaclhwo.", XO (4, 430,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"vsubsws", VX (4,1920), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vclzw", VX (4,1922), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, ++{"vpopcntw", VX (4,1923), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vcmpgtsw.", VXR(4, 902,1), VXR_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, + {"udi14fcm.", APU(4, 963,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"udi14fcm", APU(4, 963,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"vsumsws", VX (4,1928), VX_MASK, PPCVEC|PPCVLE, PPCNONE, {VD, VA, VB}}, ++{"vmrgew", VX (4,1932), VX_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"maclhwsuo", XO (4, 460,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"maclhwsuo.", XO (4, 460,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, ++{"vclzd", VX (4,1986), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, ++{"vpopcntd", VX (4,1987), VXVA_MASK, PPCVEC2, PPCNONE, {VD, VB}}, + {"vcmpbfp.", VXR(4, 966,1), VXR_MASK, PPCVEC, PPCNONE, {VD, VA, VB}}, + {"udi15fcm.", APU(4, 995,0), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, ++{"vcmpgtsd.", VXR(4, 967,1), VXR_MASK, PPCVEC2, PPCNONE, {VD, VA, VB}}, + {"udi15fcm", APU(4, 995,1), APU_MASK, PPC440, PPC476, {URT, URA, URB}}, + {"maclhwso", XO (4, 492,1,0),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"maclhwso.", XO (4, 492,1,1),XO_MASK, MULHW|PPCVLE, PPCNONE, {RT, RA, RB}}, +@@ -3965,6 +4055,8 @@ + + {"crandc", XL(19,129), XL_MASK, COM, PPCNONE, {BT, BA, BB}}, + ++{"rfebb", XL(19,146), XLS_MASK, POWER8, PPCNONE, {SXL}}, ++ + {"isync", XL(19,150), 0xffffffff, PPCCOM, PPCNONE, {0}}, + {"ics", XL(19,150), 0xffffffff, PWRCOM, PPCNONE, {0}}, + +@@ -4148,6 +4240,13 @@ + {"bcctrl", XLLK(19,528,1), XLBH_MASK, PPCCOM, PPCNONE, {BO, BI, BH}}, + {"bccl", XLLK(19,528,1), XLBB_MASK, PWRCOM, PPCNONE, {BO, BI}}, + ++{"bctar-", XLYLK(19,560,0,0), XLYBB_MASK, POWER8, PPCNONE, {BOE, BI}}, ++{"bctarl-", XLYLK(19,560,0,1), XLYBB_MASK, POWER8, PPCNONE, {BOE, BI}}, ++{"bctar+", XLYLK(19,560,1,0), XLYBB_MASK, POWER8, PPCNONE, {BOE, BI}}, ++{"bctarl+", XLYLK(19,560,1,1), XLYBB_MASK, POWER8, PPCNONE, {BOE, BI}}, ++{"bctar", XLLK(19,560,0), XLBH_MASK, POWER8, PPCNONE, {BO, BI, BH}}, ++{"bctarl", XLLK(19,560,1), XLBH_MASK, POWER8, PPCNONE, {BO, BI, BH}}, ++ + {"rlwimi", M(20,0), M_MASK, PPCCOM, PPCNONE, {RA, RS, SH, MBE, ME}}, + {"rlimi", M(20,0), M_MASK, PWRCOM, PPCNONE, {RA, RS, SH, MBE, ME}}, + +@@ -4276,6 +4375,8 @@ + {"mulhwu", XO(31,11,0,0), XO_MASK, PPC|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"mulhwu.", XO(31,11,0,1), XO_MASK, PPC|PPCVLE, PPCNONE, {RT, RA, RB}}, + ++{"lxsiwzx", X(31,12), XX1_MASK, PPCVSX2, PPCNONE, {XT6, RA0, RB}}, ++ + {"isellt", X(31,15), X_MASK, PPCISEL, PPCNONE, {RT, RA0, RB}}, + + {"tlbilxlpid", XTO(31,18,0), XTO_MASK, E500MC|PPCA2, PPCNONE, {0}}, +@@ -4316,6 +4417,9 @@ + {"maskg.", XRC(31,29,1), X_MASK, M601, PPCA2, {RA, RS, RB}}, + + {"ldepx", X(31,29), X_MASK, E500MC|PPCA2|PPCVLE, PPCNONE, {RT, RA0, RB}}, ++ ++{"waitasec", X(31,30), XRTRARB_MASK,POWER8, PPCNONE, {0}}, ++ + {"lwepx", X(31,31), X_MASK, E500MC|PPCA2|PPCVLE, PPCNONE, {RT, RA0, RB}}, + + {"cmplw", XOPL(31,32,0), XCMPL_MASK, PPCCOM|PPCVLE, PPCNONE, {OBF, RA, RB}}, +@@ -4335,6 +4439,8 @@ + + {"addg6s", XO(31,74,0,0), XO_MASK, POWER6, PPCNONE, {RT, RA, RB}}, + ++{"lxsiwax", X(31,76), XX1_MASK, PPCVSX2, PPCNONE, {XT6, RA0, RB}}, ++ + {"iseleq", X(31,79), X_MASK, PPCISEL, PPCNONE, {RT, RA0, RB}}, + + {"isel", XISEL(31,15), XISEL_MASK, PPCISEL|TITAN|PPCVLE, PPCNONE, {RT, RA0, RB, CRB}}, +@@ -4344,6 +4450,9 @@ + {"subf.", XO(31,40,0,1), XO_MASK, PPC|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"sub.", XO(31,40,0,1), XO_MASK, PPC|PPCVLE, PPCNONE, {RT, RB, RA}}, + ++{"mfvsrd", X(31,51), XX1RB_MASK, PPCVSX2, PPCNONE, {RA, XS6}}, ++{"mffprd", X(31,51), XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, FRS}}, ++{"mfvrd", X(31,51)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, VS}}, + {"eratilx", X(31,51), X_MASK, PPCA2, PPCNONE, {ERAT_T, RA, RB}}, + + {"lbarx", X(31,52), XEH_MASK, POWER7|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, +@@ -4421,6 +4530,10 @@ + + {"mtsrdin", X(31,114), XRA_MASK, PPC64, PPCNONE, {RS, RB}}, + ++{"mffprwz", X(31,115), XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, FRS}}, ++{"mfvrwz", X(31,115)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, VS}}, ++{"mfvsrwz", X(31,115), XX1RB_MASK, PPCVSX2, PPCNONE, {RA, XS6}}, ++ + {"lharx", X(31,116), XEH_MASK, POWER7|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, + + {"clf", X(31,118), XTO_MASK, POWER, PPCNONE, {RA, RB}}, +@@ -4453,6 +4566,9 @@ + {"adde.", XO(31,138,0,1), XO_MASK, PPCCOM|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"ae.", XO(31,138,0,1), XO_MASK, PWRCOM, PPCNONE, {RT, RA, RB}}, + ++{"stxsiwx", X(31,140), XX1_MASK, PPCVSX2, PPCNONE, {XS6, RA0, RB}}, ++ ++{"msgsndp", XRTRA(31,142,0,0), XRTRA_MASK, POWER8, PPCNONE, {RB}}, + {"dcbtstlse", X(31,142), X_MASK, PPCCHLK, E500MC, {CT, RA0, RB}}, + + {"mtcr", XFXM(31,144,0xff,0), XRARB_MASK, COM, PPCNONE, {RS}}, +@@ -4461,6 +4577,8 @@ + + {"mtmsr", X(31,146), XRLARB_MASK, COM|PPCVLE, PPCNONE, {RS, A_L}}, + ++{"mtsle", X(31,147), XRTLRARB_MASK, POWER8, PPCNONE, {L}}, ++ + {"eratsx", XRC(31,147,0), X_MASK, PPCA2, PPCNONE, {RT, RA0, RB}}, + {"eratsx.", XRC(31,147,1), X_MASK, PPCA2, PPCNONE, {RT, RA0, RB}}, + +@@ -4490,14 +4608,19 @@ + {"stvehx", X(31,167), X_MASK, PPCVEC, PPCNONE, {VS, RA0, RB}}, + {"sthfcmx", APU(31,167,0), APU_MASK, PPC405, PPCNONE, {FCRT, RA, RB}}, + ++{"msgclrp", XRTRA(31,174,0,0), XRTRA_MASK, POWER8, PPCNONE, {RB}}, + {"dcbtlse", X(31,174), X_MASK, PPCCHLK, E500MC, {CT, RA0, RB}}, + + {"mtmsrd", X(31,178), XRLARB_MASK, PPC64, PPCNONE, {RS, A_L}}, + ++{"mtvsrd", X(31,179), XX1RB_MASK, PPCVSX2, PPCNONE, {XT6, RA}}, ++{"mtfprd", X(31,179), XX1RB_MASK|1, PPCVSX2, PPCNONE, {FRT, RA}}, ++{"mtvrd", X(31,179)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {VD, RA}}, + {"eratre", X(31,179), X_MASK, PPCA2, PPCNONE, {RT, RA, WS}}, + + {"stdux", X(31,181), X_MASK, PPC64|PPCVLE, PPCNONE, {RS, RAS, RB}}, + ++{"stqcx.", XRC(31,182,1), X_MASK, POWER8, PPCNONE, {RSQ, RA0, RB}}, + {"wchkall", X(31,182), X_MASK, PPCA2, PPCNONE, {OBF}}, + + {"stwux", X(31,183), X_MASK, PPCCOM|PPCVLE, PPCNONE, {RS, RAS, RB}}, +@@ -4527,6 +4650,9 @@ + + {"mtsr", X(31,210), XRB_MASK|(1<<20), COM, NON32, {SR, RS}}, + ++{"mtfprwa", X(31,211), XX1RB_MASK|1, PPCVSX2, PPCNONE, {FRT, RA}}, ++{"mtvrwa", X(31,211)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {VD, RA}}, ++{"mtvsrwa", X(31,211), XX1RB_MASK, PPCVSX2, PPCNONE, {XT6, RA}}, + {"eratwe", X(31,211), X_MASK, PPCA2, PPCNONE, {RS, RA, WS}}, + + {"ldawx.", XRC(31,212,1), X_MASK, PPCA2, PPCNONE, {RT, RA0, RB}}, +@@ -4571,6 +4697,10 @@ + {"mtsrin", X(31,242), XRA_MASK, PPC, NON32, {RS, RB}}, + {"mtsri", X(31,242), XRA_MASK, POWER, NON32, {RS, RB}}, + ++{"mtfprwz", X(31,243), XX1RB_MASK|1, PPCVSX2, PPCNONE, {FRT, RA}}, ++{"mtvrwz", X(31,243)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {VD, RA}}, ++{"mtvsrwz", X(31,243), XX1RB_MASK, PPCVSX2, PPCNONE, {XT6, RA}}, ++ + {"dcbtstt", XRT(31,246,0x10), XRT_MASK, POWER7, PPCNONE, {RA0, RB}}, + {"dcbtst", X(31,246), X_MASK, POWER4, PPCNONE, {RA0, RB, CT}}, + {"dcbtst", X(31,246), X_MASK, PPC|PPCVLE, POWER4, {CT, RA0, RB}}, +@@ -4608,6 +4738,8 @@ + + {"mfapidi", X(31,275), X_MASK, BOOKE, TITAN, {RT, RA}}, + ++{"lqarx", X(31,276), XEH_MASK, POWER8, PPCNONE, {RTQ, RAX, RBX, EH}}, ++ + {"lscbx", XRC(31,277,0), X_MASK, M601, PPCNONE, {RT, RA, RB}}, + {"lscbx.", XRC(31,277,1), X_MASK, M601, PPCNONE, {RT, RA, RB}}, + +@@ -4629,6 +4761,8 @@ + {"lvexhx", X(31,293), X_MASK, PPCVEC2, PPCNONE, {VD, RA0, RB}}, + {"lvepx", X(31,295), X_MASK, PPCVEC2|PPCVLE, PPCNONE, {VD, RA0, RB}}, + ++{"mfbhrbe", X(31,302), X_MASK, POWER8, PPCNONE, {RT, BHRBE}}, ++ + {"tlbie", X(31,306), XRTLRA_MASK, PPC, TITAN, {RB, L}}, + {"tlbi", X(31,306), XRT_MASK, POWER, PPCNONE, {RA0, RB}}, + +@@ -4937,6 +5071,8 @@ + + {"slbmte", X(31,402), XRA_MASK, PPC64, PPCNONE, {RS, RB}}, + ++{"pbt.", XRC(31,404,1), X_MASK, POWER8, PPCNONE, {RS, RA0, RB}}, ++ + {"icswx", XRC(31,406,0), X_MASK, POWER7|PPCA2, PPCNONE, {RS, RA, RB}}, + {"icswx.", XRC(31,406,1), X_MASK, POWER7|PPCA2, PPCNONE, {RS, RA, RB}}, + +@@ -4958,6 +5094,8 @@ + {"divwe", XO(31,427,0,0), XO_MASK, POWER7|PPCA2, PPCNONE, {RT, RA, RB}}, + {"divwe.", XO(31,427,0,1), XO_MASK, POWER7|PPCA2, PPCNONE, {RT, RA, RB}}, + ++{"clrbhrb", X(31,430), 0xffffffff, POWER8, PPCNONE, {0}}, ++ + {"slbie", X(31,434), XRTRA_MASK, PPC64, PPCNONE, {RB}}, + + {"ecowx", X(31,438), X_MASK, PPC, TITAN, {RT, RA0, RB}}, +@@ -5246,6 +5384,8 @@ + {"addco.", XO(31,10,1,1), XO_MASK, PPCCOM|PPCVLE, PPCNONE, {RT, RA, RB}}, + {"ao.", XO(31,10,1,1), XO_MASK, PWRCOM, PPCNONE, {RT, RA, RB}}, + ++{"lxsspx", X(31,524), XX1_MASK, PPCVSX2, PPCNONE, {XT6, RA0, RB}}, ++ + {"clcs", X(31,531), XRB_MASK, M601, PPCNONE, {RT, RA}}, + + {"ldbrx", X(31,532), X_MASK, CELL|POWER7|PPCA2, PPCNONE, {RT, RA0, RB}}, +@@ -5340,6 +5480,8 @@ + {"stvlx", X(31,647), X_MASK, CELL, PPCNONE, {VS, RA0, RB}}, + {"stbfcmux", APU(31,647,0), APU_MASK, PPC405, PPCNONE, {FCRT, RA, RB}}, + ++{"stxsspx", X(31,652), XX1_MASK, PPCVSX2, PPCNONE, {XS6, RA0, RB}}, ++ + {"tbegin.", XRC(31,654,1), XRTLRARB_MASK,PPCHTM, PPCNONE, {HTM_R}}, + + {"subfeo", XO(31,136,1,0), XO_MASK, PPCCOM|PPCVLE, PPCNONE, {RT, RA, RB}}, +@@ -5525,6 +5667,7 @@ + {"divo.", XO(31,331,1,1), XO_MASK, M601, PPCNONE, {RT, RA, RB}}, + + {"lxvd2x", X(31,844), XX1_MASK, PPCVSX, PPCNONE, {XT6, RA0, RB}}, ++{"lxvx", X(31,844), XX1_MASK, PPCVSX, PPCNONE, {XT6, RA0, RB}}, + + {"tabortwci.", XRC(31,846,1), X_MASK, PPCHTM, PPCNONE, {TO, RA, HTM_SI}}, + +@@ -5636,6 +5779,7 @@ + {"divwuo.", XO(31,459,1,1), XO_MASK, PPC|PPCVLE, PPCNONE, {RT, RA, RB}}, + + {"stxvd2x", X(31,972), XX1_MASK, PPCVSX, PPCNONE, {XS6, RA0, RB}}, ++{"stxvx", X(31,972), XX1_MASK, PPCVSX, PPCNONE, {XS6, RA0, RB}}, + + {"tlbld", X(31,978), XRTRA_MASK, PPC, PPC403|BOOKE|PPCA2|PPC476, {RB}}, + {"tlbwehi", XTLB(31,978,0), XTLB_MASK, PPC403, PPCNONE, {RT, RA}}, +@@ -5868,14 +6012,25 @@ + {"fcfidus", XRC(59,974,0), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + {"fcfidus.", XRC(59,974,1), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + ++{"xsaddsp", XX3(60,0), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, ++{"xsmaddasp", XX3(60,1), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xxsldwi", XX3(60,2), XX3SHW_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6, SHW}}, + {"xxsel", XX4(60,3), XX4_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6, XC6}}, ++{"xssubsp", XX3(60,8), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, ++{"xsmaddmsp", XX3(60,9), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xxspltd", XX3(60,10), XX3DM_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6S, DMEX}}, + {"xxmrghd", XX3(60,10), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xxswapd", XX3(60,10)|(2<<8), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6S}}, + {"xxmrgld", XX3(60,10)|(3<<8), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xxpermdi", XX3(60,10), XX3DM_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6, DM}}, ++{"xsrsqrtesp", XX2(60,10), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, ++{"xssqrtsp", XX2(60,11), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, ++{"xsmulsp", XX3(60,16), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, ++{"xsmsubasp", XX3(60,17), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xxmrghw", XX3(60,18), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, ++{"xsdivsp", XX3(60,24), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, ++{"xsmsubmsp", XX3(60,25), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, ++{"xsresp", XX2(60,26), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, + {"xsadddp", XX3(60,32), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xsmaddadp", XX3(60,33), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xscmpudp", XX3(60,35), XX3BF_MASK, PPCVSX, PPCNONE, {BF, XA6, XB6}}, +@@ -5929,14 +6084,18 @@ + {"xvmsubmdp", XX3(60,121), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xsrdpim", XX2(60,121), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xvtdivdp", XX3(60,125), XX3BF_MASK, PPCVSX, PPCNONE, {BF, XA6, XB6}}, ++{"xsnmaddasp", XX3(60,129), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xxland", XX3(60,130), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvcvspuxws", XX2(60,136), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xsnmaddmsp", XX3(60,137), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xvrspi", XX2(60,137), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xxlandc", XX3(60,138), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvrsqrtesp", XX2(60,138), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xvsqrtsp", XX2(60,139), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xsnmsubasp", XX3(60,145), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xxlor", XX3(60,146), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvcvspsxws", XX2(60,152), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xsnmsubmsp", XX3(60,153), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xvrspiz", XX2(60,153), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xxlxor", XX3(60,154), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvresp", XX2(60,154), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, +@@ -5949,12 +6108,15 @@ + {"xsnmaddmdp", XX3(60,169), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvrspip", XX2(60,169), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xvtsqrtsp", XX2(60,170), XX2BF_MASK, PPCVSX, PPCNONE, {BF, XB6}}, ++{"xxlorc", XX3(60,170), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xvrspic", XX2(60,171), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xscpsgndp", XX3(60,176), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xsnmsubadp", XX3(60,177), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, ++{"xxlnand", XX3(60,178), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xvcvsxwsp", XX2(60,184), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xsnmsubmdp", XX3(60,185), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvrspim", XX2(60,185), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xxleqv", XX3(60,186), XX3_MASK, PPCVSX2, PPCNONE, {XT6, XA6, XB6}}, + {"xvmaxsp", XX3(60,192), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvnmaddasp", XX3(60,193), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvminsp", XX3(60,200), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, +@@ -5985,8 +6147,13 @@ + {"xvnmsubmdp", XX3(60,249), XX3_MASK, PPCVSX, PPCNONE, {XT6, XA6, XB6}}, + {"xvrdpim", XX2(60,249), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xscvdpsp", XX2(60,265), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xscvdpspn", XX2(60,267), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, ++{"xsrsp", XX2(60,281), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, ++{"xscvuxdsp", XX2(60,296), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, ++{"xscvsxdsp", XX2(60,312), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, + {"xscvdpuxds", XX2(60,328), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xscvspdp", XX2(60,329), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, ++{"xscvspdpn", XX2(60,331), XX2_MASK, PPCVSX2, PPCNONE, {XT6, XB6}}, + {"xscvdpsxds", XX2(60,344), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xsabsdp", XX2(60,345), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, + {"xscvuxddp", XX2(60,360), XX2_MASK, PPCVSX, PPCNONE, {XT6, XB6}}, +@@ -6222,6 +6389,8 @@ + {"denbcdq", XRC(63,834,0), X_MASK, POWER6, PPCNONE, {S, FRTp, FRBp}}, + {"denbcdq.", XRC(63,834,1), X_MASK, POWER6, PPCNONE, {S, FRTp, FRBp}}, + ++{"fmrgow", X(63,838), X_MASK, PPCVSX2, PPCNONE, {FRT, FRA, FRB}}, ++ + {"fcfid", XRC(63,846,0), XRA_MASK, PPC64, PPCNONE, {FRT, FRB}}, + {"fcfid", XRC(63,846,0), XRA_MASK, PPC476, PPCNONE, {FRT, FRB}}, + {"fcfid.", XRC(63,846,1), XRA_MASK, PPC64, PPCNONE, {FRT, FRB}}, +@@ -6236,6 +6405,8 @@ + {"fctiduz", XRC(63,943,0), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + {"fctiduz.", XRC(63,943,1), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + ++{"fmrgew", X(63,966), X_MASK, PPCVSX2, PPCNONE, {FRT, FRA, FRB}}, ++ + {"fcfidu", XRC(63,974,0), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + {"fcfidu.", XRC(63,974,1), XRA_MASK, POWER7|PPCA2, PPCNONE, {FRT, FRB}}, + }; diff --git a/SOURCES/gdb-power8-2of2.patch b/SOURCES/gdb-power8-2of2.patch new file mode 100644 index 0000000..af16f9f --- /dev/null +++ b/SOURCES/gdb-power8-2of2.patch @@ -0,0 +1,60 @@ +[PATCH] Enable hw watchpoint with longer ranges using DAWR on Power +http://sourceware.org/ml/gdb-patches/2013-07/msg00085.html +http://sourceware.org/ml/gdb-cvs/2013-07/msg00097.html + +### src/gdb/ChangeLog 2013/07/22 11:42:30 1.15812 +### src/gdb/ChangeLog 2013/07/22 13:17:51 1.15813 +## -1,3 +1,9 @@ ++2013-07-22 Edjunior Barbosa Machado ++ ++ * ppc-linux-nat.c (PPC_DEBUG_FEATURE_DATA_BP_DAWR): New define. ++ (ppc_linux_region_ok_for_hw_watchpoint): Add checking to use the new ++ DAWR interface for longer ranges hardware watchpoint (up to 512 bytes). ++ + 2013-07-22 Phil Muldoon + + * top.c (print_gdb_version): Add help, apropos description and +--- gdb-7.6/gdb/ppc-linux-nat.c.orig 2013-07-24 17:39:30.434549279 +0200 ++++ gdb-7.6/gdb/ppc-linux-nat.c 2013-07-24 17:41:31.337706502 +0200 +@@ -178,7 +178,11 @@ struct ppc_hw_breakpoint + (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT)) + #endif /* PPC_PTRACE_GETHWDBGINFO */ + +- ++/* Feature defined on Linux kernel v3.9: DAWR interface, that enables wider ++ watchpoint (up to 512 bytes). */ ++#ifndef PPC_DEBUG_FEATURE_DATA_BP_DAWR ++#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10 ++#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */ + + /* Similarly for the general-purpose (gp0 -- gp31) + and floating-point registers (fp0 -- fp31). */ +@@ -1503,6 +1507,7 @@ ppc_linux_region_ok_for_hw_watchpoint (C + to determine the hardcoded watchable region for watchpoints. */ + if (have_ptrace_booke_interface ()) + { ++ int region_size; + /* Embedded DAC-based processors, like the PowerPC 440 have ranged + watchpoints and can watch any access within an arbitrary memory + region. This is useful to watch arrays and structs, for instance. It +@@ -1511,11 +1516,17 @@ ppc_linux_region_ok_for_hw_watchpoint (C + && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE + && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) + return 2; ++ /* Check if the processor provides DAWR interface. */ ++ if (booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR) ++ /* DAWR interface allows to watch up to 512 byte wide ranges which ++ can't cross a 512 byte boundary. */ ++ region_size = 512; ++ else ++ region_size = booke_debug_info.data_bp_alignment; + /* Server processors provide one hardware watchpoint and addr+len should + fall in the watchable region provided by the ptrace interface. */ +- if (booke_debug_info.data_bp_alignment +- && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) +- + booke_debug_info.data_bp_alignment)) ++ if (region_size ++ && (addr + len > (addr & ~(region_size - 1)) + region_size)) + return 0; + } + /* addr+len must fall in the 8 byte watchable region for DABR-based diff --git a/SOURCES/gdb-ppc-power7-test.patch b/SOURCES/gdb-ppc-power7-test.patch new file mode 100644 index 0000000..4d4772a --- /dev/null +++ b/SOURCES/gdb-ppc-power7-test.patch @@ -0,0 +1,295 @@ +--- /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/SOURCES/gdb-psymtab-expand.patch b/SOURCES/gdb-psymtab-expand.patch new file mode 100644 index 0000000..9792e48 --- /dev/null +++ b/SOURCES/gdb-psymtab-expand.patch @@ -0,0 +1,62 @@ +http://sourceware.org/ml/gdb-patches/2013-05/msg00300.html +Subject: [RFA] Fix file name matching in expand_symtabs_matching_via_partial + +[blech, apologies for the resend, typo in address] + +Hi. +I noticed this while playing with my new "mt expand-symtabs" command +and watching "mt set per on" output. + +The test here is wrong. +ref: http://sourceware.org/ml/gdb-patches/2013-02/msg00063.html + +The test + (basenames_may_differ + || (*file_matcher) (lbasename (ps->filename), data, 1)) +fails and the code falls through assuming the file name matched. + +Regression tested on amd64-linux. + +Ok to check in? +Ok for 7.6 branch too? + +2013-05-08 Doug Evans + + * psymtab.c (expand_symtabs_matching_via_partial): Fix file name + matching test. + +Index: psymtab.c +=================================================================== +RCS file: /cvs/src/src/gdb/psymtab.c,v +retrieving revision 1.74 +diff -u -p -r1.74 psymtab.c +--- ./gdb/psymtab.c 6 May 2013 19:15:17 -0000 1.74 ++++ ./gdb/psymtab.c 8 May 2013 19:18:51 -0000 +@@ -1400,15 +1405,21 @@ expand_symtabs_matching_via_partial + + if (file_matcher) + { ++ int match; ++ + if (ps->anonymous) + continue; + +- /* Before we invoke realpath, which can get expensive when many +- files are involved, do a quick comparison of the basenames. */ +- if (!(*file_matcher) (ps->filename, data, 0) +- && (basenames_may_differ ++ match = (*file_matcher) (ps->filename, data, 0); ++ if (! match) ++ { ++ /* Before we invoke realpath, which can get expensive when many ++ files are involved, do a quick comparison of the basenames. */ ++ if (basenames_may_differ + || (*file_matcher) (lbasename (ps->filename), data, 1)) +- && !(*file_matcher) (psymtab_to_fullname (ps), data, 0)) ++ match = (*file_matcher) (psymtab_to_fullname (ps), data, 0); ++ } ++ if (! match) + continue; + } + + diff --git a/SOURCES/gdb-readline62-ask-more-rh.patch b/SOURCES/gdb-readline62-ask-more-rh.patch new file mode 100644 index 0000000..6f110be --- /dev/null +++ b/SOURCES/gdb-readline62-ask-more-rh.patch @@ -0,0 +1,14 @@ +--- gdb-7.4.50.20120103-orig/gdb/event-top.c 2012-01-11 15:14:01.426206439 +0100 ++++ gdb-7.4.50.20120103/gdb/event-top.c 2012-01-11 15:18:29.766577551 +0100 +@@ -982,6 +982,11 @@ set_async_editing_command (char *args, i + void + gdb_setup_readline (void) + { ++ /* 6.2 regression: no longed asks for --more-- ++ gdb.base/readline-ask.exp ++ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */ ++ RL_SETSTATE (RL_STATE_FEDORA_GDB); ++ + /* This function is a noop for the sync case. The assumption is + that the sync setup is ALL done in gdb_init, and we would only + mess it up here. The sync stuff should really go away over diff --git a/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch new file mode 100644 index 0000000..446709d --- /dev/null +++ b/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -0,0 +1,75 @@ +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/SOURCES/gdb-rhbz1013453-value-struct-elt-memory-leak.patch b/SOURCES/gdb-rhbz1013453-value-struct-elt-memory-leak.patch new file mode 100644 index 0000000..295e2d7 --- /dev/null +++ b/SOURCES/gdb-rhbz1013453-value-struct-elt-memory-leak.patch @@ -0,0 +1,136 @@ +https://sourceware.org/ml/gdb-patches/2013-07/msg00469.html + +Hi. +This patch adds the missing calls to check_typedef +and adds a testcase to show the issue. + +The PR is not closeable yet, but the remaining issues are more cleanups +than actual bug fixes. + +Regression tested on amd64-linux. + +I will check this in in a few days if there are no objections. + +[The multiple calls to check_typedef (value_type (*argp)) are +bothersome, but the code is simpler this way, and I expect +resolving the rest of the issues in 15695 to potentially change this +code significantly.] + +--- + +commit cbb25189b69e501ddca64917d810b54bb1466c93 +Author: Doug Evans +Date: Thu Aug 1 23:59:47 2013 +0000 + + PR symtab/15695 + * valops.c (value_struct_elt): Add missing call to check_typedef. + (value_find_oload_method_list): Ditto. + + testsuite/ + * gdb.base/func-ptr.exp: New file. + * gdb.base/func-ptr.c: New file. + +2013-08-01 Doug Evans + + PR symtab/15695 + * valops.c (value_struct_elt): Add missing call to check_typedef. + (value_find_oload_method_list): Ditto. + +2013-08-01 Doug Evans + + PR symtab/15695 + * gdb.base/func-ptr.exp: New file. + * gdb.base/func-ptr.c: New file. + +Index: gdb-7.6.1/gdb/testsuite/gdb.base/func-ptr.c +=================================================================== +--- /dev/null ++++ gdb-7.6.1/gdb/testsuite/gdb.base/func-ptr.c +@@ -0,0 +1,30 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 ++bar () ++{ ++} ++ ++typedef void foo (void); ++foo *pbar = bar; ++ ++int ++main () ++{ ++ return 0; ++} +Index: gdb-7.6.1/gdb/testsuite/gdb.base/func-ptr.exp +=================================================================== +--- /dev/null ++++ gdb-7.6.1/gdb/testsuite/gdb.base/func-ptr.exp +@@ -0,0 +1,30 @@ ++# Copyright 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 testcase exercises bug 15695. ++# Trying to print foo->bar if foo is a pointer to a typedef of a pointer ++# to a function will put gdb into an infinite loop. ++ ++if { [prepare_for_testing func-ptr.exp "func-ptr" {func-ptr.c} {debug}] } { ++ return -1 ++} ++ ++if ![runto_main] { ++ fail "Can't run to main" ++ return 0 ++} ++ ++# This would put gdb into an infinite loop. ++gdb_test "print pbar->baz" "Attempt to extract .*" +Index: gdb-7.6.1/gdb/valops.c +=================================================================== +--- gdb-7.6.1.orig/gdb/valops.c ++++ gdb-7.6.1/gdb/valops.c +@@ -2450,7 +2450,7 @@ value_struct_elt (struct value **argp, s + { + *argp = value_ind (*argp); + /* Don't coerce fn pointer to fn and then back again! */ +- if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC) ++ if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC) + *argp = coerce_array (*argp); + t = check_typedef (value_type (*argp)); + } +@@ -2614,7 +2614,7 @@ value_find_oload_method_list (struct val + { + *argp = value_ind (*argp); + /* Don't coerce fn pointer to fn and then back again! */ +- if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC) ++ if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC) + *argp = coerce_array (*argp); + t = check_typedef (value_type (*argp)); + } diff --git a/SOURCES/gdb-rhbz795424-bitpos-20of25.patch b/SOURCES/gdb-rhbz795424-bitpos-20of25.patch new file mode 100644 index 0000000..8390083 --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-20of25.patch @@ -0,0 +1,4492 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00631.html +Subject: [PATCH 1/4] Expand bitpos and type.length to LONGEST and ULONGEST + + +--MP_/yp5f+W_ED2JtUlSyBi8xujr +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +This is patch 1/4, which implements the bulk of the changes in type +length and bitpos/type offset. I have verified that there are no +regressions resulting from this patch by running the testsuite on +Fedora 16 x86_64. Patch and changelog attached. + +Regards, +Siddhesh + +--MP_/yp5f+W_ED2JtUlSyBi8xujr +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; filename=ChangeLog-main + +gdb/ChangeLog + +2012-08-05 Siddhesh Poyarekar + + * ada-lang.c (fat_pntr_bounds_bitpos): Return LONGEST. + (fat_pntr_data_bitpos): Likewise. + (desc_bound_bitpos): Likewise. + (constrained_packed_array_type): Expand ELT_BITS parameter to + LONGEST. + (move_bits): Expand parameters SRC_OFFSET and N to LONGEST. + (cond_offset_host): Expand parameter OFFSET to LONGEST. + (cond_offset_target): Likewise. + (ada_type_of_array): Expand ARRAY_BITSIZE to LONGEST. + (decode_constrained_packed_array_type): Expand BITS to LONGEST. + (decode_constrained_packed_array): Expand BIT_POS to LONGEST. + (ada_value_primitive_packed_val): Expand parameter OFFSET to + LONGEST. Expand TARG, NTARG and NEW_OFFSET to LONGEST. + (ada_value_assign): Expand FROM_SIZE to LONGEST. + (value_assign_to_component): Expand BITS to LONGEST. + (ensure_lval): Expand LEN to LONGEST. + (value_pointer): Expand LEN to ULONGEST. + (value_tag_from_contents_and_address): Expand TAG_BYTE_OFFSET to + LONGEST. + (ada_value_primitive_field): Expand parameter OFFSET to LONGEST. + Expand bit_pos to LONGEST. + (find_struct_field): Expand parameters OFFSET and BYTE_OFFSET_P to + LONGEST. Expand BIT_POS and FLD_OFFSET to LONGEST. + (ada_search_struct_field): Expand parameter OFFSET to LONGEST. + Expand VAR_OFFSET to LONGEST. + (ada_index_struct_field): Expand parameters INDEX and OFFSET to + LONGEST. + (ada_index_struct_field_1): Expand parameters INDEX_P and OFFSET + to LONGEST. + (ada_value_struct_elt): Expand BYTE_OFFSET to LONGEST. + (align_value): Return ULONGEST. Expand parameter OFF and + ALIGNMENT to ULONGEST. + (ada_template_to_fixed_record_type_1): Expand OFF, BIT_LEN and + fld_bit_len to LONGEST. Expand FIELD_OFFSET to LONGEST. Use + pulongest function to print TYPE_LENGTH. + (to_fixed_array_type): Expand LEN to LONGEST. + * ada-lang.h (ada_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (ada_printstr): Expand parameter LENGTH to ULONGEST. + (ada_value_primitive_packed_val): Expand parameter OFFSET to + LONGEST. + * ada-typeprint.c (ada_print_type): Use pulongest to print + TYPE_LENGTH. + * ada-valprint.c (val_print_packed_array_elements): Expand ELTLEN + to ULONGEST. + (char_at): Expand parameter I to LONGEST. + (printstr): Expand parameter LENGTH, I, REP1, REPS to ULONGEST. + Use pulongest to format print REPS. + (ada_printstr): Expand parameter LENGTH to LONGEST. + (ada_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + (ada_val_print_array): Expand ELTLEN, LEN to ULONGEST and TEMP_LEN + to LONGEST. + (ada_val_print_1): Expand parameter OFFSET to LONGEST. + (print_variant_part): Expand parameters OFFSET and OUTER_OFFSET to + LONGEST. + (print_field_values): Likewise. Expand BIT_POS to LONGEST. + * annotate.c (annotate_array_section_begin): Expand parameter + IDX to LONGEST. Use plongest to format-print IDX. + (annotate_elt_rep): Expand parameter REPCOUNT to ULONGEST. Use + plongest to format-print REPCOUNT. + * annotate.h: Likewise. + * arm-linux-nat.c (arm_linux_region_ok_for_hw_watchpoint): + Expand parameter parameter LEN to LONGEST. + * ax-gdb.c (gen_left_shift): Expand parameter DISTANCE to LONGEST. + (gen_offset): Expand parameter OFFSET to LONGEST. + (gen_bitfield_ref): Expand parameters START, END to LONGEST. + Expand BOUND_START, BOUND_END, OFFSET to LONGEST. + (gen_primitive_field): Expand parameter OFFSET to LONGEST. + (gen_struct_ref_recursive): Likewise. + * ax-general.c (ax_trace_quick): Expand parameter N to LONGEST. + * ax.h (ax_trace_quick): Likewise. + * breakpoint.c (breakpoint_address_match_range): Expand parameter + LEN1 to LONGEST. + (can_use_hardware_watchpoint): Expand LEN to LONGEST. + * breakpoint.h (struct bp_target_info): Expand member LENGTH to + LONGEST. + (struct bp_location): Likewise. + * c-lang.c (c_printstr): Expand parameter LENGTH to ULONGEST. + (evaluate_subexp_c): Expand ELEMENT_SIZE, I to LONGEST. + * c-lang.h (c_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (c_printstr): Expand parameter LENGTH to ULONGEST. + (cp_print_value_fields): Expand parameter OFFSET to LONGEST. + (cp_print_value_fields_rtti): Likewise. + * c-typeprint.c (c_type_print_varspec_suffix): Remove cast down to + int and use plongest to print LONGEST. + * c-valprint.c (c_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. Expand OFFSET to LONGEST, ELTLEN to ULONGEST. + (c_value_print): Expand TOP to LONGEST. + * cp-abi.c (baseclass_offset): Return LONGEST. Expand parameter + EMBEDDED_OFFSET to LONGEST. Expand RES to LONGEST. + (value_virtual_fn_field): Expand parameter OFFSET to LONGEST. + (value_rtti_type): Expand parameter TOP to point to LONGEST. + * cp-abi.h (value_virtual_fn_field): Expand OFFSET to LONGEST. + (value_rtti_type): Expand TOP to point to LONGEST. + (baseclass_offset): Return LONGEST. Expand parameter + EMBEDDED_OFFSET to LONGEST. + (struct cp_abi_ops): Expand parameter OFFSET for VIRTUAL_FN_FIELD + to LONGEST. Expand parameter TOP to point to LONGEST in + VALUE_RTTI_TYPE. Return LONGEST from BASECLASS_OFFSET and expand + parameter EMBEDDED_OFFSET to LONGEST. + * cp-valprint.c (cp_print_value_fields): Expand parameter OFFSET + to LONGEST. Expand I_OFFSET to LONGEST. + (cp_print_value_fields_rtti): Expand parameter OFFSET to + LONGEST. Expand TOP to LONGEST. + (cp_print_value): Expand parameter OFFSET to LONGEST. Expand + THISOFFSET, BOFFSET to LONGEST. + * d-lang.h (d_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + * d-valprint.c (dynamic_array_type): Likewise. + (d_val_print): Likewise. + * doublest.c (floatformat_from_length): Expand parameter LEN to + LONGEST. Use plongest to format string for LONGEST. + * dwarf2loc.c (copy_bitwise): Expand parameters DEST_OFFSET_BITS, + BIT_COUNT to ULONGEST. Rename parameter SOURCE_OFFSET_BITS to + SOURCE_OFFSET and expand to ULONGEST. New variable + SOURCE_OFFSET_BITS. + (read_pieced_value): Expand OFFSET, DEST_OFFSET_BITS, + SOURCE_OFFSET_BITS, SOURCE_OFFSET to LONGEST. Expand TYPE_LEN, + THIS_SIZE, THIS_SIZE_BITS to ULONGEST. + (write_pieced_value): Likewise. + (check_pieced_value_bits): Expand parameters BIT_OFFSET and + BIT_LENGTH to LONGEST. Expand THIS_SIZE_BITS to ULONGEST. + (check_pieced_value_validity): Expand parameters BIT_OFFSET and + BIT_LENGTH to LONGEST. + (check_pieced_synthetic_pointer): Likewise. + (indirect_pieced_value): Expand BIT_LENGTH, BYTE_OFFSET and + BIT_OFFSET to LONGEST. + (dwarf2_evaluate_loc_desc_full): Expand N to ULONGEST. + * dwarf2read.c (dwarf2_const_value_length_mismatch_complaint): + Expand parameters ARG2 and ARG3 to LONGEST. Use plongest to + print ARG2 and ARG3. + (dwarf2_add_field): Expand ANONYMOUS_SIZE, BIT_OFFSET to + LONGEST. + * eval.c (evaluate_struct_tuple): Expand BITPOS to LONGEST. + (init_array_element): Expand ELEMENT_SIZE to LONGEST. + (binop_promote): Expand PROMOTED_LEN1, PROMOTED_LEN2, RESULT_LEN + to ULONGEST. + (evaluate_subexp_standard): Expand MEM_OFFSET, TOP, ELEMENT_SIZE + to LONGEST. + * f-lang.c (f_printstr): Expand parameter LENGTH to ULONGEST. + * f-lang.h (f_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + * f-valprint.c (f77_array_offset_tbl): Make LONGEST. + (f77_create_arrayprint_offset_tbl): Expand ELTLEN to LONGEST. + (f77_print_array_1): Expand parameter EMBEDDED_OFFSET to + LONGEST. Expand I to LONGEST. + (f77_print_array): Expand parameter EMBEDDED_OFFSET to LONGEST. + (f_val_print): Likewise. Expand OFFSET to LONGEST. + * findvar.c (default_value_from_register): Expand LEN to LONGEST. + (read_frame_register_value): Expand OFFSET, REG_OFFSET, LEN, + REG_LEN to LONGEST. + * frame.c (get_frame_register_bytes): Expand parameter LEN to + LONGEST. + * frame.h (get_frame_register_bytes): Likewise. + * gdbtypes.c (init_type): Expand parameter LENGTH to LONGEST. + (is_unique_ancestor_worker): Expand parameters OFFSET, + EMBEDDED_OFFSET to LONGEST. Expand THIS_OFFSET to LONGEST. + (is_unique_ancestor): Expand OFFSET to LONGEST. + (recursive_dump_type): Use pulongest to format print TYPE_LENGTH. + Use plongest to format print TYPE_FIELD_BITPOS. + (arch_type): Expand parameter LENGTH to LONGEST. + * gdbtypes.h (struct type.main_type.fld_bnds.fields): Expand + member BITPOS to LONGEST. + (struct type): Expand member LENGTH to ULONGEST. + (init_type): Expand parameter LENGTH to LONGEST. + (arch_type): Likewise. + * gnu-v2-abi.c (gnuv2_virtual_fn_field): Expand parameter OFFSET + to LONGEST. + (gnuv2_value_rtti_type): Expand parameter TOP to point to LONGEST. + (gnuv2_baseclass_offset): Return LONGEST. Expand parameter + EMBEDDED_OFFSET to LONGEST. Expand FIELD_OFFSET, BOFFSET, + FIELD_LENGTH to LONGEST. + * gnu-v3-abi.c (build_gdb_vtable_type): Expand OFFSET to LONGEST. + (vtable_address_point_offset): Return LONGEST. + (gnuv3_rtti_type): Expand parameter TOP_P to point to LONGEST. + (gnuv3_virtual_fn_field): Expand parameter OFFSET to LONGEST. + (gnuv3_baseclass_offset): Return LONGEST. Expand parameter + EMBEDDED_OFSET to LONGEST. Expand CUR_BASE_OFFSET, BASE_OFFSET to + LONGEST. + (gnuv3_find_method_in): Expand POS to LONGEST. + * go-lang.h (go_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + * go-valprint.c (print_go_string): Likewise. + (go_val_print): Likewise. + * i386-nat.c (i386_handle_nonaligned_watchpoint): Expand + parameter LEN to LONGEST. + (i386_region_ok_for_watchpoint): Likewise. + * inf-ttrace.c (inf_ttrace_region_ok_for_hw_watchpoint): Expand + parameter LEN to LONGEST. + * jv-lang.c (java_link_class_type): Expand BOFFSET to LONGEST. + (java_printstr): Expand parameter LENGTH to ULONGEST. + * jv-lang.h (java_val_print): Expand parameter EMBEDDED_OFFSET to + LONGEST. + * jv-valprint.c (java_print_value_fields): Expand parameter OFFSET + to LONGEST. + (java_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + * language.c (unk_lang_printstr): Expand parameter LENGTH to + ULONGEST. + (unk_lang_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + * language.h (language_defn): Expand parameter LENGTH of + LA_PRINTSTR to ULONGEST. Expand parameter EMBEDDED_OFFSET of + LA_VAL_PRINT to LONGEST. + * m2-lang.c (m2_printstr): Expand parameter LENGTH to ULONGEST. + Expand I, REP1, REPS to ULONGEST. Use pulongest to format print + REPS. + * m2-lang.h (m2_val_print): Expand parameter embedded_offset to + LONGEST. + * m2-typeprint.c (m2_array): New variable VAL. Use pulongest to + * format print VAL. + (m2_enum): expand LASTVAL to LONGEST. + * m2-valprint.c (m2_print_long_set): Expand parameter + EMBEDDED_OFFSET to LONGEST. + (m2_print_unbounded_array): Likewise. + (m2_print_array_contents): Likewise. + (m2_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + Expand I, LEN, TEMP_LEN to ULONGEST. + * memrange.c (mem_ranges_overlap): Expand parameters LEN1, LEN2 to + LONGEST. + * memrange.h (struct mem_range): Expand member LENGTH to LONGEST. + (mem_ranges_overlap): Expand parameters LEN1, LEN2 to LONGEST. + * mips-linux-nat.c (mips_linux_region_ok_for_hw_watchpoint): + Expand parameter LEN to LONGEST. + * objc-lang.c (objc_printstr): Expand parameter LENGTH to + ULONGEST. Expand I, REP1, REPS to ULONGEST. use pulongest to + format print REPS. + * opencl-lang.c (lookup_opencl_vector_type): Expand parameter + EL_LENGTH to ULONGEST. Expand LENGTH to ULONGEST. + (lval_func_read): Expand OFFSET, N, I, J and ELSIZE to LONGEST. + (lval_func_write): Likewise. + (lval_func_check_validity): Expand parameter LENGTH to LONGEST. + Expand ELSIZE, START, END, I, STARTREST, ENDREST, COMP_OFFSET, + COMP_LENGTH to LONGEST. + (lval_func_check_any_valid): Expand ELSIZE to LONGEST. + (lval_func_check_synthetic_pointer): Expand parameters OFFSET and + LENGTH to LONGEST. Expand ELSIZE, START, END, I, STARTREST, + ENDREST, COMP_LENGTH, COMP_OFFSET to LONGEST. + * p-lang.c (is_pascal_string_type): Expand parameters LENGTH_POS, + STRING_POS, LENGTH_SIZE to point to LONGEST. + (pascal_printstr): Expand parameter LENGTH to ULONGEST. Expand + I, REP1, REPS to ULONGEST. Use pulongest to format print REPS. + * p-lang.h (pascal_val_print): Expand parameter EMBEDDED_OFFSET + to LONGEST. + (is_pascal_string_type): Expand parameters LENGTH_POS, STRING_POS, + LENGTH_SIZE to point to LONGEST. + (pascal_printstr): Expand parameter LENGTH to ULONGEST. + (pascal_object_print_value_fields): Expand parameter OFFSET to + LONGEST. + * p-valprint.c (pascal_val_print): Expand parameter + EMBEDDED_OFFSET to LONGEST. Expand ELTLEN to ULONGEST. Expand + LENGTH_SIZE, LENGTH_POS, STRING_POS to LONGEST. + (pascal_object_print_value_fields): Expand parameter OFFSET to + LONGEST. + (pascal_object_print_value): Likewise. Expand BOFFSET, + THISOFFSET to LONGEST. + * ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): + Expand parameter LEN to point to LONGEST. + * printcmd.c (print_formatted): Expand LEN to LONGEST. + (print_scalar_formatted): Likewise. + * procfs.c (procfs_region_ok_for_hw_watchpoint): Expand + parameter LEN to LONGEST. + * python/py-prettyprint.c (apply_val_pretty_printer): Expand + parameter EMBEDDED_OFFSET to LONGEST. + * python/python.h (apply_val_pretty_printer): Likewise. + * regcache.c (regcache_xfer_part): Expand parameter OFFSET to + LONGEST. + (regcache_raw_read_part): Likewise. + (regcache_raw_write_part): Likewise. + (regcache_cooked_read_part): Likewise. + (regcache_cooked_write_part): Likewise. + * regcache.h (regcache_raw_read_part): Likewise. + (regcache_raw_write_part): Likewise. + (regcache_cooked_read_part): Likewise. + (regcache_cooked_write_part): Likewise. + * remote.c (remote_region_ok_for_hw_watchpoint): Expand + parameter LEN to LONGEST. + * s390-nat.c (s390_region_ok_for_hw_watchpoint): Expand + parameter LEN to LONGEST. + * spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Expand + parameter len to LONGEST. + * stack.c (print_frame_nameless_args): Expand parameter START to + LONGEST. + (print_frame_args): Expand HIGHEST_OFFSET, CURRENT_OFFSET, + ARG_SIZE, START to LONGEST. + * symmisc.c (print_symbol): Expand I to ULONGEST. Use pulongest + to format print TYPE_LENGTH. + * target.c (default_region_ok_for_hw_watchpoint): Expand parameter + LEN to LONGEST. + (debug_to_region_ok_for_hw_watchpoint): Likewise. + * target.h (struct target_ops): Expand parameter LEN to LONGEST + for TO_REGION_OK_FOR_HW_WATCHPOINT. + * tracepoint.c (add_memrange): Expand parameter LEN to LONGEST. + Use plongest to format print LEN. + (collect_symbol): Expand LEN to ULONGEST. Use pulongest to + format print LEN. + (scope_info): Expand J to LONGEST. Use pulongest to format + print TYPE_LENGTH. + * typeprint.c (whatis_exp): Expand TOP to LONGEST. + * valarith.c (value_subscripted_rvalue): Expand parameters INDEX + and LOWERBOUND to LONGEST. Expand ELT_SIZE, ELT_OFFS to ULONGEST. + (value_concat): expand INVAL1LEN and INVAL2LEN to ssize_t. + (value_logical_not): Expand LEN to LONGEST. + (value_strcmp): Expand LEN1, LEN2, I, LEN to LONGEST. + * valops.c (value_allocate_space_in_inferior): Expand parameter + LEN to LONGEST. + (value_cast_structs): Expand TOP to LONGEST. + (value_cast): Expand ELEMENT_LENGTH to ULONGEST. Expand + VAL_LENGTH to LONGEST. + (dynamic_cast_check_1): Expand parameter EMBEDDED_OFFSET to + LONGEST. Expand OFFSET to LONGEST. + (dynamic_cast_check_2): Likewise. + (value_dynamic_cast): Expand TOP to LONGEST. + (read_value_memory): Expand EMBEDDED_OFFSET to LONGEST. + (value_assign): Expand CHANGED_LEN, OFFSET to LONGEST. + (value_array): Expand TYPELENGTH to ULONGEST. + (update_search_result): Expand parameters LAST_BOFFSET, BOFFSET + to LONGEST. + (do_search_struct_field): Expand parameter OFFSET, LAST_BOFFSET + to LONGEST. Expand NEW_OFFSET, BOFFSET to LONGEST. + (search_struct_field): Expand parameter OFFSET to LONGEST. + Expand BOFFSET to LONGEST. + (search_struct_method): Expand parameter OFFSET to LONGEST. + Expand BASE_OFFSET, THIS_OFFSET to LONGEST. + (find_method_list): Expand parameters OFFSET, BOFFSET to + LONGEST. Expand BASE_OFFSET to LONGEST. + (value_find_oload_method_list): Expand parameter BOFFSET to point + to LONGEST. + (find_overload_match): Expand BOFFSET to LONGEST. + (value_struct_elt_for_reference): Expand parameter OFFSET to + LONGEST. Remove unneeded cast. Expand BASE_OFFSET to LONGEST. + (value_rtti_indirect_type): Expand parameter TOP to point to + LONGEST. + (value_full_object): Expand parameter XTOP to LONGEST. Expand + TOP to LONGEST. + * valprint.c (valprint_check_validity): Expand parameter + EMBEDDED_OFFSET to LONGEST. + (generic_val_print): Likewise. + (val_print): Likewise. + (val_print_scalar_formatted): Likewise. + (print_hex_chars): Expand parameter LEN to ULONGEST. + (val_print_array_elements): Expand parameter EMBEDDED_OFFSET to + LONGEST, I to ULONGEST. Expand LEN, ELTLEN, REP1, REPS to + ULONGEST. Use pulongest to format print REPS. + (generic_printstr): Expand parameter LENGTH to ULONGEST. + * valprint.h (val_print_array_elements): Expand parameter + EMBEDDED_OFFSET to LONGEST. + (val_print_scalar_formatted): Likewise. + (print_hex_chars): Expand parameter LEN to ULONGEST. + (generic_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + (generic_printstr): Expand parameter LENGTH to ULONGEST. + * value.c (struct range): Expand members OFFSET, LENGTH to + LONGEST. + (ranges_overlap): Expand parameters OFFSET1, OFFSET2, LEN1 AND + LEN2 to LONGEST. + (range_contain): Expand parameter OFFSET, LENGTH to LONGEST. + (struct value): Expand members OFFSET, EMBEDDED_OFFSET, + POINTED_TO_OFFSET to LONGEST. + (value_bytes_available): Expand parameters OFFSET, LENGTH to + LONGEST. + (mark_value_bytes_unavailable): Likewise. + (find_first_range_overlap): Likewise. + (value_available_contents_eq): Expand parameters OFFSET1, OFFSET2 + and LENGTH to LONGEST. + (value_offset): Return LONGEST. + (set_value_offset): Expand parameter OFFSET to LONGEST. + (value_contents_copy_raw): Expand parameters SRC_OFFSET, + DST_OFFSET, LENGTH to ssize_t. + (value_contents_copy): Likewise. + (value_bits_valid): Expand parameters OFFSET, LENGTH to LONGEST. + (value_bits_synthetic_pointer): Likewise. + (value_embedded_offset): Return LONGEST. + (set_value_embedded_offset): Expand parameter VAL to LONGEST. + (value_pointed_to_offset): Return LONGEST. + (set_value_pointed_to_offset): Expand parameter VAL to LONGEST. + (set_internalvar_component): Expand parameter OFFSET to LONGEST. + (value_primitive_field): Likewise. Expand BITPOS, BOFFSET, + CONTAINER_BITSIZE to LONGEST. + (value_fn_field): Expand parameter OFFSET to LONGEST. + (unpack_value_bits_as_long_1): Expand parameters EMBEDDED_OFFSET, + BITPOS to LONGEST. Expand READ_OFFSET to LONGEST. + (unpack_value_bits_as_long): Expand parameter EMBEDED_OFFSET to + LONGEST. + (unpack_value_field_as_long_1): Likewise. Expand BITPOS to + LONGEST. + (unpack_value_field_as_long): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (value_field_bitfield): Likewise. + (modify_field): Expand parameter BITPOS to LONGEST. Expand + BYTESIZE to LONGEST. + * value.h (value_offset): Return LONGEST. + (set_value_offset): Expand parameter OFFSET to LONGEST. + (value_pointed_to_offset): Return LONGEST. + (set_value_pointed_to_offset): Expand parameter VAL to LONGEST. + (value_embedded_offset): Return LONGEST. + (set_value_embedded_offset): Expand parameter VAL to LONGEST. + (struct lval_funcs): Expand parameters OFFSET and LENGTH to + LONGEST for CHECK_VALIDITY. Likewise for CHECK_SYNTHETIC_POINTER. + (valprint_check_validity): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (value_bits_valid): Expand parameters OFFSET, LENGTH to LONGEST. + (value_bits_synthetic_pointer): Likewise. + (value_bytes_available): Likewise. + (mark_value_bytes_unavailable): Likewise. + (value_available_contents_eq): Fix comment. Expand parameters + OFFSET1, OFFSET2, LENGTH to LONGEST. + (read_value_memory): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (unpack_value_bits_as_long): Expand parameter EMBEDDED_OFFSET to + LONGEST. + (unpack_value_field_as_long): Likewise. + (value_field_bitfield): Likewise. + (value_contents_copy_raw): Expand parameters SRC_OFFSET, + DST_OFFSET, LENGTH to LONGEST. + (value_contents_copy): Likewise. + (value_primitive_field): Expand parameter OFFSET to LONGEST. + (value_rtti_indirect_type): Expand parameter TOP to point to + LONGEST. + (value_full_object): Expand parameter XTOP to LONGEST. + (set_internalvar_component): Expand parameter OFFSET to LONGEST. + (value_fn_field): Expand parameter OFFSET to LONGEST. + (modify_field): Expand parameter BITPOS to LONGEST. + (val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. + (value_allocate_space_in_inferior): Expand parameter LEN to + LONGEST. + +gdb/testsuite/ChangeLog: + +2012-08-05 Siddhesh Poyarekar + + * gdb.base/longest-types.exp: Add test case to get offset of + BUF2. + +--MP_/yp5f+W_ED2JtUlSyBi8xujr +Content-Type: text/x-patch +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename=bitpos-main.patch + +Index: gdb-7.6.1/gdb/ada-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ada-lang.c 2013-08-30 21:54:18.725367534 +0200 ++++ gdb-7.6.1/gdb/ada-lang.c 2013-08-30 21:54:20.446368186 +0200 +@@ -80,7 +80,7 @@ static struct type *desc_bounds_type (st + + static struct value *desc_bounds (struct value *); + +-static int fat_pntr_bounds_bitpos (struct type *); ++static LONGEST fat_pntr_bounds_bitpos (struct type *); + + static int fat_pntr_bounds_bitsize (struct type *); + +@@ -88,13 +88,13 @@ static struct type *desc_data_target_typ + + static struct value *desc_data (struct value *); + +-static int fat_pntr_data_bitpos (struct type *); ++static LONGEST fat_pntr_data_bitpos (struct type *); + + static int fat_pntr_data_bitsize (struct type *); + + static struct value *desc_one_bound (struct value *, int, int); + +-static int desc_bound_bitpos (struct type *, int, int); ++static LONGEST desc_bound_bitpos (struct type *, int, int); + + static int desc_bound_bitsize (struct type *, int, int); + +@@ -174,7 +174,7 @@ static struct type *static_unwrap_type ( + + static struct value *unwrap_value (struct value *); + +-static struct type *constrained_packed_array_type (struct type *, long *); ++static struct type *constrained_packed_array_type (struct type *, LONGEST *); + + static struct type *decode_constrained_packed_array_type (struct type *); + +@@ -189,7 +189,8 @@ static int ada_is_unconstrained_packed_a + static struct value *value_subscript_packed (struct value *, int, + struct value **); + +-static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int); ++static void move_bits (gdb_byte *, int, const gdb_byte *, LONGEST, LONGEST, ++ int); + + static struct value *coerce_unspec_val_to_type (struct value *, + struct type *); +@@ -217,14 +218,14 @@ static struct value *value_val_atr (stru + static struct symbol *standard_lookup (const char *, const struct block *, + domain_enum); + +-static struct value *ada_search_struct_field (char *, struct value *, int, ++static struct value *ada_search_struct_field (char *, struct value *, LONGEST, + struct type *); + +-static struct value *ada_value_primitive_field (struct value *, int, int, ++static struct value *ada_value_primitive_field (struct value *, LONGEST, int, + struct type *); + +-static int find_struct_field (const char *, struct type *, int, +- struct type **, int *, int *, int *, int *); ++static int find_struct_field (const char *, struct type *, LONGEST, ++ struct type **, LONGEST *, int *, int *, int *); + + static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR, + struct value *); +@@ -240,7 +241,7 @@ static void ada_language_arch_info (stru + + static void check_size (const struct type *); + +-static struct value *ada_index_struct_field (int, struct value *, int, ++static struct value *ada_index_struct_field (LONGEST, struct value *, LONGEST, + struct type *); + + static struct value *assign_aggregate (struct value *, struct value *, +@@ -587,7 +588,7 @@ coerce_unspec_val_to_type (struct value + } + + static const gdb_byte * +-cond_offset_host (const gdb_byte *valaddr, long offset) ++cond_offset_host (const gdb_byte *valaddr, LONGEST offset) + { + if (valaddr == NULL) + return NULL; +@@ -596,7 +597,7 @@ cond_offset_host (const gdb_byte *valadd + } + + static CORE_ADDR +-cond_offset_target (CORE_ADDR address, long offset) ++cond_offset_target (CORE_ADDR address, LONGEST offset) + { + if (address == 0) + return 0; +@@ -1602,7 +1603,7 @@ desc_bounds (struct value *arr) + /* If TYPE is the type of an array-descriptor (fat pointer), the bit + position of the field containing the address of the bounds data. */ + +-static int ++static LONGEST + fat_pntr_bounds_bitpos (struct type *type) + { + return TYPE_FIELD_BITPOS (desc_base_type (type), 1); +@@ -1668,7 +1669,7 @@ desc_data (struct value *arr) + /* If TYPE is the type of an array-descriptor (fat pointer), the bit + position of the field containing the address of the data. */ + +-static int ++static LONGEST + fat_pntr_data_bitpos (struct type *type) + { + return TYPE_FIELD_BITPOS (desc_base_type (type), 0); +@@ -1703,7 +1704,7 @@ desc_one_bound (struct value *bounds, in + of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper + bound, if WHICH is 1. The first bound is I=1. */ + +-static int ++static LONGEST + desc_bound_bitpos (struct type *type, int i, int which) + { + return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2); +@@ -1893,7 +1894,7 @@ ada_type_of_array (struct value *arr, in + zero, and does not need to be recomputed. */ + if (lo < hi) + { +- int array_bitsize = ++ LONGEST array_bitsize = + (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); + + TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8; +@@ -2045,7 +2046,7 @@ decode_packed_array_bitsize (struct type + in bits. */ + + static struct type * +-constrained_packed_array_type (struct type *type, long *elt_bits) ++constrained_packed_array_type (struct type *type, LONGEST *elt_bits) + { + struct type *new_elt_type; + struct type *new_type; +@@ -2097,7 +2098,7 @@ decode_constrained_packed_array_type (st + char *name; + const char *tail; + struct type *shadow_type; +- long bits; ++ LONGEST bits; + + if (!raw_name) + raw_name = ada_type_name (desc_base_type (type)); +@@ -2168,7 +2169,8 @@ decode_constrained_packed_array (struct + array with no wrapper. In order to interpret the value through + the (left-justified) packed array type we just built, we must + first left-justify it. */ +- int bit_size, bit_pos; ++ int bit_size; ++ LONGEST bit_pos; + ULONGEST mod; + + mod = ada_modulus (value_type (arr)) - 1; +@@ -2269,15 +2271,16 @@ has_negatives (struct type *type) + + struct value * + ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, +- long offset, int bit_offset, int bit_size, ++ LONGEST offset, int bit_offset, int bit_size, + struct type *type) + { + struct value *v; +- int src, /* Index into the source area */ +- targ, /* Index into the target area */ +- srcBitsLeft, /* Number of source bits left to move */ +- nsrc, ntarg, /* Number of source and target bytes */ +- unusedLS, /* Number of bits in next significant ++ int src; /* Index into the source area */ ++ LONGEST targ; /* Index into the target area */ ++ int srcBitsLeft, /* Number of source bits left to move */ ++ nsrc; /* Number of source bytes */ ++ LONGEST ntarg; /* Number of target bytes */ ++ int unusedLS, /* Number of bits in next significant + byte of source that are unused */ + accumSize; /* Number of meaningful bits in accum */ + unsigned char *bytes; /* First byte containing data to unpack */ +@@ -2310,7 +2313,7 @@ ada_value_primitive_packed_val (struct v + + if (obj != NULL) + { +- long new_offset = offset; ++ LONGEST new_offset = offset; + + set_value_component_location (v, obj); + set_value_bitpos (v, bit_offset + value_bitpos (obj)); +@@ -2427,7 +2430,7 @@ ada_value_primitive_packed_val (struct v + not overlap. */ + static void + move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source, +- int src_offset, int n, int bits_big_endian_p) ++ LONGEST src_offset, LONGEST n, int bits_big_endian_p) + { + unsigned int accum, mask; + int accum_bits, chunk_size; +@@ -2517,7 +2520,7 @@ ada_value_assign (struct value *toval, s + { + int len = (value_bitpos (toval) + + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; +- int from_size; ++ LONGEST from_size; + char *buffer = (char *) alloca (len); + struct value *val; + CORE_ADDR to_addr = value_address (toval); +@@ -2562,7 +2565,7 @@ value_assign_to_component (struct value + (LONGEST) (value_address (component) - value_address (container)); + int bit_offset_in_container = + value_bitpos (component) - value_bitpos (container); +- int bits; ++ LONGEST bits; + + val = value_cast (value_type (component), val); + +@@ -4083,7 +4086,7 @@ ensure_lval (struct value *val) + if (VALUE_LVAL (val) == not_lval + || VALUE_LVAL (val) == lval_internalvar) + { +- int len = TYPE_LENGTH (ada_check_typedef (value_type (val))); ++ LONGEST len = TYPE_LENGTH (ada_check_typedef (value_type (val))); + const CORE_ADDR addr = + value_as_long (value_allocate_space_in_inferior (len)); + +@@ -4157,7 +4160,7 @@ static CORE_ADDR + value_pointer (struct value *value, struct type *type) + { + struct gdbarch *gdbarch = get_type_arch (type); +- unsigned len = TYPE_LENGTH (type); ++ ULONGEST len = TYPE_LENGTH (type); + gdb_byte *buf = alloca (len); + CORE_ADDR addr; + +@@ -6077,7 +6080,7 @@ value_tag_from_contents_and_address (str + const gdb_byte *valaddr, + CORE_ADDR address) + { +- int tag_byte_offset; ++ LONGEST tag_byte_offset; + struct type *tag_type; + + if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, +@@ -6542,7 +6545,7 @@ ada_in_variant (LONGEST val, struct type + only in that it can handle packed values of arbitrary type. */ + + static struct value * +-ada_value_primitive_field (struct value *arg1, int offset, int fieldno, ++ada_value_primitive_field (struct value *arg1, LONGEST offset, int fieldno, + struct type *arg_type) + { + struct type *type; +@@ -6554,7 +6557,7 @@ ada_value_primitive_field (struct value + + if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0) + { +- int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno); ++ LONGEST bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno); + int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); + + return ada_value_primitive_packed_val (arg1, value_contents (arg1), +@@ -6581,9 +6584,9 @@ ada_value_primitive_field (struct value + Returns 1 if found, 0 otherwise. */ + + static int +-find_struct_field (const char *name, struct type *type, int offset, ++find_struct_field (const char *name, struct type *type, LONGEST offset, + struct type **field_type_p, +- int *byte_offset_p, int *bit_offset_p, int *bit_size_p, ++ LONGEST *byte_offset_p, int *bit_offset_p, int *bit_size_p, + int *index_p) + { + int i; +@@ -6601,8 +6604,8 @@ find_struct_field (const char *name, str + + for (i = 0; i < TYPE_NFIELDS (type); i += 1) + { +- int bit_pos = TYPE_FIELD_BITPOS (type, i); +- int fld_offset = offset + bit_pos / 8; ++ LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i); ++ LONGEST fld_offset = offset + bit_pos / 8; + const char *t_field_name = TYPE_FIELD_NAME (type, i); + + if (t_field_name == NULL) +@@ -6672,7 +6675,7 @@ num_visible_fields (struct type *type) + Searches recursively through wrapper fields (e.g., '_parent'). */ + + static struct value * +-ada_search_struct_field (char *name, struct value *arg, int offset, ++ada_search_struct_field (char *name, struct value *arg, LONGEST offset, + struct type *type) + { + int i; +@@ -6705,7 +6708,7 @@ ada_search_struct_field (char *name, str + int j; + struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, + i)); +- int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; ++ LONGEST var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; + + for (j = 0; j < TYPE_NFIELDS (field_type); j += 1) + { +@@ -6723,8 +6726,8 @@ ada_search_struct_field (char *name, str + return NULL; + } + +-static struct value *ada_index_struct_field_1 (int *, struct value *, +- int, struct type *); ++static struct value *ada_index_struct_field_1 (LONGEST *, struct value *, ++ LONGEST, struct type *); + + + /* Return field #INDEX in ARG, where the index is that returned by +@@ -6733,7 +6736,7 @@ static struct value *ada_index_struct_fi + * If found, return value, else return NULL. */ + + static struct value * +-ada_index_struct_field (int index, struct value *arg, int offset, ++ada_index_struct_field (LONGEST index, struct value *arg, LONGEST offset, + struct type *type) + { + return ada_index_struct_field_1 (&index, arg, offset, type); +@@ -6745,7 +6748,7 @@ ada_index_struct_field (int index, struc + * *INDEX_P. */ + + static struct value * +-ada_index_struct_field_1 (int *index_p, struct value *arg, int offset, ++ada_index_struct_field_1 (LONGEST *index_p, struct value *arg, LONGEST offset, + struct type *type) + { + int i; +@@ -6835,7 +6838,8 @@ ada_value_struct_elt (struct value *arg, + v = ada_search_struct_field (name, arg, 0, t); + else + { +- int bit_offset, bit_size, byte_offset; ++ int bit_offset, bit_size; ++ LONGEST byte_offset; + struct type *field_type; + CORE_ADDR address; + +@@ -7148,8 +7152,8 @@ ada_coerce_ref (struct value *val0) + /* Return OFF rounded upward if necessary to a multiple of + ALIGNMENT (a power of 2). */ + +-static unsigned int +-align_value (unsigned int off, unsigned int alignment) ++static ULONGEST ++align_value (ULONGEST off, ULONGEST alignment) + { + return (off + alignment - 1) & ~(alignment - 1); + } +@@ -7528,10 +7532,9 @@ ada_template_to_fixed_record_type_1 (str + struct value *mark = value_mark (); + struct value *dval; + struct type *rtype; +- int nfields, bit_len; ++ int nfields; + int variant_field; +- long off; +- int fld_bit_len; ++ LONGEST off, bit_len, fld_bit_len; + int f; + + /* Compute the number of fields in this record type that are going +@@ -7602,7 +7605,7 @@ ada_template_to_fixed_record_type_1 (str + that follow this one. */ + if (ada_is_aligner_type (field_type)) + { +- long field_offset = TYPE_FIELD_BITPOS (field_type, f); ++ LONGEST field_offset = TYPE_FIELD_BITPOS (field_type, f); + + field_valaddr = cond_offset_host (field_valaddr, field_offset); + field_address = cond_offset_target (field_address, field_offset); +@@ -7731,11 +7734,11 @@ ada_template_to_fixed_record_type_1 (str + if (TYPE_LENGTH (type) <= 0) + { + if (TYPE_NAME (rtype)) +- warning (_("Invalid type size for `%s' detected: %d."), +- TYPE_NAME (rtype), TYPE_LENGTH (type)); ++ warning (_("Invalid type size for `%s' detected: %s."), ++ TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type))); + else +- warning (_("Invalid type size for detected: %d."), +- TYPE_LENGTH (type)); ++ warning (_("Invalid type size for detected: %s."), ++ pulongest (TYPE_LENGTH (type))); + } + else + { +@@ -8072,7 +8075,8 @@ to_fixed_array_type (struct type *type0, + type was a regular (non-packed) array type. As a result, the + bitsize of the array elements needs to be set again, and the array + length needs to be recomputed based on that bitsize. */ +- int len = TYPE_LENGTH (result) / TYPE_LENGTH (TYPE_TARGET_TYPE (result)); ++ LONGEST len = (TYPE_LENGTH (result) ++ / TYPE_LENGTH (TYPE_TARGET_TYPE (result))); + int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0); + + TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0); +Index: gdb-7.6.1/gdb/ada-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/ada-lang.h 2013-08-30 21:54:18.727367534 +0200 ++++ gdb-7.6.1/gdb/ada-lang.h 2013-08-30 21:54:20.446368186 +0200 +@@ -169,7 +169,7 @@ extern void ada_print_type (struct type + extern void ada_print_typedef (struct type *type, struct symbol *new_symbol, + struct ui_file *stream); + +-extern void ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, ++extern void ada_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -184,7 +184,7 @@ extern void ada_emit_char (int, struct t + extern void ada_printchar (int, struct type *, struct ui_file *); + + extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *, +- unsigned int, const char *, int, ++ ULONGEST, const char *, int, + const struct value_print_options *); + + struct value *ada_convert_actual (struct value *actual, +@@ -257,7 +257,7 @@ extern int ada_is_constrained_packed_arr + + extern struct value *ada_value_primitive_packed_val (struct value *, + const gdb_byte *, +- long, int, int, ++ LONGEST, int, int, + struct type *); + + extern struct type *ada_coerce_to_simple_array_type (struct type *); +Index: gdb-7.6.1/gdb/ada-typeprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ada-typeprint.c 2013-08-30 21:54:18.727367534 +0200 ++++ gdb-7.6.1/gdb/ada-typeprint.c 2013-08-30 21:54:20.447368187 +0200 +@@ -829,8 +829,8 @@ ada_print_type (struct type *type0, cons + const char *name = ada_type_name (type); + + if (!ada_is_range_type_name (name)) +- fprintf_filtered (stream, _("<%d-byte integer>"), +- TYPE_LENGTH (type)); ++ fprintf_filtered (stream, _("<%s-byte integer>"), ++ pulongest (TYPE_LENGTH (type))); + else + { + fprintf_filtered (stream, "range "); +@@ -851,7 +851,8 @@ ada_print_type (struct type *type0, cons + } + break; + case TYPE_CODE_FLT: +- fprintf_filtered (stream, _("<%d-byte float>"), TYPE_LENGTH (type)); ++ fprintf_filtered (stream, _("<%s-byte float>"), ++ pulongest (TYPE_LENGTH (type))); + break; + case TYPE_CODE_ENUM: + if (show < 0) +Index: gdb-7.6.1/gdb/ada-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ada-valprint.c 2013-08-30 21:54:18.728367535 +0200 ++++ gdb-7.6.1/gdb/ada-valprint.c 2013-08-30 21:54:20.447368187 +0200 +@@ -41,16 +41,16 @@ static void print_record (struct type *, + const struct value_print_options *); + + static int print_field_values (struct type *, const gdb_byte *, +- int, ++ LONGEST, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, +- int, struct type *, int); ++ int, struct type *, LONGEST); + + static void adjust_type_signedness (struct type *); + +-static void ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR, +- struct ui_file *, int, ++static void ada_val_print_1 (struct type *, const gdb_byte *, LONGEST, ++ CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); + +@@ -143,7 +143,7 @@ val_print_packed_array_elements (struct + unsigned int things_printed = 0; + unsigned len; + struct type *elttype, *index_type; +- unsigned eltlen; ++ ULONGEST eltlen; + unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0); + struct value *mark = value_mark (); + LONGEST low = 0; +@@ -292,7 +292,7 @@ ada_emit_char (int c, struct type *type, + of a character. */ + + static int +-char_at (const gdb_byte *string, int i, int type_len, ++char_at (const gdb_byte *string, LONGEST i, int type_len, + enum bfd_endian byte_order) + { + if (type_len == 1) +@@ -462,11 +462,11 @@ ada_print_scalar (struct type *type, LON + + static void + printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, +- unsigned int length, int force_ellipses, int type_len, ++ ULONGEST length, int force_ellipses, int type_len, + const struct value_print_options *options) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (elttype)); +- unsigned int i; ++ ULONGEST i; + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; +@@ -481,9 +481,9 @@ printstr (struct ui_file *stream, struct + { + /* Position of the character we are examining + to see whether it is repeated. */ +- unsigned int rep1; ++ ULONGEST rep1; + /* Number of repetitions we have detected so far. */ +- unsigned int reps; ++ ULONGEST reps; + + QUIT; + +@@ -514,7 +514,8 @@ printstr (struct ui_file *stream, struct + ada_emit_char (char_at (string, i, type_len, byte_order), + elttype, stream, '\'', type_len); + fputs_filtered ("'", stream); +- fprintf_filtered (stream, _(" "), reps); ++ fprintf_filtered (stream, _(" "), ++ pulongest (reps)); + i = rep1 - 1; + things_printed += options->repeat_count_threshold; + need_comma = 1; +@@ -542,7 +543,7 @@ printstr (struct ui_file *stream, struct + + void + ada_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + const struct value_print_options *options) + { +@@ -556,7 +557,7 @@ ada_printstr (struct ui_file *stream, st + + void + ada_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options) +@@ -588,8 +589,8 @@ ada_val_print_array (struct type *type, + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); + struct type *elttype = TYPE_TARGET_TYPE (type); +- unsigned int eltlen; +- unsigned int len; ++ ULONGEST eltlen; ++ ULONGEST len; + + /* We know that ELTTYPE cannot possibly be null, because we found + that TYPE is a string-like type. Similarly, the size of ELTTYPE +@@ -607,7 +608,7 @@ ada_val_print_array (struct type *type, + elements up to it. */ + if (options->stop_print_at_null) + { +- int temp_len; ++ LONGEST temp_len; + + /* Look for a NULL char. */ + for (temp_len = 0; +@@ -640,7 +641,7 @@ ada_val_print_array (struct type *type, + + static void + ada_val_print_1 (struct type *type, const gdb_byte *valaddr, +- int offset, CORE_ADDR address, ++ LONGEST offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) +@@ -915,12 +916,12 @@ ada_val_print_1 (struct type *type, cons + + static int + print_variant_part (struct type *type, int field_num, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, + int comma_needed, +- struct type *outer_type, int outer_offset) ++ struct type *outer_type, LONGEST outer_offset) + { + struct type *var_type = TYPE_FIELD_TYPE (type, field_num); + int which = ada_which_variant_applies (var_type, outer_type, +@@ -1027,11 +1028,11 @@ print_record (struct type *type, const g + + static int + print_field_values (struct type *type, const gdb_byte *valaddr, +- int offset, struct ui_file *stream, int recurse, ++ LONGEST offset, struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, + int comma_needed, +- struct type *outer_type, int outer_offset) ++ struct type *outer_type, LONGEST outer_offset) + { + int i, len; + +@@ -1097,7 +1098,7 @@ print_field_values (struct type *type, c + } + else + { +- int bit_pos = TYPE_FIELD_BITPOS (type, i); ++ LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i); + int bit_size = TYPE_FIELD_BITSIZE (type, i); + struct value_print_options opts; + +Index: gdb-7.6.1/gdb/annotate.c +=================================================================== +--- gdb-7.6.1.orig/gdb/annotate.c 2013-08-30 21:54:18.728367535 +0200 ++++ gdb-7.6.1/gdb/annotate.c 2013-08-30 21:54:20.447368187 +0200 +@@ -523,21 +523,21 @@ annotate_frame_end (void) + } + + void +-annotate_array_section_begin (int idx, struct type *elttype) ++annotate_array_section_begin (LONGEST idx, struct type *elttype) + { + if (annotation_level == 2) + { +- printf_filtered (("\n\032\032array-section-begin %d "), idx); ++ printf_filtered (("\n\032\032array-section-begin %s "), plongest (idx)); + print_value_flags (elttype); + printf_filtered (("\n")); + } + } + + void +-annotate_elt_rep (unsigned int repcount) ++annotate_elt_rep (ULONGEST repcount) + { + if (annotation_level == 2) +- printf_filtered (("\n\032\032elt-rep %u\n"), repcount); ++ printf_filtered (("\n\032\032elt-rep %s\n"), pulongest (repcount)); + } + + void +Index: gdb-7.6.1/gdb/annotate.h +=================================================================== +--- gdb-7.6.1.orig/gdb/annotate.h 2013-08-30 21:54:18.728367535 +0200 ++++ gdb-7.6.1/gdb/annotate.h 2013-08-30 21:54:20.448368187 +0200 +@@ -92,8 +92,8 @@ extern void annotate_frame_source_end (v + extern void annotate_frame_where (void); + extern void annotate_frame_end (void); + +-extern void annotate_array_section_begin (int, struct type *); +-extern void annotate_elt_rep (unsigned int); ++extern void annotate_array_section_begin (LONGEST, struct type *); ++extern void annotate_elt_rep (ULONGEST); + extern void annotate_elt_rep_end (void); + extern void annotate_elt (void); + extern void annotate_array_section_end (void); +Index: gdb-7.6.1/gdb/arm-linux-nat.c +=================================================================== +--- gdb-7.6.1.orig/gdb/arm-linux-nat.c 2013-08-30 21:54:18.729367535 +0200 ++++ gdb-7.6.1/gdb/arm-linux-nat.c 2013-08-30 21:54:20.448368187 +0200 +@@ -1073,7 +1073,7 @@ arm_linux_remove_hw_breakpoint (struct g + /* Are we able to use a hardware watchpoint for the LEN bytes starting at + ADDR? */ + static int +-arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); + CORE_ADDR max_wp_length, aligned_addr; +Index: gdb-7.6.1/gdb/ax-gdb.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ax-gdb.c 2013-08-30 21:54:18.730367536 +0200 ++++ gdb-7.6.1/gdb/ax-gdb.c 2013-08-30 21:54:20.449368188 +0200 +@@ -83,12 +83,12 @@ static void gen_traced_pop (struct gdbar + static void gen_sign_extend (struct agent_expr *, struct type *); + static void gen_extend (struct agent_expr *, struct type *); + static void gen_fetch (struct agent_expr *, struct type *); +-static void gen_left_shift (struct agent_expr *, int); ++static void gen_left_shift (struct agent_expr *, LONGEST); + + + static void gen_frame_args_address (struct gdbarch *, struct agent_expr *); + static void gen_frame_locals_address (struct gdbarch *, struct agent_expr *); +-static void gen_offset (struct agent_expr *ax, int offset); ++static void gen_offset (struct agent_expr *ax, LONGEST offset); + static void gen_sym_offset (struct agent_expr *, struct symbol *); + static void gen_var_ref (struct gdbarch *, struct agent_expr *ax, + struct axs_value *value, struct symbol *var); +@@ -136,15 +136,16 @@ static void gen_deref (struct agent_expr + static void gen_address_of (struct agent_expr *, struct axs_value *); + static void gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, +- struct type *type, int start, int end); ++ struct type *type, LONGEST start, LONGEST end); + static void gen_primitive_field (struct expression *exp, + struct agent_expr *ax, + struct axs_value *value, +- int offset, int fieldno, struct type *type); ++ LONGEST offset, int fieldno, ++ struct type *type); + static int gen_struct_ref_recursive (struct expression *exp, + struct agent_expr *ax, + struct axs_value *value, +- char *field, int offset, ++ char *field, LONGEST offset, + struct type *type); + static void gen_struct_ref (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, +@@ -569,7 +570,7 @@ gen_fetch (struct agent_expr *ax, struct + right shift it by -DISTANCE bits if DISTANCE < 0. This generates + unsigned (logical) right shifts. */ + static void +-gen_left_shift (struct agent_expr *ax, int distance) ++gen_left_shift (struct agent_expr *ax, LONGEST distance) + { + if (distance > 0) + { +@@ -623,7 +624,7 @@ gen_frame_locals_address (struct gdbarch + programming in ML, it would be clearer why these are the same + thing. */ + static void +-gen_offset (struct agent_expr *ax, int offset) ++gen_offset (struct agent_expr *ax, LONGEST offset) + { + /* It would suffice to simply push the offset and add it, but this + makes it easier to read positive and negative offsets in the +@@ -1279,7 +1280,7 @@ gen_address_of (struct agent_expr *ax, s + static void + gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, struct type *type, +- int start, int end) ++ LONGEST start, LONGEST end) + { + /* Note that ops[i] fetches 8 << i bits. */ + static enum agent_op ops[] +@@ -1314,13 +1315,13 @@ gen_bitfield_ref (struct expression *exp + + /* The first and one-after-last bits in the field, but rounded down + and up to byte boundaries. */ +- int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; +- int bound_end = (((end + TARGET_CHAR_BIT - 1) +- / TARGET_CHAR_BIT) +- * TARGET_CHAR_BIT); ++ LONGEST bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; ++ LONGEST bound_end = (((end + TARGET_CHAR_BIT - 1) ++ / TARGET_CHAR_BIT) ++ * TARGET_CHAR_BIT); + + /* current bit offset within the structure */ +- int offset; ++ LONGEST offset; + + /* The index in ops of the opcode we're considering. */ + int op; +@@ -1439,7 +1440,7 @@ gen_bitfield_ref (struct expression *exp + static void + gen_primitive_field (struct expression *exp, + struct agent_expr *ax, struct axs_value *value, +- int offset, int fieldno, struct type *type) ++ LONGEST offset, int fieldno, struct type *type) + { + /* Is this a bitfield? */ + if (TYPE_FIELD_PACKED (type, fieldno)) +@@ -1464,7 +1465,7 @@ gen_primitive_field (struct expression * + static int + gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, +- char *field, int offset, struct type *type) ++ char *field, LONGEST offset, struct type *type) + { + int i, rslt; + int nbases = TYPE_N_BASECLASSES (type); +Index: gdb-7.6.1/gdb/ax-general.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ax-general.c 2013-08-30 21:54:18.730367536 +0200 ++++ gdb-7.6.1/gdb/ax-general.c 2013-08-30 21:54:20.449368188 +0200 +@@ -192,7 +192,7 @@ ax_zero_ext (struct agent_expr *x, int n + + /* Append a trace_quick instruction to EXPR, to record N bytes. */ + void +-ax_trace_quick (struct agent_expr *x, int n) ++ax_trace_quick (struct agent_expr *x, LONGEST n) + { + /* N must fit in a byte. */ + if (n < 0 || n > 255) +Index: gdb-7.6.1/gdb/ax.h +=================================================================== +--- gdb-7.6.1.orig/gdb/ax.h 2013-08-30 21:54:18.730367536 +0200 ++++ gdb-7.6.1/gdb/ax.h 2013-08-30 21:54:20.449368188 +0200 +@@ -190,7 +190,7 @@ extern void ax_ext (struct agent_expr *E + extern void ax_zero_ext (struct agent_expr *EXPR, int N); + + /* Append a trace_quick instruction to EXPR, to record N bytes. */ +-extern void ax_trace_quick (struct agent_expr *EXPR, int N); ++extern void ax_trace_quick (struct agent_expr *EXPR, LONGEST N); + + /* Append a goto op to EXPR. OP is the actual op (must be aop_goto or + aop_if_goto). We assume we don't know the target offset yet, +Index: gdb-7.6.1/gdb/breakpoint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/breakpoint.c 2013-08-30 21:54:18.733367537 +0200 ++++ gdb-7.6.1/gdb/breakpoint.c 2013-08-30 21:54:20.453368189 +0200 +@@ -6677,7 +6677,7 @@ breakpoint_address_match (struct address + + static int + breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1, +- int len1, struct address_space *aspace2, ++ LONGEST len1, struct address_space *aspace2, + CORE_ADDR addr2) + { + return ((gdbarch_has_global_breakpoints (target_gdbarch ()) +@@ -11216,7 +11216,7 @@ can_use_hardware_watchpoint (struct valu + && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + { + CORE_ADDR vaddr = value_address (v); +- int len; ++ LONGEST len; + int num_regs; + + len = (target_exact_watchpoints +Index: gdb-7.6.1/gdb/breakpoint.h +=================================================================== +--- gdb-7.6.1.orig/gdb/breakpoint.h 2013-08-30 21:54:18.734367537 +0200 ++++ gdb-7.6.1/gdb/breakpoint.h 2013-08-30 21:54:20.454368190 +0200 +@@ -250,7 +250,7 @@ struct bp_target_info + + /* If this is a ranged breakpoint, then this field contains the + length of the range that will be watched for execution. */ +- int length; ++ LONGEST length; + + /* If the breakpoint lives in memory and reading that memory would + give back the breakpoint, instead of the original contents, then +@@ -419,7 +419,7 @@ struct bp_location + /* For hardware watchpoints, the size of the memory region being + watched. For hardware ranged breakpoints, the size of the + breakpoint range. */ +- int length; ++ LONGEST length; + + /* Type of hardware watchpoint. */ + enum target_hw_bp_type watchpoint_type; +Index: gdb-7.6.1/gdb/c-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/c-lang.c 2013-08-30 21:54:18.734367537 +0200 ++++ gdb-7.6.1/gdb/c-lang.c 2013-08-30 21:54:20.454368190 +0200 +@@ -188,7 +188,7 @@ c_printchar (int c, struct type *type, s + + void + c_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *user_encoding, int force_ellipses, + const struct value_print_options *options) + { +@@ -663,7 +663,7 @@ evaluate_subexp_c (struct type *expect_t + } + else + { +- int i; ++ LONGEST i; + + /* Write the terminating character. */ + for (i = 0; i < TYPE_LENGTH (type); ++i) +@@ -672,7 +672,7 @@ evaluate_subexp_c (struct type *expect_t + if (satisfy_expected) + { + LONGEST low_bound, high_bound; +- int element_size = TYPE_LENGTH (type); ++ LONGEST element_size = TYPE_LENGTH (type); + + if (get_discrete_bounds (TYPE_INDEX_TYPE (expect_type), + &low_bound, &high_bound) < 0) +Index: gdb-7.6.1/gdb/c-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/c-lang.h 2013-08-30 21:54:18.734367537 +0200 ++++ gdb-7.6.1/gdb/c-lang.h 2013-08-30 21:54:20.454368190 +0200 +@@ -73,7 +73,7 @@ extern void c_print_typedef (struct type + struct ui_file *); + + extern void c_val_print (struct type *, const gdb_byte *, +- int, CORE_ADDR, ++ LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -93,7 +93,7 @@ extern void c_printchar (int, struct typ + extern void c_printstr (struct ui_file * stream, + struct type *elttype, + const gdb_byte *string, +- unsigned int length, ++ ULONGEST length, + const char *user_encoding, + int force_ellipses, + const struct value_print_options *options); +@@ -119,14 +119,14 @@ extern void cp_print_class_member (const + struct ui_file *, char *); + + extern void cp_print_value_fields (struct type *, struct type *, +- const gdb_byte *, int, CORE_ADDR, ++ const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, + struct type **, int); + + extern void cp_print_value_fields_rtti (struct type *, +- const gdb_byte *, int, CORE_ADDR, ++ const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, +Index: gdb-7.6.1/gdb/c-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/c-valprint.c 2013-08-30 21:54:18.735367537 +0200 ++++ gdb-7.6.1/gdb/c-valprint.c 2013-08-30 21:54:20.455368190 +0200 +@@ -132,7 +132,7 @@ static const struct generic_val_print_de + + void + c_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) +@@ -143,7 +143,7 @@ c_val_print (struct type *type, const gd + unsigned len; + struct type *elttype, *unresolved_elttype; + struct type *unresolved_type = type; +- unsigned eltlen; ++ ULONGEST eltlen; + CORE_ADDR addr; + + CHECK_TYPEDEF (type); +@@ -379,9 +379,9 @@ c_val_print (struct type *type, const gd + /* Print vtable entry - we only get here if NOT using + -fvtable_thunks. (Otherwise, look under + TYPE_CODE_PTR.) */ +- int offset = (embedded_offset +- + TYPE_FIELD_BITPOS (type, +- VTBL_FNADDR_OFFSET) / 8); ++ LONGEST offset = (embedded_offset ++ + TYPE_FIELD_BITPOS (type, ++ VTBL_FNADDR_OFFSET) / 8); + struct type *field_type = TYPE_FIELD_TYPE (type, + VTBL_FNADDR_OFFSET); + CORE_ADDR addr +@@ -460,7 +460,8 @@ c_value_print (struct value *val, struct + const struct value_print_options *options) + { + struct type *type, *real_type, *val_type; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct value_print_options opts = *options; + + opts.deref_ref = 1; +Index: gdb-7.6.1/gdb/cp-abi.c +=================================================================== +--- gdb-7.6.1.orig/gdb/cp-abi.c 2013-08-30 21:54:18.735367537 +0200 ++++ gdb-7.6.1/gdb/cp-abi.c 2013-08-30 21:54:20.455368190 +0200 +@@ -68,13 +68,13 @@ is_operator_name (const char *name) + return (*current_cp_abi.is_operator_name) (name); + } + +-int ++LONGEST + baseclass_offset (struct type *type, int index, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + const struct value *val) + { + volatile struct gdb_exception ex; +- int res = 0; ++ LONGEST res = 0; + + gdb_assert (current_cp_abi.baseclass_offset != NULL); + +@@ -98,7 +98,7 @@ baseclass_offset (struct type *type, int + struct value * + value_virtual_fn_field (struct value **arg1p, + struct fn_field *f, int j, +- struct type *type, int offset) ++ struct type *type, LONGEST offset) + { + if ((current_cp_abi.virtual_fn_field) == NULL) + return NULL; +@@ -108,7 +108,7 @@ value_virtual_fn_field (struct value **a + + struct type * + value_rtti_type (struct value *v, int *full, +- int *top, int *using_enc) ++ LONGEST *top, int *using_enc) + { + struct type *ret = NULL; + volatile struct gdb_exception e; +Index: gdb-7.6.1/gdb/cp-abi.h +=================================================================== +--- gdb-7.6.1.orig/gdb/cp-abi.h 2013-08-30 21:54:18.735367537 +0200 ++++ gdb-7.6.1/gdb/cp-abi.h 2013-08-30 21:54:20.455368190 +0200 +@@ -108,7 +108,7 @@ extern struct value *value_virtual_fn_fi + struct fn_field *f, + int j, + struct type *type, +- int offset); ++ LONGEST offset); + + + /* Try to find the run-time type of VALUE, using C++ run-time type +@@ -135,7 +135,7 @@ extern struct value *value_virtual_fn_fi + FULL, TOP, and USING_ENC can each be zero, in which case we don't + provide the corresponding piece of information. */ + extern struct type *value_rtti_type (struct value *value, +- int *full, int *top, ++ int *full, LONGEST *top, + int *using_enc); + + /* Compute the offset of the baseclass which is the INDEXth baseclass +@@ -144,11 +144,11 @@ extern struct type *value_rtti_type (str + contents of VAL. The result is the offset of the baseclass value + relative to (the address of)(ARG) + OFFSET. */ + +-extern int baseclass_offset (struct type *type, +- int index, const gdb_byte *valaddr, +- int embedded_offset, +- CORE_ADDR address, +- const struct value *val); ++extern LONGEST baseclass_offset (struct type *type, ++ int index, const gdb_byte *valaddr, ++ LONGEST embedded_offset, ++ CORE_ADDR address, ++ const struct value *val); + + /* Describe the target of a pointer to method. CONTENTS is the byte + pattern representing the pointer to method. TYPE is the pointer to +@@ -204,12 +204,13 @@ struct cp_abi_ops + struct value *(*virtual_fn_field) (struct value **arg1p, + struct fn_field * f, + int j, struct type * type, +- int offset); ++ LONGEST offset); + struct type *(*rtti_type) (struct value *v, int *full, +- int *top, int *using_enc); +- int (*baseclass_offset) (struct type *type, int index, +- const bfd_byte *valaddr, int embedded_offset, +- CORE_ADDR address, const struct value *val); ++ LONGEST *top, int *using_enc); ++ LONGEST (*baseclass_offset) (struct type *type, int index, ++ const bfd_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ const struct value *val); + void (*print_method_ptr) (const gdb_byte *contents, + struct type *type, + struct ui_file *stream); +Index: gdb-7.6.1/gdb/cp-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/cp-valprint.c 2013-08-30 21:54:18.736367538 +0200 ++++ gdb-7.6.1/gdb/cp-valprint.c 2013-08-30 21:54:20.456368190 +0200 +@@ -82,7 +82,7 @@ static void cp_print_static_field (struc + const struct value_print_options *); + + static void cp_print_value (struct type *, struct type *, +- const gdb_byte *, int, ++ const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, + int, const struct value *, + const struct value_print_options *, +@@ -156,7 +156,7 @@ cp_is_vtbl_member (struct type *type) + + void + cp_print_value_fields (struct type *type, struct type *real_type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, const struct value *val, + const struct value_print_options *options, +@@ -342,7 +342,7 @@ cp_print_value_fields (struct type *type + } + else if (i == vptr_fieldno && type == vptr_basetype) + { +- int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; ++ LONGEST i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; + struct type *i_type = TYPE_FIELD_TYPE (type, i); + + if (valprint_check_validity (stream, i_type, i_offset, val)) +@@ -425,7 +425,7 @@ cp_print_value_fields (struct type *type + + void + cp_print_value_fields_rtti (struct type *type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, +@@ -441,7 +441,8 @@ cp_print_value_fields_rtti (struct type + TARGET_CHAR_BIT * TYPE_LENGTH (type))) + { + struct value *value; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + + /* Ugh, we have to convert back to a value here. */ + value = value_from_contents_and_address (type, valaddr + offset, +@@ -465,7 +466,7 @@ cp_print_value_fields_rtti (struct type + + static void + cp_print_value (struct type *type, struct type *real_type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, const struct value *val, + const struct value_print_options *options, +@@ -475,7 +476,7 @@ cp_print_value (struct type *type, struc + = (struct type **) obstack_next_free (&dont_print_vb_obstack); + struct obstack tmp_obstack = dont_print_vb_obstack; + int i, n_baseclasses = TYPE_N_BASECLASSES (type); +- int thisoffset; ++ LONGEST thisoffset; + struct type *thistype; + + if (dont_print_vb == 0) +@@ -489,7 +490,7 @@ cp_print_value (struct type *type, struc + + for (i = 0; i < n_baseclasses; i++) + { +- int boffset = 0; ++ LONGEST boffset = 0; + int skip; + struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); + const char *basename = TYPE_NAME (baseclass); +Index: gdb-7.6.1/gdb/d-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/d-lang.h 2013-08-30 21:54:18.736367538 +0200 ++++ gdb-7.6.1/gdb/d-lang.h 2013-08-30 21:54:20.456368190 +0200 +@@ -25,7 +25,7 @@ + extern char *d_demangle (const char *mangled, int options); + + extern void d_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options); +Index: gdb-7.6.1/gdb/d-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/d-valprint.c 2013-08-30 21:54:18.736367538 +0200 ++++ gdb-7.6.1/gdb/d-valprint.c 2013-08-30 21:54:20.456368190 +0200 +@@ -29,7 +29,7 @@ + + static int + dynamic_array_type (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options) +@@ -71,9 +71,9 @@ dynamic_array_type (struct type *type, c + + /* Implements the la_val_print routine for language D. */ + void +-d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, +- const struct value *val, ++d_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, const struct value *val, + const struct value_print_options *options) + { + int ret; +Index: gdb-7.6.1/gdb/doublest.c +=================================================================== +--- gdb-7.6.1.orig/gdb/doublest.c 2013-08-30 21:54:18.736367538 +0200 ++++ gdb-7.6.1/gdb/doublest.c 2013-08-30 21:54:20.456368190 +0200 +@@ -791,7 +791,7 @@ floatformat_from_doublest (const struct + but not passed on by GDB. This should be fixed. */ + + static const struct floatformat * +-floatformat_from_length (struct gdbarch *gdbarch, int len) ++floatformat_from_length (struct gdbarch *gdbarch, LONGEST len) + { + const struct floatformat *format; + +@@ -819,8 +819,8 @@ floatformat_from_length (struct gdbarch + else + format = NULL; + if (format == NULL) +- error (_("Unrecognized %d-bit floating-point type."), +- len * TARGET_CHAR_BIT); ++ error (_("Unrecognized %s-bit floating-point type."), ++ plongest (len * TARGET_CHAR_BIT)); + return format; + } + +Index: gdb-7.6.1/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.6.1.orig/gdb/dwarf2loc.c 2013-08-30 21:54:18.738367539 +0200 ++++ gdb-7.6.1/gdb/dwarf2loc.c 2013-08-30 21:54:20.458368191 +0200 +@@ -1680,19 +1680,19 @@ insert_bits (unsigned int datum, + BITS_BIG_ENDIAN is taken directly from gdbarch. */ + + static void +-copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits, +- const gdb_byte *source, unsigned int source_offset_bits, +- unsigned int bit_count, ++copy_bitwise (gdb_byte *dest, ULONGEST dest_offset_bits, ++ const gdb_byte *source, ULONGEST source_offset, ++ ULONGEST bit_count, + int bits_big_endian) + { +- unsigned int dest_avail; ++ unsigned int dest_avail, source_offset_bits; + int datum; + + /* Reduce everything to byte-size pieces. */ + dest += dest_offset_bits / 8; + dest_offset_bits %= 8; +- source += source_offset_bits / 8; +- source_offset_bits %= 8; ++ source += source_offset / 8; ++ source_offset_bits = source_offset % 8; + + dest_avail = 8 - dest_offset_bits % 8; + +@@ -1730,13 +1730,13 @@ static void + read_pieced_value (struct value *v) + { + int i; +- long offset = 0; ++ LONGEST offset = 0; + ULONGEST bits_to_skip; + gdb_byte *contents; + struct piece_closure *c + = (struct piece_closure *) value_computed_closure (v); + struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v)); +- size_t type_len; ++ ULONGEST type_len; + size_t buffer_size = 0; + char *buffer = NULL; + struct cleanup *cleanup; +@@ -1763,8 +1763,8 @@ read_pieced_value (struct value *v) + for (i = 0; i < c->n_pieces && offset < type_len; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size, this_size_bits; +- long dest_offset_bits, source_offset_bits, source_offset; ++ ULONGEST this_size, this_size_bits; ++ LONGEST dest_offset_bits, source_offset_bits, source_offset; + const gdb_byte *intermediate_buffer; + + /* Compute size, source, and destination offsets for copying, in +@@ -1913,13 +1913,13 @@ static void + write_pieced_value (struct value *to, struct value *from) + { + int i; +- long offset = 0; ++ LONGEST offset = 0; + ULONGEST bits_to_skip; + const gdb_byte *contents; + struct piece_closure *c + = (struct piece_closure *) value_computed_closure (to); + struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to)); +- size_t type_len; ++ ULONGEST type_len; + size_t buffer_size = 0; + char *buffer = NULL; + struct cleanup *cleanup; +@@ -1947,8 +1947,8 @@ write_pieced_value (struct value *to, st + for (i = 0; i < c->n_pieces && offset < type_len; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size_bits, this_size; +- long dest_offset_bits, source_offset_bits, dest_offset, source_offset; ++ ULONGEST this_size_bits, this_size; ++ LONGEST dest_offset_bits, source_offset_bits, dest_offset, source_offset; + int need_bitwise; + const gdb_byte *source_buffer; + +@@ -2077,8 +2077,8 @@ write_pieced_value (struct value *to, st + implicit pointer. */ + + static int +-check_pieced_value_bits (const struct value *value, int bit_offset, +- int bit_length, ++check_pieced_value_bits (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length, + enum dwarf_value_location check_for) + { + struct piece_closure *c +@@ -2094,7 +2094,7 @@ check_pieced_value_bits (const struct va + for (i = 0; i < c->n_pieces && bit_length > 0; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size_bits = p->size; ++ ULONGEST this_size_bits = p->size; + + if (bit_offset > 0) + { +@@ -2132,8 +2132,8 @@ check_pieced_value_bits (const struct va + } + + static int +-check_pieced_value_validity (const struct value *value, int bit_offset, +- int bit_length) ++check_pieced_value_validity (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length) + { + return check_pieced_value_bits (value, bit_offset, bit_length, + DWARF_VALUE_MEMORY); +@@ -2151,8 +2151,8 @@ check_pieced_value_invalid (const struct + a synthetic pointer. */ + + static int +-check_pieced_synthetic_pointer (const struct value *value, int bit_offset, +- int bit_length) ++check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length) + { + return check_pieced_value_bits (value, bit_offset, bit_length, + DWARF_VALUE_IMPLICIT_POINTER); +@@ -2177,9 +2177,10 @@ indirect_pieced_value (struct value *val + struct type *type; + struct frame_info *frame; + struct dwarf2_locexpr_baton baton; +- int i, bit_offset, bit_length; ++ int i; ++ LONGEST bit_length; + struct dwarf_expr_piece *piece = NULL; +- LONGEST byte_offset; ++ LONGEST byte_offset, bit_offset; + + type = check_typedef (value_type (value)); + if (TYPE_CODE (type) != TYPE_CODE_PTR) +@@ -2193,7 +2194,7 @@ indirect_pieced_value (struct value *val + for (i = 0; i < c->n_pieces && bit_length > 0; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size_bits = p->size; ++ ULONGEST this_size_bits = p->size; + + if (bit_offset > 0) + { +@@ -2409,7 +2410,7 @@ dwarf2_evaluate_loc_desc_full (struct ty + struct value *value = dwarf_expr_fetch (ctx, 0); + gdb_byte *contents; + const gdb_byte *val_bytes; +- size_t n = TYPE_LENGTH (value_type (value)); ++ ULONGEST n = TYPE_LENGTH (value_type (value)); + + if (byte_offset + TYPE_LENGTH (type) > n) + invalid_synthetic_pointer (); +Index: gdb-7.6.1/gdb/dwarf2read.c +=================================================================== +--- gdb-7.6.1.orig/gdb/dwarf2read.c 2013-08-30 21:54:18.741367540 +0200 ++++ gdb-7.6.1/gdb/dwarf2read.c 2013-08-30 21:54:20.460368192 +0200 +@@ -1227,12 +1227,12 @@ dwarf2_complex_location_expr_complaint ( + } + + static void +-dwarf2_const_value_length_mismatch_complaint (const char *arg1, int arg2, +- int arg3) ++dwarf2_const_value_length_mismatch_complaint (const char *arg1, LONGEST arg2, ++ LONGEST arg3) + { + complaint (&symfile_complaints, +- _("const value length mismatch for '%s', got %d, expected %d"), +- arg1, arg2, arg3); ++ _("const value length mismatch for '%s', got %s, expected %s"), ++ arg1, plongest (arg2), plongest (arg3)); + } + + static void +@@ -10647,8 +10647,8 @@ dwarf2_add_field (struct field_info *fip + object, and then subtract off the number of bits of + the field itself. The result is the bit offset of + the LSB of the field. */ +- int anonymous_size; +- int bit_offset = DW_UNSND (attr); ++ LONGEST anonymous_size; ++ LONGEST bit_offset = DW_UNSND (attr); + + attr = dwarf2_attr (die, DW_AT_byte_size, cu); + if (attr) +Index: gdb-7.6.1/gdb/eval.c +=================================================================== +--- gdb-7.6.1.orig/gdb/eval.c 2013-08-30 21:54:18.743367540 +0200 ++++ gdb-7.6.1/gdb/eval.c 2013-08-30 21:54:20.461368192 +0200 +@@ -294,7 +294,8 @@ evaluate_struct_tuple (struct value *str + while (--nargs >= 0) + { + struct value *val = NULL; +- int bitpos, bitsize; ++ LONGEST bitpos; ++ int bitsize; + bfd_byte *addr; + + fieldno++; +@@ -356,7 +357,7 @@ init_array_element (struct value *array, + enum noside noside, LONGEST low_bound, LONGEST high_bound) + { + LONGEST index; +- int element_size = TYPE_LENGTH (value_type (element)); ++ LONGEST element_size = TYPE_LENGTH (value_type (element)); + + if (exp->elts[*pos].opcode == BINOP_COMMA) + { +@@ -709,11 +710,11 @@ binop_promote (const struct language_def + /* FIXME: Also mixed integral/booleans, with result an integer. */ + { + const struct builtin_type *builtin = builtin_type (gdbarch); +- unsigned int promoted_len1 = TYPE_LENGTH (type1); +- unsigned int promoted_len2 = TYPE_LENGTH (type2); ++ ULONGEST promoted_len1 = TYPE_LENGTH (type1); ++ ULONGEST promoted_len2 = TYPE_LENGTH (type2); + int is_unsigned1 = TYPE_UNSIGNED (type1); + int is_unsigned2 = TYPE_UNSIGNED (type2); +- unsigned int result_len; ++ ULONGEST result_len; + int unsigned_operation; + + /* Determine type length and signedness after promotion for +@@ -896,7 +897,7 @@ evaluate_subexp_standard (struct type *e + struct value **argvec; + int code; + int ix; +- long mem_offset; ++ LONGEST mem_offset; + struct type **arg_types; + int save_pos1; + struct symbol *function = NULL; +@@ -1076,7 +1077,7 @@ evaluate_subexp_standard (struct type *e + struct type *range_type = TYPE_INDEX_TYPE (type); + struct type *element_type = TYPE_TARGET_TYPE (type); + struct value *array = allocate_value (expect_type); +- int element_size = TYPE_LENGTH (check_typedef (element_type)); ++ LONGEST element_size = TYPE_LENGTH (check_typedef (element_type)); + LONGEST low_bound, high_bound, index; + + if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) +@@ -2078,7 +2079,8 @@ evaluate_subexp_standard (struct type *e + { + struct type *type = value_type (arg1); + struct type *real_type; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct value_print_options opts; + + get_user_print_options (&opts); +Index: gdb-7.6.1/gdb/f-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/f-lang.c 2013-08-30 21:54:18.743367540 +0200 ++++ gdb-7.6.1/gdb/f-lang.c 2013-08-30 21:54:20.461368192 +0200 +@@ -103,7 +103,7 @@ f_printchar (int c, struct type *type, s + + static void + f_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, +- unsigned int length, const char *encoding, int force_ellipses, ++ ULONGEST length, const char *encoding, int force_ellipses, + const struct value_print_options *options) + { + const char *type_encoding = f_get_encoding (type); +Index: gdb-7.6.1/gdb/f-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/f-lang.h 2013-08-30 21:54:18.743367540 +0200 ++++ gdb-7.6.1/gdb/f-lang.h 2013-08-30 21:54:20.461368192 +0200 +@@ -33,7 +33,7 @@ extern const char *f_object_address_data + (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, ++extern void f_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +Index: gdb-7.6.1/gdb/f-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/f-valprint.c 2013-08-30 21:54:18.744367541 +0200 ++++ gdb-7.6.1/gdb/f-valprint.c 2013-08-30 21:54:20.461368192 +0200 +@@ -43,7 +43,7 @@ static void f77_create_arrayprint_offset + struct ui_file *); + static void f77_get_dynamic_length_of_aggregate (struct type *); + +-int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; ++LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; + + /* Array which holds offsets to be applied to get a row's elements + for a given array. Array also holds the size of each subarray. */ +@@ -126,7 +126,7 @@ static void + f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) + { + struct type *tmp_type; +- int eltlen; ++ LONGEST eltlen; + int ndimen = 1; + int upper, lower; + +@@ -171,13 +171,13 @@ f77_create_arrayprint_offset_tbl (struct + static void + f77_print_array_1 (int nss, int ndimensions, struct type *type, + const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, + int *elts) + { +- int i; ++ LONGEST i; + + if (nss != ndimensions) + { +@@ -220,7 +220,7 @@ f77_print_array_1 (int nss, int ndimensi + + static void + f77_print_array (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -263,8 +263,9 @@ static const struct generic_val_print_de + function; they are identical. */ + + void +-f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, ++f_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) + { +@@ -389,7 +390,7 @@ f_val_print (struct type *type, const gd + fprintf_filtered (stream, "( "); + for (index = 0; index < TYPE_NFIELDS (type); index++) + { +- int offset = TYPE_FIELD_BITPOS (type, index) / 8; ++ LONGEST offset = TYPE_FIELD_BITPOS (type, index) / 8; + + val_print (TYPE_FIELD_TYPE (type, index), valaddr, + embedded_offset + offset, +Index: gdb-7.6.1/gdb/findvar.c +=================================================================== +--- gdb-7.6.1.orig/gdb/findvar.c 2013-08-30 21:54:18.744367541 +0200 ++++ gdb-7.6.1/gdb/findvar.c 2013-08-30 21:54:20.462368193 +0200 +@@ -644,7 +644,7 @@ default_value_from_register (struct type + struct frame_info *frame) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + struct value *value = allocate_value (type); + + VALUE_LVAL (value) = lval_register; +@@ -677,10 +677,10 @@ void + read_frame_register_value (struct value *value, struct frame_info *frame) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +- int offset = 0; +- int reg_offset = value_offset (value); ++ LONGEST offset = 0; ++ LONGEST reg_offset = value_offset (value); + int regnum = VALUE_REGNUM (value); +- int len = TYPE_LENGTH (check_typedef (value_type (value))); ++ LONGEST len = TYPE_LENGTH (check_typedef (value_type (value))); + + gdb_assert (VALUE_LVAL (value) == lval_register); + +@@ -695,7 +695,7 @@ read_frame_register_value (struct value + while (len > 0) + { + struct value *regval = get_frame_register_value (frame, regnum); +- int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset; ++ LONGEST reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset; + + if (value_optimized_out (regval)) + { +Index: gdb-7.6.1/gdb/frame.c +=================================================================== +--- gdb-7.6.1.orig/gdb/frame.c 2013-08-30 21:54:18.744367541 +0200 ++++ gdb-7.6.1/gdb/frame.c 2013-08-30 21:54:20.462368193 +0200 +@@ -1113,7 +1113,7 @@ deprecated_frame_register_read (struct f + + int + get_frame_register_bytes (struct frame_info *frame, int regnum, +- CORE_ADDR offset, int len, gdb_byte *myaddr, ++ CORE_ADDR offset, LONGEST len, gdb_byte *myaddr, + int *optimizedp, int *unavailablep) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +@@ -1142,7 +1142,7 @@ get_frame_register_bytes (struct frame_i + } + if (len > maxsize) + error (_("Bad debug information detected: " +- "Attempt to read %d bytes from registers."), len); ++ "Attempt to read %s bytes from registers."), plongest (len)); + + /* Copy the data. */ + while (len > 0) +Index: gdb-7.6.1/gdb/frame.h +=================================================================== +--- gdb-7.6.1.orig/gdb/frame.h 2013-08-30 21:54:18.745367541 +0200 ++++ gdb-7.6.1/gdb/frame.h 2013-08-30 21:54:20.462368193 +0200 +@@ -532,7 +532,7 @@ extern void put_frame_register (struct f + contents are optimized out or unavailable, set *OPTIMIZEDP, + *UNAVAILABLEP accordingly. */ + extern int get_frame_register_bytes (struct frame_info *frame, int regnum, +- CORE_ADDR offset, int len, ++ CORE_ADDR offset, LONGEST len, + gdb_byte *myaddr, + int *optimizedp, int *unavailablep); + +Index: gdb-7.6.1/gdb/gdbtypes.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbtypes.c 2013-08-30 21:54:18.746367542 +0200 ++++ gdb-7.6.1/gdb/gdbtypes.c 2013-08-30 21:54:20.463368193 +0200 +@@ -2090,7 +2090,7 @@ allocate_gnat_aux_type (struct type *typ + least as long as OBJFILE. */ + + struct type * +-init_type (enum type_code code, int length, int flags, ++init_type (enum type_code code, LONGEST length, int flags, + const char *name, struct objfile *objfile) + { + struct type *type; +@@ -2321,8 +2321,8 @@ is_public_ancestor (struct type *base, s + + static int + is_unique_ancestor_worker (struct type *base, struct type *dclass, +- int *offset, +- const gdb_byte *valaddr, int embedded_offset, ++ LONGEST *offset, ++ const gdb_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, struct value *val) + { + int i, count = 0; +@@ -2333,7 +2333,7 @@ is_unique_ancestor_worker (struct type * + for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i) + { + struct type *iter; +- int this_offset; ++ LONGEST this_offset; + + iter = check_typedef (TYPE_BASECLASS (dclass, i)); + +@@ -2374,7 +2374,7 @@ is_unique_ancestor_worker (struct type * + int + is_unique_ancestor (struct type *base, struct value *val) + { +- int offset = -1; ++ LONGEST offset = -1; + + return is_unique_ancestor_worker (base, value_type (val), &offset, + value_contents_for_printing (val), +@@ -3283,7 +3283,7 @@ recursive_dump_type (struct type *type, + break; + } + puts_filtered ("\n"); +- printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type)); ++ printfi_filtered (spaces, "length %s\n", pulongest (TYPE_LENGTH (type))); + if (TYPE_OBJFILE_OWNED (type)) + { + printfi_filtered (spaces, "objfile "); +@@ -3407,8 +3407,8 @@ recursive_dump_type (struct type *type, + idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); + else + printfi_filtered (spaces + 2, +- "[%d] bitpos %d bitsize %d type ", +- idx, TYPE_FIELD_BITPOS (type, idx), ++ "[%d] bitpos %s bitsize %d type ", ++ idx, plongest (TYPE_FIELD_BITPOS (type, idx)), + TYPE_FIELD_BITSIZE (type, idx)); + gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout); + printf_filtered (" name '%s' (", +@@ -3922,7 +3922,7 @@ copy_type (const struct type *type) + + struct type * + arch_type (struct gdbarch *gdbarch, +- enum type_code code, int length, char *name) ++ enum type_code code, LONGEST length, char *name) + { + struct type *type; + +Index: gdb-7.6.1/gdb/gdbtypes.h +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbtypes.h 2013-08-30 21:54:18.747367542 +0200 ++++ gdb-7.6.1/gdb/gdbtypes.h 2013-08-30 21:54:20.463368193 +0200 +@@ -606,7 +606,7 @@ struct main_type + gdbarch_bits_big_endian=0 targets, it is the bit offset to + the LSB. */ + +- int bitpos; ++ LONGEST bitpos; + + /* Enum value. */ + LONGEST enumval; +@@ -798,7 +798,7 @@ struct type + HOST_CHAR_BIT. However, this would still fail to address + machines based on a ternary or decimal representation. */ + +- unsigned length; ++ ULONGEST length; + + /* Core type, shared by a group of qualified types. */ + struct main_type *main_type; +@@ -1542,11 +1542,12 @@ extern struct type *alloc_type_copy (con + extern struct gdbarch *get_type_arch (const struct type *); + + /* Helper function to construct objfile-owned types. */ +-extern struct type *init_type (enum type_code, int, int, const char *, ++extern struct type *init_type (enum type_code, LONGEST, int, const char *, + struct objfile *); + + /* Helper functions to construct architecture-owned types. */ +-extern struct type *arch_type (struct gdbarch *, enum type_code, int, char *); ++extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST, ++ char *); + extern struct type *arch_integer_type (struct gdbarch *, int, int, char *); + extern struct type *arch_character_type (struct gdbarch *, int, int, char *); + extern struct type *arch_boolean_type (struct gdbarch *, int, int, char *); +Index: gdb-7.6.1/gdb/gnu-v2-abi.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gnu-v2-abi.c 2013-08-30 21:54:18.747367542 +0200 ++++ gdb-7.6.1/gdb/gnu-v2-abi.c 2013-08-30 21:54:20.464368193 +0200 +@@ -85,7 +85,7 @@ gnuv2_is_operator_name (const char *name + TYPE is the type in which F is located. */ + static struct value * + gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, +- struct type * type, int offset) ++ struct type *type, LONGEST offset) + { + struct value *arg1 = *arg1p; + struct type *type1 = check_typedef (value_type (arg1)); +@@ -186,7 +186,8 @@ gnuv2_virtual_fn_field (struct value **a + + + static struct type * +-gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) ++gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, ++ int *using_enc) + { + struct type *known_type; + struct type *rtti_type; +@@ -341,9 +342,9 @@ vb_match (struct type *type, int index, + target). The result is the offset of the baseclass value relative + to (the address of)(ARG) + OFFSET. */ + +-static int ++static LONGEST + gnuv2_baseclass_offset (struct type *type, int index, +- const bfd_byte *valaddr, int embedded_offset, ++ const bfd_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, const struct value *val) + { + struct type *basetype = TYPE_BASECLASS (type, index); +@@ -361,8 +362,8 @@ gnuv2_baseclass_offset (struct type *typ + if (vb_match (type, i, basetype)) + { + struct type *field_type; +- int field_offset; +- int field_length; ++ LONGEST field_offset; ++ LONGEST field_length; + CORE_ADDR addr; + + field_type = check_typedef (TYPE_FIELD_TYPE (type, i)); +@@ -386,7 +387,7 @@ gnuv2_baseclass_offset (struct type *typ + /* Don't go through baseclass_offset, as that wraps + exceptions, thus, inner exceptions would be wrapped more + than once. */ +- int boffset = ++ LONGEST boffset = + gnuv2_baseclass_offset (type, i, valaddr, + embedded_offset, address, val); + +Index: gdb-7.6.1/gdb/gnu-v3-abi.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gnu-v3-abi.c 2013-08-30 21:54:18.747367542 +0200 ++++ gdb-7.6.1/gdb/gnu-v3-abi.c 2013-08-30 21:54:20.464368193 +0200 +@@ -106,7 +106,7 @@ build_gdb_vtable_type (struct gdbarch *a + { + struct type *t; + struct field *field_list, *field; +- int offset; ++ LONGEST offset; + + struct type *void_ptr_type + = builtin_type (arch)->builtin_data_ptr; +@@ -182,7 +182,7 @@ vtable_ptrdiff_type (struct gdbarch *gdb + /* Return the offset from the start of the imaginary `struct + gdb_gnu_v3_abi_vtable' object to the vtable's "address point" + (i.e., where objects' virtual table pointers point). */ +-static int ++static LONGEST + vtable_address_point_offset (struct gdbarch *gdbarch) + { + struct type *vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data); +@@ -273,7 +273,7 @@ gnuv3_get_vtable (struct gdbarch *gdbarc + + static struct type * + gnuv3_rtti_type (struct value *value, +- int *full_p, int *top_p, int *using_enc_p) ++ int *full_p, LONGEST *top_p, int *using_enc_p) + { + struct gdbarch *gdbarch; + struct type *values_type = check_typedef (value_type (value)); +@@ -385,7 +385,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gd + static struct value * + gnuv3_virtual_fn_field (struct value **value_p, + struct fn_field *f, int j, +- struct type *vfn_base, int offset) ++ struct type *vfn_base, LONGEST offset) + { + struct type *values_type = check_typedef (value_type (*value_p)); + struct gdbarch *gdbarch; +@@ -415,16 +415,16 @@ gnuv3_virtual_fn_field (struct value **v + + -1 is returned on error. */ + +-static int ++static LONGEST + gnuv3_baseclass_offset (struct type *type, int index, +- const bfd_byte *valaddr, int embedded_offset, ++ const bfd_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, const struct value *val) + { + struct gdbarch *gdbarch; + struct type *ptr_type; + struct value *vtable; + struct value *vbase_array; +- long int cur_base_offset, base_offset; ++ LONGEST cur_base_offset, base_offset; + + /* Determine architecture. */ + gdbarch = get_type_arch (type); +@@ -448,7 +448,7 @@ gnuv3_baseclass_offset (struct type *typ + cur_base_offset = cur_base_offset + vtable_address_point_offset (gdbarch); + if ((- cur_base_offset) % TYPE_LENGTH (ptr_type) != 0) + error (_("Misaligned vbase offset.")); +- cur_base_offset = cur_base_offset / ((int) TYPE_LENGTH (ptr_type)); ++ cur_base_offset = cur_base_offset / ((LONGEST) TYPE_LENGTH (ptr_type)); + + vtable = gnuv3_get_vtable (gdbarch, type, address + embedded_offset); + gdb_assert (vtable != NULL); +@@ -492,7 +492,7 @@ gnuv3_find_method_in (struct type *domai + we're out of luck. */ + for (i = 0; i < TYPE_N_BASECLASSES (domain); i++) + { +- int pos; ++ LONGEST pos; + struct type *basetype; + + if (BASETYPE_VIA_VIRTUAL (domain, i)) +Index: gdb-7.6.1/gdb/go-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/go-lang.h 2013-08-30 21:54:18.748367542 +0200 ++++ gdb-7.6.1/gdb/go-lang.h 2013-08-30 21:54:20.464368193 +0200 +@@ -83,7 +83,7 @@ extern void go_print_type (struct type * + /* Defined in go-valprint.c. */ + + extern void go_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options); +Index: gdb-7.6.1/gdb/go-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/go-valprint.c 2013-08-30 21:54:18.748367542 +0200 ++++ gdb-7.6.1/gdb/go-valprint.c 2013-08-30 21:54:20.464368193 +0200 +@@ -37,7 +37,7 @@ + + static void + print_go_string (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options) +@@ -86,9 +86,9 @@ print_go_string (struct type *type, cons + /* Implements the la_val_print routine for language Go. */ + + void +-go_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, +- const struct value *val, ++go_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, const struct value *val, + const struct value_print_options *options) + { + CHECK_TYPEDEF (type); +Index: gdb-7.6.1/gdb/i386-nat.c +=================================================================== +--- gdb-7.6.1.orig/gdb/i386-nat.c 2013-08-30 21:54:18.748367542 +0200 ++++ gdb-7.6.1/gdb/i386-nat.c 2013-08-30 21:54:20.465368194 +0200 +@@ -290,7 +290,7 @@ static int i386_remove_aligned_watchpoin + valid value, bombs through internal_error. */ + static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, + i386_wp_op_t what, +- CORE_ADDR addr, int len, ++ CORE_ADDR addr, LONGEST len, + enum target_hw_bp_type type); + + /* Implementation. */ +@@ -501,8 +501,8 @@ i386_remove_aligned_watchpoint (struct i + + static int + i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, +- i386_wp_op_t what, CORE_ADDR addr, int len, +- enum target_hw_bp_type type) ++ i386_wp_op_t what, CORE_ADDR addr, ++ LONGEST len, enum target_hw_bp_type type) + { + int retval = 0; + int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4; +@@ -662,7 +662,7 @@ i386_remove_watchpoint (CORE_ADDR addr, + address ADDR and whose length is LEN bytes. */ + + static int +-i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) ++i386_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct i386_debug_reg_state *state + = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); +Index: gdb-7.6.1/gdb/inf-ttrace.c +=================================================================== +--- gdb-7.6.1.orig/gdb/inf-ttrace.c 2013-08-30 21:54:18.748367542 +0200 ++++ gdb-7.6.1/gdb/inf-ttrace.c 2013-08-30 21:54:20.465368194 +0200 +@@ -364,7 +364,7 @@ inf_ttrace_can_use_hw_breakpoint (int ty + } + + static int +-inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + return 1; + } +Index: gdb-7.6.1/gdb/jv-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/jv-lang.c 2013-08-30 21:54:18.749367543 +0200 ++++ gdb-7.6.1/gdb/jv-lang.c 2013-08-30 21:54:20.465368194 +0200 +@@ -437,7 +437,7 @@ java_link_class_type (struct gdbarch *gd + for (i = TYPE_N_BASECLASSES (type); i < nfields; i++) + { + int accflags; +- int boffset; ++ LONGEST boffset; + + if (fields == NULL) + { +@@ -887,7 +887,7 @@ java_printchar (int c, struct type *type + static void + java_printstr (struct ui_file *stream, struct type *type, + const gdb_byte *string, +- unsigned int length, const char *encoding, int force_ellipses, ++ ULONGEST length, const char *encoding, int force_ellipses, + const struct value_print_options *options) + { + const char *type_encoding = java_get_encoding (type); +Index: gdb-7.6.1/gdb/jv-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/jv-lang.h 2013-08-30 21:54:18.749367543 +0200 ++++ gdb-7.6.1/gdb/jv-lang.h 2013-08-30 21:54:20.465368194 +0200 +@@ -42,8 +42,8 @@ struct builtin_java_type + + extern const struct builtin_java_type *builtin_java_type (struct gdbarch *); + +-extern void java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, +- struct ui_file *, int, ++extern void java_val_print (struct type *, const gdb_byte *, LONGEST, ++ CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); + +Index: gdb-7.6.1/gdb/jv-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/jv-valprint.c 2013-08-30 21:54:18.749367543 +0200 ++++ gdb-7.6.1/gdb/jv-valprint.c 2013-08-30 21:54:20.466368194 +0200 +@@ -266,7 +266,7 @@ java_value_print (struct value *val, str + + static void + java_print_value_fields (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -465,7 +465,7 @@ java_print_value_fields (struct type *ty + + void + java_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options) +Index: gdb-7.6.1/gdb/language.c +=================================================================== +--- gdb-7.6.1.orig/gdb/language.c 2013-08-30 21:54:18.749367543 +0200 ++++ gdb-7.6.1/gdb/language.c 2013-08-30 21:54:20.466368194 +0200 +@@ -720,7 +720,7 @@ unk_lang_printchar (int c, struct type * + + static void + unk_lang_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + const struct value_print_options *options) + { +@@ -739,7 +739,7 @@ unk_lang_print_type (struct type *type, + + static void + unk_lang_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options) +Index: gdb-7.6.1/gdb/language.h +=================================================================== +--- gdb-7.6.1.orig/gdb/language.h 2013-08-30 21:54:18.750367543 +0200 ++++ gdb-7.6.1/gdb/language.h 2013-08-30 21:54:20.466368194 +0200 +@@ -175,7 +175,7 @@ struct language_defn + struct ui_file * stream); + + void (*la_printstr) (struct ui_file * stream, struct type *elttype, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + const struct value_print_options *); + +@@ -217,7 +217,7 @@ struct language_defn + + void (*la_val_print) (struct type *type, + const gdb_byte *contents, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options); +Index: gdb-7.6.1/gdb/m2-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/m2-lang.c 2013-08-30 21:54:18.750367543 +0200 ++++ gdb-7.6.1/gdb/m2-lang.c 2013-08-30 21:54:20.466368194 +0200 +@@ -103,10 +103,10 @@ m2_printchar (int c, struct type *type, + + static void + m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, +- unsigned int length, const char *encoding, int force_ellipses, ++ ULONGEST length, const char *encoding, int force_ellipses, + const struct value_print_options *options) + { +- unsigned int i; ++ ULONGEST i; + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; +@@ -121,9 +121,9 @@ m2_printstr (struct ui_file *stream, str + { + /* Position of the character we are examining + to see whether it is repeated. */ +- unsigned int rep1; ++ ULONGEST rep1; + /* Number of repetitions we have detected so far. */ +- unsigned int reps; ++ ULONGEST reps; + + QUIT; + +@@ -149,7 +149,7 @@ m2_printstr (struct ui_file *stream, str + in_quotes = 0; + } + m2_printchar (string[i], type, stream); +- fprintf_filtered (stream, " ", reps); ++ fprintf_filtered (stream, " ", pulongest (reps)); + i = rep1 - 1; + things_printed += options->repeat_count_threshold; + need_comma = 1; +Index: gdb-7.6.1/gdb/m2-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/m2-lang.h 2013-08-30 21:54:18.750367543 +0200 ++++ gdb-7.6.1/gdb/m2-lang.h 2013-08-30 21:54:20.466368194 +0200 +@@ -33,7 +33,7 @@ extern void m2_print_typedef (struct typ + extern int m2_is_long_set (struct type *type); + extern int m2_is_unbounded_array (struct type *type); + +-extern void m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, ++extern void m2_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +Index: gdb-7.6.1/gdb/m2-typeprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/m2-typeprint.c 2013-08-30 21:54:18.750367543 +0200 ++++ gdb-7.6.1/gdb/m2-typeprint.c 2013-08-30 21:54:20.466368194 +0200 +@@ -233,9 +233,12 @@ static void m2_array (struct type *type, + m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 1); + } + else +- fprintf_filtered (stream, "%d", +- (TYPE_LENGTH (type) +- / TYPE_LENGTH (TYPE_TARGET_TYPE (type)))); ++ { ++ ULONGEST val = (TYPE_LENGTH (type) ++ / TYPE_LENGTH (TYPE_TARGET_TYPE (type))); ++ ++ fprintf_filtered (stream, "%s", pulongest (val)); ++ } + } + fprintf_filtered (stream, "] OF "); + m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); +Index: gdb-7.6.1/gdb/m2-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/m2-valprint.c 2013-08-30 21:54:18.751367544 +0200 ++++ gdb-7.6.1/gdb/m2-valprint.c 2013-08-30 21:54:20.467368194 +0200 +@@ -35,7 +35,7 @@ static int print_unpacked_pointer (struc + struct ui_file *stream); + static void + m2_print_array_contents (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -67,7 +67,7 @@ get_long_set_bounds (struct type *type, + + static void + m2_print_long_set (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream) + { + int empty_set = 1; +@@ -158,7 +158,7 @@ m2_print_long_set (struct type *type, co + + static void + m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value_print_options *options) + { +@@ -262,7 +262,7 @@ print_variable_at_address (struct type * + + static void + m2_print_array_contents (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -308,14 +308,15 @@ static const struct generic_val_print_de + function; they are identical. */ + + void +-m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, ++m2_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) + { + struct gdbarch *gdbarch = get_type_arch (type); +- unsigned int i = 0; /* Number of characters printed. */ +- unsigned len; ++ ULONGEST i = 0; /* Number of characters printed. */ ++ ULONGEST len; + struct type *elttype; + CORE_ADDR addr; + +@@ -340,7 +341,7 @@ m2_val_print (struct type *type, const g + elements up to it. */ + if (options->stop_print_at_null) + { +- unsigned int temp_len; ++ ULONGEST temp_len; + + /* Look for a NULL char. */ + for (temp_len = 0; +Index: gdb-7.6.1/gdb/memrange.c +=================================================================== +--- gdb-7.6.1.orig/gdb/memrange.c 2013-08-30 21:54:18.751367544 +0200 ++++ gdb-7.6.1/gdb/memrange.c 2013-08-30 21:54:20.467368194 +0200 +@@ -21,8 +21,8 @@ + #include "memrange.h" + + int +-mem_ranges_overlap (CORE_ADDR start1, int len1, +- CORE_ADDR start2, int len2) ++mem_ranges_overlap (CORE_ADDR start1, LONGEST len1, ++ CORE_ADDR start2, LONGEST len2) + { + ULONGEST h, l; + +Index: gdb-7.6.1/gdb/memrange.h +=================================================================== +--- gdb-7.6.1.orig/gdb/memrange.h 2013-08-30 21:54:18.751367544 +0200 ++++ gdb-7.6.1/gdb/memrange.h 2013-08-30 21:54:20.467368194 +0200 +@@ -30,7 +30,7 @@ struct mem_range + CORE_ADDR start; + + /* Length of the range. */ +- int length; ++ LONGEST length; + }; + + typedef struct mem_range mem_range_s; +@@ -40,8 +40,8 @@ DEF_VEC_O(mem_range_s); + /* Returns true if the ranges defined by [start1, start1+len1) and + [start2, start2+len2) overlap. */ + +-extern int mem_ranges_overlap (CORE_ADDR start1, int len1, +- CORE_ADDR start2, int len2); ++extern int mem_ranges_overlap (CORE_ADDR start1, LONGEST len1, ++ CORE_ADDR start2, LONGEST len2); + + /* Sort ranges by start address, then coalesce contiguous or + overlapping ranges. */ +Index: gdb-7.6.1/gdb/mips-linux-nat.c +=================================================================== +--- gdb-7.6.1.orig/gdb/mips-linux-nat.c 2013-08-30 21:54:18.751367544 +0200 ++++ gdb-7.6.1/gdb/mips-linux-nat.c 2013-08-30 21:54:20.467368194 +0200 +@@ -938,7 +938,7 @@ try_one_watch (struct pt_watch_regs *reg + the specified region can be covered by the watch registers. */ + + static int +-mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct pt_watch_regs dummy_regs; + int i; +Index: gdb-7.6.1/gdb/opencl-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/opencl-lang.c 2013-08-30 21:54:18.752367544 +0200 ++++ gdb-7.6.1/gdb/opencl-lang.c 2013-08-30 21:54:20.468368195 +0200 +@@ -80,11 +80,11 @@ builtin_opencl_type (struct gdbarch *gdb + + static struct type * + lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, +- unsigned int el_length, unsigned int flag_unsigned, ++ ULONGEST el_length, unsigned int flag_unsigned, + int n) + { + int i; +- unsigned int length; ++ ULONGEST length; + struct type *type = NULL; + struct type **types = builtin_opencl_type (gdbarch); + +@@ -174,9 +174,9 @@ lval_func_read (struct value *v) + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + struct type *type = check_typedef (value_type (v)); + struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); +- int offset = value_offset (v); +- int elsize = TYPE_LENGTH (eltype); +- int n, i, j = 0; ++ LONGEST offset = value_offset (v); ++ LONGEST elsize = TYPE_LENGTH (eltype); ++ LONGEST n, i, j = 0; + LONGEST lowb = 0; + LONGEST highb = 0; + +@@ -203,9 +203,9 @@ lval_func_write (struct value *v, struct + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + struct type *type = check_typedef (value_type (v)); + struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); +- int offset = value_offset (v); +- int elsize = TYPE_LENGTH (eltype); +- int n, i, j = 0; ++ LONGEST offset = value_offset (v); ++ LONGEST elsize = TYPE_LENGTH (eltype); ++ LONGEST n, i, j = 0; + LONGEST lowb = 0; + LONGEST highb = 0; + +@@ -243,17 +243,18 @@ lval_func_write (struct value *v, struct + /* Return nonzero if all bits in V within OFFSET and LENGTH are valid. */ + + static int +-lval_func_check_validity (const struct value *v, int offset, int length) ++lval_func_check_validity (const struct value *v, LONGEST offset, ++ LONGEST length) + { + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); ++ struct type *t = check_typedef (value_type (c->val)); + /* Size of the target type in bits. */ +- int elsize = +- TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; +- int startrest = offset % elsize; +- int start = offset / elsize; +- int endrest = (offset + length) % elsize; +- int end = (offset + length) / elsize; +- int i; ++ LONGEST elsize = TYPE_LENGTH (TYPE_TARGET_TYPE (t)) * 8; ++ LONGEST startrest = offset % elsize; ++ LONGEST start = offset / elsize; ++ LONGEST endrest = (offset + length) % elsize; ++ LONGEST end = (offset + length) / elsize; ++ LONGEST i; + + if (endrest) + end++; +@@ -263,8 +264,8 @@ lval_func_check_validity (const struct v + + for (i = start; i < end; i++) + { +- int comp_offset = (i == start) ? startrest : 0; +- int comp_length = (i == end) ? endrest : elsize; ++ LONGEST comp_offset = (i == start) ? startrest : 0; ++ LONGEST comp_length = (i == end) ? endrest : elsize; + + if (!value_bits_valid (c->val, c->indices[i] * elsize + comp_offset, + comp_length)) +@@ -281,8 +282,8 @@ lval_func_check_any_valid (const struct + { + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + /* Size of the target type in bits. */ +- int elsize = +- TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; ++ LONGEST elsize = ++ TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; + int i; + + for (i = 0; i < c->n; i++) +@@ -297,17 +298,17 @@ lval_func_check_any_valid (const struct + + static int + lval_func_check_synthetic_pointer (const struct value *v, +- int offset, int length) ++ LONGEST offset, LONGEST length) + { + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + /* Size of the target type in bits. */ +- int elsize = +- TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; +- int startrest = offset % elsize; +- int start = offset / elsize; +- int endrest = (offset + length) % elsize; +- int end = (offset + length) / elsize; +- int i; ++ LONGEST elsize = ++ TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; ++ LONGEST startrest = offset % elsize; ++ LONGEST start = offset / elsize; ++ LONGEST endrest = (offset + length) % elsize; ++ LONGEST end = (offset + length) / elsize; ++ LONGEST i; + + if (endrest) + end++; +@@ -317,8 +318,8 @@ lval_func_check_synthetic_pointer (const + + for (i = start; i < end; i++) + { +- int comp_offset = (i == start) ? startrest : 0; +- int comp_length = (i == end) ? endrest : elsize; ++ LONGEST comp_offset = (i == start) ? startrest : 0; ++ LONGEST comp_length = (i == end) ? endrest : elsize; + + if (!value_bits_synthetic_pointer (c->val, + c->indices[i] * elsize + comp_offset, +Index: gdb-7.6.1/gdb/p-lang.c +=================================================================== +--- gdb-7.6.1.orig/gdb/p-lang.c 2013-08-30 21:54:18.752367544 +0200 ++++ gdb-7.6.1/gdb/p-lang.c 2013-08-30 21:54:20.468368195 +0200 +@@ -95,8 +95,8 @@ pascal_main_name (void) + are not multiple of TARGET_CHAR_BIT then the results are wrong + but this does not happen for Free Pascal nor for GPC. */ + int +-is_pascal_string_type (struct type *type,int *length_pos, +- int *length_size, int *string_pos, ++is_pascal_string_type (struct type *type, LONGEST *length_pos, ++ LONGEST *length_size, LONGEST *string_pos, + struct type **char_type, + const char **arrayname) + { +@@ -216,12 +216,12 @@ pascal_printchar (int c, struct type *ty + + void + pascal_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + const struct value_print_options *options) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); +- unsigned int i; ++ ULONGEST i; + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; +@@ -249,9 +249,9 @@ pascal_printstr (struct ui_file *stream, + { + /* Position of the character we are examining + to see whether it is repeated. */ +- unsigned int rep1; ++ ULONGEST rep1; + /* Number of repetitions we have detected so far. */ +- unsigned int reps; ++ ULONGEST reps; + unsigned long int current_char; + + QUIT; +@@ -283,7 +283,7 @@ pascal_printstr (struct ui_file *stream, + in_quotes = 0; + } + pascal_printchar (current_char, type, stream); +- fprintf_filtered (stream, " ", reps); ++ fprintf_filtered (stream, " ", pulongest (reps)); + i = rep1 - 1; + things_printed += options->repeat_count_threshold; + need_comma = 1; +Index: gdb-7.6.1/gdb/p-lang.h +=================================================================== +--- gdb-7.6.1.orig/gdb/p-lang.h 2013-08-30 21:54:18.752367544 +0200 ++++ gdb-7.6.1/gdb/p-lang.h 2013-08-30 21:54:20.468368195 +0200 +@@ -35,7 +35,7 @@ extern void pascal_print_type (struct ty + extern void pascal_print_typedef (struct type *, struct symbol *, + struct ui_file *); + +-extern void pascal_val_print (struct type *, const gdb_byte *, int, ++extern void pascal_val_print (struct type *, const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -49,13 +49,13 @@ extern void pascal_type_print_method_arg + /* These are in p-lang.c: */ + + extern int +- is_pascal_string_type (struct type *, int *, int *, int *, ++ is_pascal_string_type (struct type *, LONGEST *, LONGEST *, LONGEST *, + struct type **, const char **); + + extern void pascal_printchar (int, struct type *, struct ui_file *); + + extern void pascal_printstr (struct ui_file *, struct type *, const gdb_byte *, +- unsigned int, const char *, int, ++ ULONGEST, const char *, int, + const struct value_print_options *); + + extern struct type **const (pascal_builtin_types[]); +@@ -71,7 +71,7 @@ extern void + const struct type_print_options *); + + extern void pascal_object_print_value_fields (struct type *, const gdb_byte *, +- int, ++ LONGEST, + CORE_ADDR, struct ui_file *, + int, + const struct value *, +Index: gdb-7.6.1/gdb/p-valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/p-valprint.c 2013-08-30 21:54:18.753367544 +0200 ++++ gdb-7.6.1/gdb/p-valprint.c 2013-08-30 21:54:20.468368195 +0200 +@@ -58,7 +58,7 @@ static const struct generic_val_print_de + + void + pascal_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) +@@ -69,8 +69,8 @@ pascal_val_print (struct type *type, con + unsigned len; + LONGEST low_bound, high_bound; + struct type *elttype; +- unsigned eltlen; +- int length_pos, length_size, string_pos; ++ ULONGEST eltlen; ++ LONGEST length_pos, length_size, string_pos; + struct type *char_type; + CORE_ADDR addr; + int want_space = 0; +@@ -493,7 +493,7 @@ static void pascal_object_print_static_f + const struct value_print_options *); + + static void pascal_object_print_value (struct type *, const gdb_byte *, +- int, ++ LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *, +@@ -552,7 +552,7 @@ pascal_object_is_vtbl_member (struct typ + + void + pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -728,7 +728,7 @@ pascal_object_print_value_fields (struct + + static void + pascal_object_print_value (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -751,11 +751,11 @@ pascal_object_print_value (struct type * + + for (i = 0; i < n_baseclasses; i++) + { +- int boffset = 0; ++ LONGEST boffset = 0; + struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); + const char *basename = type_name_no_tag (baseclass); + const gdb_byte *base_valaddr = NULL; +- int thisoffset; ++ LONGEST thisoffset; + volatile struct gdb_exception ex; + int skip = 0; + +Index: gdb-7.6.1/gdb/ppc-linux-nat.c +=================================================================== +--- gdb-7.6.1.orig/gdb/ppc-linux-nat.c 2013-08-30 21:54:18.753367544 +0200 ++++ gdb-7.6.1/gdb/ppc-linux-nat.c 2013-08-30 21:54:20.469368195 +0200 +@@ -1492,7 +1492,7 @@ ppc_linux_can_use_hw_breakpoint (int typ + } + + static int +-ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + /* Handle sub-8-byte quantities. */ + if (len <= 0) +Index: gdb-7.6.1/gdb/printcmd.c +=================================================================== +--- gdb-7.6.1.orig/gdb/printcmd.c 2013-08-30 21:54:18.754367545 +0200 ++++ gdb-7.6.1/gdb/printcmd.c 2013-08-30 21:54:20.469368195 +0200 +@@ -290,7 +290,7 @@ print_formatted (struct value *val, int + struct ui_file *stream) + { + struct type *type = check_typedef (value_type (val)); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (VALUE_LVAL (val) == lval_memory) + next_address = value_address (val) + len; +@@ -368,7 +368,7 @@ print_scalar_formatted (const void *vala + { + struct gdbarch *gdbarch = get_type_arch (type); + LONGEST val_long = 0; +- unsigned int len = TYPE_LENGTH (type); ++ ULONGEST len = TYPE_LENGTH (type); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + + /* String printing should go through val_print_scalar_formatted. */ +Index: gdb-7.6.1/gdb/procfs.c +=================================================================== +--- gdb-7.6.1.orig/gdb/procfs.c 2013-08-30 21:54:18.755367545 +0200 ++++ gdb-7.6.1/gdb/procfs.c 2013-08-30 21:54:20.470368196 +0200 +@@ -4926,7 +4926,7 @@ procfs_remove_watchpoint (CORE_ADDR addr + } + + static int +-procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + /* The man page for proc(4) on Solaris 2.6 and up says that the + system can support "thousands" of hardware watchpoints, but gives +Index: gdb-7.6.1/gdb/python/py-prettyprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/python/py-prettyprint.c 2013-08-30 21:54:18.755367545 +0200 ++++ gdb-7.6.1/gdb/python/py-prettyprint.c 2013-08-30 21:54:20.470368196 +0200 +@@ -689,7 +689,7 @@ print_children (PyObject *printer, const + + int + apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -837,7 +837,7 @@ gdbpy_default_visualizer (PyObject *self + + int + apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +Index: gdb-7.6.1/gdb/python/python.h +=================================================================== +--- gdb-7.6.1.orig/gdb/python/python.h 2013-08-30 21:54:18.755367545 +0200 ++++ gdb-7.6.1/gdb/python/python.h 2013-08-30 21:54:20.470368196 +0200 +@@ -37,7 +37,7 @@ void source_python_script (FILE *file, c + 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, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +Index: gdb-7.6.1/gdb/regcache.c +=================================================================== +--- gdb-7.6.1.orig/gdb/regcache.c 2013-08-30 21:54:18.756367545 +0200 ++++ gdb-7.6.1/gdb/regcache.c 2013-08-30 21:54:20.471368196 +0200 +@@ -899,7 +899,7 @@ typedef void (regcache_write_ftype) (str + + static enum register_status + regcache_xfer_part (struct regcache *regcache, int regnum, +- int offset, int len, void *in, const void *out, ++ LONGEST offset, LONGEST len, void *in, const void *out, + enum register_status (*read) (struct regcache *regcache, + int regnum, + gdb_byte *buf), +@@ -943,7 +943,7 @@ regcache_xfer_part (struct regcache *reg + + enum register_status + regcache_raw_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf) ++ int offset, LONGEST len, gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -954,7 +954,7 @@ regcache_raw_read_part (struct regcache + + void + regcache_raw_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf) ++ int offset, LONGEST len, const gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -965,7 +965,7 @@ regcache_raw_write_part (struct regcache + + enum register_status + regcache_cooked_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf) ++ LONGEST offset, LONGEST len, gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -976,7 +976,7 @@ regcache_cooked_read_part (struct regcac + + void + regcache_cooked_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf) ++ LONGEST offset, LONGEST len, const gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +Index: gdb-7.6.1/gdb/regcache.h +=================================================================== +--- gdb-7.6.1.orig/gdb/regcache.h 2013-08-30 21:54:18.756367545 +0200 ++++ gdb-7.6.1/gdb/regcache.h 2013-08-30 21:54:20.471368196 +0200 +@@ -89,9 +89,9 @@ extern void regcache_raw_write_unsigned + + extern enum register_status + regcache_raw_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf); ++ int offset, LONGEST len, gdb_byte *buf); + void regcache_raw_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf); ++ int offset, LONGEST len, const gdb_byte *buf); + + void regcache_invalidate (struct regcache *regcache, int regnum); + +@@ -128,10 +128,11 @@ extern void regcache_cooked_write_unsign + write style operations. */ + + enum register_status regcache_cooked_read_part (struct regcache *regcache, +- int regnum, int offset, +- int len, gdb_byte *buf); ++ int regnum, LONGEST offset, ++ LONGEST len, gdb_byte *buf); + void regcache_cooked_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf); ++ LONGEST offset, LONGEST len, ++ const gdb_byte *buf); + + /* Special routines to read/write the PC. */ + +Index: gdb-7.6.1/gdb/remote.c +=================================================================== +--- gdb-7.6.1.orig/gdb/remote.c 2013-08-30 21:54:18.758367546 +0200 ++++ gdb-7.6.1/gdb/remote.c 2013-08-30 21:54:20.472368196 +0200 +@@ -8272,7 +8272,7 @@ int remote_hw_watchpoint_length_limit = + int remote_hw_breakpoint_limit = -1; + + static int +-remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + if (remote_hw_watchpoint_length_limit == 0) + return 0; +Index: gdb-7.6.1/gdb/s390-nat.c +=================================================================== +--- gdb-7.6.1.orig/gdb/s390-nat.c 2013-08-30 21:54:18.759367547 +0200 ++++ gdb-7.6.1/gdb/s390-nat.c 2013-08-30 21:54:20.473368197 +0200 +@@ -571,7 +571,7 @@ s390_can_use_hw_breakpoint (int type, in + } + + static int +-s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt) ++s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST cnt) + { + return 1; + } +Index: gdb-7.6.1/gdb/spu-multiarch.c +=================================================================== +--- gdb-7.6.1.orig/gdb/spu-multiarch.c 2013-08-30 21:54:18.759367547 +0200 ++++ gdb-7.6.1/gdb/spu-multiarch.c 2013-08-30 21:54:20.473368197 +0200 +@@ -118,7 +118,7 @@ spu_thread_architecture (struct target_o + + /* Override the to_region_ok_for_hw_watchpoint routine. */ + static int +-spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct target_ops *ops_beneath = find_target_beneath (&spu_ops); + while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint) +Index: gdb-7.6.1/gdb/stack.c +=================================================================== +--- gdb-7.6.1.orig/gdb/stack.c 2013-08-30 21:54:18.759367547 +0200 ++++ gdb-7.6.1/gdb/stack.c 2013-08-30 21:54:20.473368197 +0200 +@@ -174,7 +174,7 @@ print_stack_frame (struct frame_info *fr + argument (not just the first nameless argument). */ + + static void +-print_frame_nameless_args (struct frame_info *frame, long start, int num, ++print_frame_nameless_args (struct frame_info *frame, LONGEST start, int num, + int first, struct ui_file *stream) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +@@ -519,7 +519,7 @@ print_frame_args (struct symbol *func, s + /* Offset of next stack argument beyond the one we have seen that is + at the highest offset, or -1 if we haven't come to a stack + argument yet. */ +- long highest_offset = -1; ++ LONGEST highest_offset = -1; + /* Number of ints of arguments that we have printed so far. */ + int args_printed = 0; + struct cleanup *old_chain; +@@ -557,8 +557,8 @@ print_frame_args (struct symbol *func, s + case LOC_ARG: + case LOC_REF_ARG: + { +- long current_offset = SYMBOL_VALUE (sym); +- int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); ++ LONGEST current_offset = SYMBOL_VALUE (sym); ++ LONGEST arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); + + /* Compute address of next argument by adding the size of + this argument and rounding to an int boundary. */ +@@ -693,7 +693,7 @@ print_frame_args (struct symbol *func, s + enough about the stack to find them. */ + if (num != -1) + { +- long start; ++ LONGEST start; + + if (highest_offset == -1) + start = gdbarch_frame_args_skip (get_frame_arch (frame)); +Index: gdb-7.6.1/gdb/symmisc.c +=================================================================== +--- gdb-7.6.1.orig/gdb/symmisc.c 2013-08-30 21:54:18.760367547 +0200 ++++ gdb-7.6.1/gdb/symmisc.c 2013-08-30 21:54:20.473368197 +0200 +@@ -527,11 +527,11 @@ print_symbol (void *args) + + case LOC_CONST_BYTES: + { +- unsigned i; ++ ULONGEST i; + struct type *type = check_typedef (SYMBOL_TYPE (symbol)); + +- fprintf_filtered (outfile, "const %u hex bytes:", +- TYPE_LENGTH (type)); ++ fprintf_filtered (outfile, "const %s hex bytes:", ++ pulongest (TYPE_LENGTH (type))); + for (i = 0; i < TYPE_LENGTH (type); i++) + fprintf_filtered (outfile, " %02x", + (unsigned) SYMBOL_VALUE_BYTES (symbol)[i]); +Index: gdb-7.6.1/gdb/target.c +=================================================================== +--- gdb-7.6.1.orig/gdb/target.c 2013-08-30 21:54:18.761367547 +0200 ++++ gdb-7.6.1/gdb/target.c 2013-08-30 21:54:20.474368197 +0200 +@@ -51,7 +51,7 @@ static void default_terminal_info (char + static int default_watchpoint_addr_within_range (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); + +-static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int); ++static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + + static void tcomplain (void) ATTRIBUTE_NORETURN; + +@@ -127,7 +127,7 @@ static int debug_to_stopped_data_address + static int debug_to_watchpoint_addr_within_range (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); + +-static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int); ++static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + + static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, + struct expression *); +@@ -3577,7 +3577,7 @@ target_fileio_read_stralloc (const char + + + static int +-default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++default_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT); + } +@@ -4600,7 +4600,7 @@ debug_to_can_use_hw_breakpoint (int type + } + + static int +-debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + CORE_ADDR retval; + +Index: gdb-7.6.1/gdb/target.h +=================================================================== +--- gdb-7.6.1.orig/gdb/target.h 2013-08-30 21:54:18.761367547 +0200 ++++ gdb-7.6.1/gdb/target.h 2013-08-30 21:54:20.475368197 +0200 +@@ -485,7 +485,7 @@ struct target_ops + + /* Documentation of this routine is provided with the corresponding + target_* macro. */ +- int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int); ++ int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); + + int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, + struct expression *); +Index: gdb-7.6.1/gdb/tracepoint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/tracepoint.c 2013-08-30 21:54:18.763367548 +0200 ++++ gdb-7.6.1/gdb/tracepoint.c 2013-08-30 21:54:20.475368197 +0200 +@@ -959,13 +959,13 @@ add_register (struct collection_list *co + static void + add_memrange (struct collection_list *memranges, + int type, bfd_signed_vma base, +- unsigned long len) ++ ULONGEST len) + { + if (info_verbose) + { + printf_filtered ("(%d,", type); + printf_vma (base); +- printf_filtered (",%ld)\n", len); ++ printf_filtered (",%s)\n", pulongest (len)); + } + + /* type: memrange_absolute == memory, other n == basereg */ +@@ -994,7 +994,7 @@ collect_symbol (struct collection_list * + long frame_regno, long frame_offset, + CORE_ADDR scope) + { +- unsigned long len; ++ ULONGEST len; + unsigned int reg; + bfd_signed_vma offset; + int treat_as_expr = 0; +@@ -1018,8 +1018,8 @@ collect_symbol (struct collection_list * + char tmp[40]; + + sprintf_vma (tmp, offset); +- printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n", +- SYMBOL_PRINT_NAME (sym), len, ++ printf_filtered ("LOC_STATIC %s: collect %s bytes at %s.\n", ++ SYMBOL_PRINT_NAME (sym), pulongest (len), + tmp /* address */); + } + /* A struct may be a C++ class with static fields, go to general +@@ -1051,8 +1051,8 @@ collect_symbol (struct collection_list * + offset = frame_offset + SYMBOL_VALUE (sym); + if (info_verbose) + { +- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from frame ptr reg %d\n", reg); + } +@@ -1063,8 +1063,8 @@ collect_symbol (struct collection_list * + offset = 0; + if (info_verbose) + { +- printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_REGPARM_ADDR %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from reg %d\n", reg); + } +@@ -1075,8 +1075,8 @@ collect_symbol (struct collection_list * + offset = frame_offset + SYMBOL_VALUE (sym); + if (info_verbose) + { +- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from frame ptr reg %d\n", reg); + } +@@ -2657,7 +2657,8 @@ scope_info (char *args, int from_tty) + const char *symname; + char *save_args = args; + struct block_iterator iter; +- int j, count = 0; ++ int count = 0; ++ LONGEST j; + struct gdbarch *gdbarch; + int regno; + +@@ -2787,8 +2788,11 @@ scope_info (char *args, int from_tty) + break; + } + if (SYMBOL_TYPE (sym)) +- printf_filtered (", length %d.\n", +- TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)))); ++ { ++ ULONGEST len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))); ++ ++ printf_filtered (", length %s.\n", pulongest (len)); ++ } + } + if (BLOCK_FUNCTION (block)) + break; +Index: gdb-7.6.1/gdb/typeprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/typeprint.c 2013-08-30 21:54:18.763367548 +0200 ++++ gdb-7.6.1/gdb/typeprint.c 2013-08-30 21:54:20.476368198 +0200 +@@ -409,7 +409,7 @@ whatis_exp (char *exp, int show) + struct type *real_type = NULL; + struct type *type; + int full = 0; +- int top = -1; ++ LONGEST top = -1; + int using_enc = 0; + struct value_print_options opts; + struct type_print_options flags = default_ptype_flags; +Index: gdb-7.6.1/gdb/valarith.c +=================================================================== +--- gdb-7.6.1.orig/gdb/valarith.c 2013-08-30 21:54:18.764367548 +0200 ++++ gdb-7.6.1/gdb/valarith.c 2013-08-30 21:54:20.476368198 +0200 +@@ -190,15 +190,15 @@ value_subscript (struct value *array, LO + to doubles, but no longer does. */ + + struct value * +-value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) ++value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST 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_stride ++ ULONGEST elt_size = TYPE_LENGTH (elt_type); ++ ULONGEST 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); ++ ULONGEST elt_offs = elt_stride * longest_to_int (index - lowerbound); + struct value *v; + + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) +@@ -635,7 +635,7 @@ value_concat (struct value *arg1, struct + struct value *inval1; + struct value *inval2; + struct value *outval = NULL; +- int inval1len, inval2len; ++ ssize_t inval1len, inval2len; + int count, idx; + char *ptr; + char inchar; +@@ -1488,7 +1488,7 @@ value_binop (struct value *arg1, struct + int + value_logical_not (struct value *arg1) + { +- int len; ++ LONGEST len; + const gdb_byte *p; + struct type *type1; + +@@ -1519,11 +1519,11 @@ value_logical_not (struct value *arg1) + static int + value_strcmp (struct value *arg1, struct value *arg2) + { +- int len1 = TYPE_LENGTH (value_type (arg1)); +- int len2 = TYPE_LENGTH (value_type (arg2)); ++ LONGEST len1 = TYPE_LENGTH (value_type (arg1)); ++ LONGEST len2 = TYPE_LENGTH (value_type (arg2)); + const gdb_byte *s1 = value_contents (arg1); + const gdb_byte *s2 = value_contents (arg2); +- int i, len = len1 < len2 ? len1 : len2; ++ LONGEST i, len = len1 < len2 ? len1 : len2; + + for (i = 0; i < len; i++) + { +Index: gdb-7.6.1/gdb/valops.c +=================================================================== +--- gdb-7.6.1.orig/gdb/valops.c 2013-08-30 21:54:18.766367549 +0200 ++++ gdb-7.6.1/gdb/valops.c 2013-08-30 21:54:20.477368198 +0200 +@@ -54,11 +54,11 @@ static int typecmp (int staticp, int var + struct field t1[], struct value *t2[]); + + static struct value *search_struct_field (const char *, struct value *, +- int, struct type *, int); ++ LONGEST, struct type *, int); + + static struct value *search_struct_method (const char *, struct value **, + struct value **, +- int, int *, struct type *); ++ LONGEST, int *, struct type *); + + static int find_oload_champ_namespace (struct value **, int, + const char *, const char *, +@@ -86,7 +86,7 @@ oload_classification classify_oload_matc + int, int); + + static struct value *value_struct_elt_for_reference (struct type *, +- int, struct type *, ++ LONGEST, struct type *, + char *, + struct type *, + int, enum noside); +@@ -103,8 +103,8 @@ static CORE_ADDR allocate_space_in_infer + static struct value *cast_into_complex (struct type *, struct value *); + + static struct fn_field *find_method_list (struct value **, const char *, +- int, struct type *, int *, +- struct type **, int *); ++ LONGEST, struct type *, int *, ++ struct type **, LONGEST *); + + void _initialize_valops (void); + +@@ -189,7 +189,7 @@ find_function_in_inferior (const char *n + space. */ + + struct value * +-value_allocate_space_in_inferior (int len) ++value_allocate_space_in_inferior (LONGEST len) + { + struct objfile *objf; + struct value *val = find_function_in_inferior ("malloc", &objf); +@@ -262,7 +262,8 @@ value_cast_structs (struct type *type, s + if (TYPE_NAME (t2) != NULL) + { + /* Try downcasting using the run-time type of the value. */ +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct type *real_type; + + real_type = value_rtti_type (v2, &full, &top, &using_enc); +@@ -401,12 +402,12 @@ value_cast (struct type *type, struct va + if (code1 == TYPE_CODE_ARRAY) + { + struct type *element_type = TYPE_TARGET_TYPE (type); +- unsigned element_length = TYPE_LENGTH (check_typedef (element_type)); ++ ULONGEST element_length = TYPE_LENGTH (check_typedef (element_type)); + + if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + { + struct type *range_type = TYPE_INDEX_TYPE (type); +- int val_length = TYPE_LENGTH (type2); ++ LONGEST val_length = TYPE_LENGTH (type2); + LONGEST low_bound, high_bound, new_length; + + if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) +@@ -640,7 +641,7 @@ value_reinterpret_cast (struct type *typ + static int + dynamic_cast_check_1 (struct type *desired_type, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + CORE_ADDR address, + struct value *val, + struct type *search_type, +@@ -652,8 +653,8 @@ dynamic_cast_check_1 (struct type *desir + + for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) + { +- int offset = baseclass_offset (search_type, i, valaddr, embedded_offset, +- address, val); ++ LONGEST offset = baseclass_offset (search_type, i, valaddr, ++ embedded_offset, address, val); + + if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i))) + { +@@ -687,7 +688,7 @@ dynamic_cast_check_1 (struct type *desir + static int + dynamic_cast_check_2 (struct type *desired_type, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + CORE_ADDR address, + struct value *val, + struct type *search_type, +@@ -697,7 +698,7 @@ dynamic_cast_check_2 (struct type *desir + + for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) + { +- int offset; ++ LONGEST offset; + + if (! BASETYPE_VIA_PUBLIC (search_type, i)) + continue; +@@ -728,7 +729,8 @@ dynamic_cast_check_2 (struct type *desir + struct value * + value_dynamic_cast (struct type *type, struct value *arg) + { +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct type *resolved_type = check_typedef (type); + struct type *arg_type = check_typedef (value_type (arg)); + struct type *class_type, *rtti_type; +@@ -1181,7 +1183,7 @@ value_fetch_lazy (struct value *val) + } + + void +-read_value_memory (struct value *val, int embedded_offset, ++read_value_memory (struct value *val, LONGEST embedded_offset, + int stack, CORE_ADDR memaddr, + gdb_byte *buffer, size_t length) + { +@@ -1332,7 +1334,7 @@ value_assign (struct value *toval, struc + { + const gdb_byte *dest_buffer; + CORE_ADDR changed_addr; +- int changed_len; ++ LONGEST changed_len; + gdb_byte buffer[sizeof (LONGEST)]; + + if (value_bitsize (toval)) +@@ -1411,7 +1413,7 @@ value_assign (struct value *toval, struc + if (value_bitsize (toval)) + { + struct value *parent = value_parent (toval); +- int offset = value_offset (parent) + value_offset (toval); ++ LONGEST offset = value_offset (parent) + value_offset (toval); + int changed_len; + gdb_byte buffer[sizeof (LONGEST)]; + int optim, unavail; +@@ -1891,7 +1893,7 @@ value_array (int lowbound, int highbound + { + int nelem; + int idx; +- unsigned int typelength; ++ ULONGEST typelength; + struct value *val; + struct type *arraytype; + +@@ -2066,7 +2068,7 @@ typecmp (int staticp, int varargs, int n + + static void + update_search_result (struct value **result_ptr, struct value *v, +- int *last_boffset, int boffset, ++ LONGEST *last_boffset, LONGEST boffset, + const char *name, struct type *type) + { + if (v != NULL) +@@ -2090,10 +2092,10 @@ update_search_result (struct value **res + lookup is ambiguous. */ + + static void +-do_search_struct_field (const char *name, struct value *arg1, int offset, ++do_search_struct_field (const char *name, struct value *arg1, LONGEST offset, + struct type *type, int looking_for_baseclass, + struct value **result_ptr, +- int *last_boffset, ++ LONGEST *last_boffset, + struct type *outermost_type) + { + int i; +@@ -2148,7 +2150,7 @@ do_search_struct_field (const char *name + . */ + + struct value *v = NULL; +- int new_offset = offset; ++ LONGEST new_offset = offset; + + /* This is pretty gross. In G++, the offset in an + anonymous union is relative to the beginning of the +@@ -2187,7 +2189,7 @@ do_search_struct_field (const char *name + && (strcmp_iw (name, + TYPE_BASECLASS_NAME (type, + i)) == 0)); +- int boffset = value_embedded_offset (arg1) + offset; ++ LONGEST boffset = value_embedded_offset (arg1) + offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2262,11 +2264,11 @@ do_search_struct_field (const char *name + fields, look for a baseclass named NAME. */ + + static struct value * +-search_struct_field (const char *name, struct value *arg1, int offset, ++search_struct_field (const char *name, struct value *arg1, LONGEST offset, + struct type *type, int looking_for_baseclass) + { + struct value *result = NULL; +- int boffset = 0; ++ LONGEST boffset = 0; + + do_search_struct_field (name, arg1, offset, type, looking_for_baseclass, + &result, &boffset, type); +@@ -2283,7 +2285,7 @@ search_struct_field (const char *name, s + + static struct value * + search_struct_method (const char *name, struct value **arg1p, +- struct value **args, int offset, ++ struct value **args, LONGEST offset, + int *static_memfuncp, struct type *type) + { + int i; +@@ -2347,8 +2349,8 @@ search_struct_method (const char *name, + + for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) + { +- int base_offset; +- int this_offset; ++ LONGEST base_offset; ++ LONGEST this_offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2530,8 +2532,8 @@ value_struct_elt (struct value **argp, s + + static struct fn_field * + find_method_list (struct value **argp, const char *method, +- int offset, struct type *type, int *num_fns, +- struct type **basetype, int *boffset) ++ LONGEST offset, struct type *type, int *num_fns, ++ struct type **basetype, LONGEST *boffset) + { + int i; + struct fn_field *f; +@@ -2564,7 +2566,7 @@ find_method_list (struct value **argp, c + /* Not found in object, check in base subobjects. */ + for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) + { +- int base_offset; ++ LONGEST base_offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2600,7 +2602,7 @@ find_method_list (struct value **argp, c + static struct fn_field * + value_find_oload_method_list (struct value **argp, const char *method, + int offset, int *num_fns, +- struct type **basetype, int *boffset) ++ struct type **basetype, LONGEST *boffset) + { + struct type *t; + +@@ -2690,7 +2692,7 @@ find_overload_match (struct value **args + /* Number of overloaded instances being considered. */ + int num_fns = 0; + struct type *basetype = NULL; +- int boffset; ++ LONGEST boffset; + + struct cleanup *all_cleanups = make_cleanup (null_cleanup, NULL); + +@@ -3360,7 +3362,7 @@ compare_parameters (struct type *t1, str + the form "DOMAIN::NAME". */ + + static struct value * +-value_struct_elt_for_reference (struct type *domain, int offset, ++value_struct_elt_for_reference (struct type *domain, LONGEST offset, + struct type *curtype, char *name, + struct type *intype, + int want_address, +@@ -3397,7 +3399,7 @@ value_struct_elt_for_reference (struct t + if (want_address) + return value_from_longest + (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain), +- offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3)); ++ offset + (TYPE_FIELD_BITPOS (t, i) >> 3)); + else if (noside == EVAL_AVOID_SIDE_EFFECTS) + return allocate_value (TYPE_FIELD_TYPE (t, i)); + else +@@ -3540,7 +3542,7 @@ value_struct_elt_for_reference (struct t + for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) + { + struct value *v; +- int base_offset; ++ LONGEST base_offset; + + if (BASETYPE_VIA_VIRTUAL (t, i)) + base_offset = 0; +@@ -3630,7 +3632,7 @@ value_maybe_namespace_elt (const struct + + struct type * + value_rtti_indirect_type (struct value *v, int *full, +- int *top, int *using_enc) ++ LONGEST *top, int *using_enc) + { + struct value *target; + struct type *type, *real_type, *target_type; +@@ -3680,12 +3682,12 @@ value_rtti_indirect_type (struct value * + struct value * + value_full_object (struct value *argp, + struct type *rtype, +- int xfull, int xtop, ++ int xfull, LONGEST xtop, + int xusing_enc) + { + struct type *real_type; + int full = 0; +- int top = -1; ++ LONGEST top = -1; + int using_enc = 0; + struct value *new_val; + +Index: gdb-7.6.1/gdb/valprint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/valprint.c 2013-08-30 21:54:18.767367550 +0200 ++++ gdb-7.6.1/gdb/valprint.c 2013-08-30 21:54:20.477368198 +0200 +@@ -299,7 +299,7 @@ scalar_type_p (struct type *type) + int + valprint_check_validity (struct ui_file *stream, + struct type *type, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val) + { + CHECK_TYPEDEF (type); +@@ -363,7 +363,7 @@ val_print_invalid_address (struct ui_fil + + void + generic_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options, +@@ -725,7 +725,7 @@ generic_val_print (struct type *type, co + RECURSE. */ + + void +-val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, ++val_print (struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -937,7 +937,7 @@ val_print_type_code_flags (struct type * + + void + val_print_scalar_formatted (struct type *type, +- const gdb_byte *valaddr, int embedded_offset, ++ const gdb_byte *valaddr, LONGEST embedded_offset, + const struct value *val, + const struct value_print_options *options, + int size, +@@ -1478,7 +1478,7 @@ print_decimal_chars (struct ui_file *str + + void + print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, +- unsigned len, enum bfd_endian byte_order) ++ ULONGEST len, enum bfd_endian byte_order) + { + const gdb_byte *p; + +@@ -1595,23 +1595,23 @@ maybe_print_array_index (struct type *in + + void + val_print_array_elements (struct type *type, +- const gdb_byte *valaddr, int embedded_offset, ++ const gdb_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, + const struct value_print_options *options, +- unsigned int i) ++ ULONGEST i) + { + unsigned int things_printed = 0; +- unsigned len; ++ ULONGEST len; + struct type *saved_type = type; + struct type *elttype, *index_type; +- unsigned eltlen; ++ ULONGEST eltlen; + /* Position of the array element we are examining to see + whether it is repeated. */ +- unsigned int rep1; ++ ULONGEST rep1; + /* Number of repetitions we have detected so far. */ +- unsigned int reps; ++ ULONGEST reps; + LONGEST low_bound, high_bound; + struct cleanup *back_to; + CORE_ADDR saved_address = address; +@@ -1706,7 +1706,7 @@ val_print_array_elements (struct type *t + address, stream, recurse + 1, val, options, + current_language); + annotate_elt_rep (reps); +- fprintf_filtered (stream, " ", reps); ++ fprintf_filtered (stream, " ", pulongest (reps)); + annotate_elt_rep_end (); + + i = rep1 - 1; +@@ -2357,7 +2357,7 @@ print_converted_chars_to_obstack (struct + + void + generic_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + int quote_char, int c_style_terminator, + const struct value_print_options *options) +Index: gdb-7.6.1/gdb/valprint.h +=================================================================== +--- gdb-7.6.1.orig/gdb/valprint.h 2013-08-30 21:54:18.768367550 +0200 ++++ gdb-7.6.1/gdb/valprint.h 2013-08-30 21:54:20.477368198 +0200 +@@ -113,11 +113,11 @@ extern void maybe_print_array_index (str + struct ui_file *stream, + const struct value_print_options *); + +-extern void val_print_array_elements (struct type *, const gdb_byte *, int, ++extern void val_print_array_elements (struct type *, const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *, +- unsigned int); ++ ULONGEST); + + extern void val_print_type_code_int (struct type *, const gdb_byte *, + struct ui_file *); +@@ -127,7 +127,7 @@ extern void val_print_type_code_flags (s + struct ui_file *stream); + + extern void val_print_scalar_formatted (struct type *, +- const gdb_byte *, int, ++ const gdb_byte *, LONGEST, + const struct value *, + const struct value_print_options *, + int, +@@ -143,7 +143,7 @@ extern void print_decimal_chars (struct + unsigned int, enum bfd_endian); + + extern void print_hex_chars (struct ui_file *, const gdb_byte *, +- unsigned int, enum bfd_endian); ++ ULONGEST, enum bfd_endian); + + extern void print_char_chars (struct ui_file *, struct type *, + const gdb_byte *, unsigned int, enum bfd_endian); +@@ -188,7 +188,7 @@ struct generic_val_print_decorations + + + extern void generic_val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options, +@@ -198,7 +198,7 @@ extern void generic_emit_char (int c, st + int quoter, const char *encoding); + + extern void generic_printstr (struct ui_file *stream, struct type *type, +- const gdb_byte *string, unsigned int length, ++ const gdb_byte *string, ULONGEST length, + const char *encoding, int force_ellipses, + int quote_char, int c_style_terminator, + const struct value_print_options *options); +Index: gdb-7.6.1/gdb/value.c +=================================================================== +--- gdb-7.6.1.orig/gdb/value.c 2013-08-30 21:54:18.770367551 +0200 ++++ gdb-7.6.1/gdb/value.c 2013-08-30 21:54:20.478368199 +0200 +@@ -68,10 +68,10 @@ struct internal_function + struct range + { + /* Lowest offset in the range. */ +- int offset; ++ LONGEST offset; + + /* Length of the range. */ +- int length; ++ LONGEST length; + }; + + typedef struct range range_s; +@@ -82,8 +82,8 @@ DEF_VEC_O(range_s); + [offset2, offset2+len2) overlap. */ + + static int +-ranges_overlap (int offset1, int len1, +- int offset2, int len2) ++ranges_overlap (LONGEST offset1, LONGEST len1, ++ LONGEST offset2, LONGEST len2) + { + ULONGEST h, l; + +@@ -107,7 +107,7 @@ range_lessthan (const range_s *r1, const + OFFSET+LENGTH). */ + + static int +-ranges_contain (VEC(range_s) *ranges, int offset, int length) ++ranges_contain (VEC(range_s) *ranges, LONGEST offset, LONGEST length) + { + range_s what; + int i; +@@ -240,7 +240,7 @@ struct value + lval == lval_register, this is a further offset from + location.address within the registers structure. Note also the + member embedded_offset below. */ +- int offset; ++ LONGEST offset; + + /* Only used for bitfields; number of bits contained in them. */ + int bitsize; +@@ -310,8 +310,8 @@ struct value + `type', and `embedded_offset' is zero, so everything works + normally. */ + struct type *enclosing_type; +- int embedded_offset; +- int pointed_to_offset; ++ LONGEST embedded_offset; ++ LONGEST pointed_to_offset; + + /* Values are stored in a chain, so that they can be deleted easily + over calls to the inferior. Values assigned to internal +@@ -333,7 +333,8 @@ struct value + }; + + int +-value_bytes_available (const struct value *value, int offset, int length) ++value_bytes_available (const struct value *value, LONGEST offset, ++ LONGEST length) + { + gdb_assert (!value->lazy); + +@@ -354,7 +355,8 @@ value_entirely_available (struct value * + } + + void +-mark_value_bytes_unavailable (struct value *value, int offset, int length) ++mark_value_bytes_unavailable (struct value *value, LONGEST offset, ++ LONGEST length) + { + range_s newr; + int i; +@@ -525,7 +527,7 @@ mark_value_bytes_unavailable (struct val + + static int + find_first_range_overlap (VEC(range_s) *ranges, int pos, +- int offset, int length) ++ LONGEST offset, LONGEST length) + { + range_s *r; + int i; +@@ -538,9 +540,9 @@ find_first_range_overlap (VEC(range_s) * + } + + int +-value_available_contents_eq (const struct value *val1, int offset1, +- const struct value *val2, int offset2, +- int length) ++value_available_contents_eq (const struct value *val1, LONGEST offset1, ++ const struct value *val2, LONGEST offset2, ++ LONGEST length) + { + int idx1 = 0, idx2 = 0; + +@@ -766,13 +768,13 @@ deprecated_set_value_type (struct value + value->type = type; + } + +-int ++LONGEST + value_offset (const struct value *value) + { + return value->offset; + } + void +-set_value_offset (struct value *value, int offset) ++set_value_offset (struct value *value, LONGEST offset) + { + value->offset = offset; + } +@@ -926,8 +928,9 @@ value_contents_all (struct value *value) + DST_OFFSET+LENGTH) range are wholly available. */ + + void +-value_contents_copy_raw (struct value *dst, int dst_offset, +- struct value *src, int src_offset, int length) ++value_contents_copy_raw (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length) + { + range_s *r; + int i; +@@ -975,8 +978,8 @@ value_contents_copy_raw (struct value *d + DST_OFFSET+LENGTH) range are wholly available. */ + + void +-value_contents_copy (struct value *dst, int dst_offset, +- struct value *src, int src_offset, int length) ++value_contents_copy (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ssize_t length) + { + require_not_optimized_out (src); + +@@ -1070,7 +1073,7 @@ value_entirely_optimized_out (const stru + } + + int +-value_bits_valid (const struct value *value, int offset, int length) ++value_bits_valid (const struct value *value, LONGEST offset, LONGEST length) + { + if (!value->optimized_out) + return 1; +@@ -1083,7 +1086,7 @@ value_bits_valid (const struct value *va + + int + value_bits_synthetic_pointer (const struct value *value, +- int offset, int length) ++ LONGEST offset, LONGEST length) + { + if (value->lval != lval_computed + || !value->location.computed.funcs->check_synthetic_pointer) +@@ -1093,26 +1096,26 @@ value_bits_synthetic_pointer (const stru + length); + } + +-int ++LONGEST + value_embedded_offset (struct value *value) + { + return value->embedded_offset; + } + + void +-set_value_embedded_offset (struct value *value, int val) ++set_value_embedded_offset (struct value *value, LONGEST val) + { + value->embedded_offset = val; + } + +-int ++LONGEST + value_pointed_to_offset (struct value *value) + { + return value->pointed_to_offset; + } + + void +-set_value_pointed_to_offset (struct value *value, int val) ++set_value_pointed_to_offset (struct value *value, LONGEST val) + { + value->pointed_to_offset = val; + } +@@ -1967,7 +1970,7 @@ get_internalvar_function (struct interna + } + + void +-set_internalvar_component (struct internalvar *var, int offset, int bitpos, ++set_internalvar_component (struct internalvar *var, LONGEST offset, int bitpos, + int bitsize, struct value *newval) + { + gdb_byte *addr; +@@ -2674,7 +2677,7 @@ set_value_enclosing_type (struct value * + FIELDNO says which field. */ + + struct value * +-value_primitive_field (struct value *arg1, int offset, ++value_primitive_field (struct value *arg1, LONGEST offset, + int fieldno, struct type *arg_type) + { + struct value *v; +@@ -2704,7 +2707,7 @@ value_primitive_field (struct value *arg + bit. Assume that the address, offset, and embedded offset + are sufficiently aligned. */ + +- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); ++ LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); + int container_bitsize = TYPE_LENGTH (type) * 8; + + v = allocate_value_lazy (type); +@@ -2727,7 +2730,7 @@ value_primitive_field (struct value *arg + /* This field is actually a base subobject, so preserve the + entire object's contents for later references to virtual + bases, etc. */ +- int boffset; ++ LONGEST boffset; + + /* Lazy register values with offsets are not supported. */ + if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) +@@ -2804,7 +2807,7 @@ value_field (struct value *arg1, int fie + struct value * + value_fn_field (struct value **arg1p, struct fn_field *f, + int j, struct type *type, +- int offset) ++ LONGEST offset) + { + struct value *v; + struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); +@@ -2864,8 +2867,8 @@ value_fn_field (struct value **arg1p, st + + static int + unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, +- int embedded_offset, int bitpos, int bitsize, +- const struct value *original_value, ++ LONGEST embedded_offset, LONGEST bitpos, ++ int bitsize, const struct value *original_value, + LONGEST *result) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (field_type)); +@@ -2873,7 +2876,7 @@ unpack_value_bits_as_long_1 (struct type + ULONGEST valmask; + int lsbcount; + int bytes_read; +- int read_offset; ++ LONGEST read_offset; + + /* Read the minimum number of bytes required; there may not be + enough bytes to read an entire ULONGEST. */ +@@ -2943,7 +2946,7 @@ unpack_value_bits_as_long_1 (struct type + + int + unpack_value_bits_as_long (struct type *field_type, const gdb_byte *valaddr, +- int embedded_offset, int bitpos, int bitsize, ++ LONGEST embedded_offset, int bitpos, int bitsize, + const struct value *original_value, + LONGEST *result) + { +@@ -2961,10 +2964,10 @@ unpack_value_bits_as_long (struct type * + + static int + unpack_value_field_as_long_1 (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result) + { +- int bitpos = TYPE_FIELD_BITPOS (type, fieldno); ++ LONGEST bitpos = TYPE_FIELD_BITPOS (type, fieldno); + int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); + struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); + +@@ -2980,7 +2983,7 @@ unpack_value_field_as_long_1 (struct typ + + int + unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result) + { + gdb_assert (val != NULL); +@@ -3012,7 +3015,7 @@ unpack_field_as_long (struct type *type, + struct value * + value_field_bitfield (struct type *type, int fieldno, + const gdb_byte *valaddr, +- int embedded_offset, const struct value *val) ++ LONGEST embedded_offset, const struct value *val) + { + LONGEST l; + +@@ -3039,12 +3042,12 @@ value_field_bitfield (struct type *type, + + void + modify_field (struct type *type, gdb_byte *addr, +- LONGEST fieldval, int bitpos, int bitsize) ++ LONGEST fieldval, LONGEST bitpos, int bitsize) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); + ULONGEST oword; + ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize); +- int bytesize; ++ LONGEST bytesize; + + /* Normalize BITPOS. */ + addr += bitpos / 8; +Index: gdb-7.6.1/gdb/value.h +=================================================================== +--- gdb-7.6.1.orig/gdb/value.h 2013-08-30 21:54:18.771367551 +0200 ++++ gdb-7.6.1/gdb/value.h 2013-08-30 21:55:01.872384221 +0200 +@@ -82,8 +82,8 @@ extern void set_value_parent (struct val + within the registers structure. Note also the member + embedded_offset below. */ + +-extern int value_offset (const struct value *); +-extern void set_value_offset (struct value *, int offset); ++extern LONGEST value_offset (const struct value *); ++extern void set_value_offset (struct value *, LONGEST offset); + + /* The comment from "struct value" reads: ``Is it modifiable? Only + relevant if lval != not_lval.''. Shouldn't the value instead be +@@ -152,10 +152,10 @@ extern struct type *value_actual_type (s + int resolve_simple_types, + int *real_type_found); + +-extern int value_pointed_to_offset (struct value *value); +-extern void set_value_pointed_to_offset (struct value *value, int val); +-extern int value_embedded_offset (struct value *value); +-extern void set_value_embedded_offset (struct value *value, int val); ++extern LONGEST value_pointed_to_offset (struct value *value); ++extern void set_value_pointed_to_offset (struct value *value, LONGEST val); ++extern LONGEST value_embedded_offset (struct value *value); ++extern void set_value_embedded_offset (struct value *value, LONGEST val); + + /* For lval_computed values, this structure holds functions used to + retrieve and set the value (or portions of the value). +@@ -183,7 +183,8 @@ struct lval_funcs + /* Check the validity of some bits in VALUE. This should return 1 + if all the bits starting at OFFSET and extending for LENGTH bits + are valid, or 0 if any bit is invalid. */ +- int (*check_validity) (const struct value *value, int offset, int length); ++ int (*check_validity) (const struct value *value, LONGEST offset, ++ LONGEST length); + + /* Return 1 if any bit in VALUE is valid, 0 if they are all invalid. */ + int (*check_any_valid) (const struct value *value); +@@ -201,7 +202,7 @@ struct lval_funcs + /* If non-NULL, this is used to determine whether the indicated bits + of VALUE are a synthetic pointer. */ + int (*check_synthetic_pointer) (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Return a duplicate of VALUE's closure, for use in a new value. + This may simply return the same closure, if VALUE's is +@@ -238,7 +239,7 @@ extern struct value *allocate_computed_v + Otherwise, return 1. */ + + extern int valprint_check_validity (struct ui_file *stream, struct type *type, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val); + + extern struct value *allocate_optimized_out_value (struct type *type); +@@ -409,13 +410,13 @@ extern struct value *coerce_array (struc + bits in the given range are valid, zero if any bit is invalid. */ + + extern int value_bits_valid (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Given a value, determine whether the bits starting at OFFSET and + extending for LENGTH bits are a synthetic pointer. */ + + extern int value_bits_synthetic_pointer (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Given a value, determine whether the contents bytes starting at + OFFSET and extending for LENGTH bytes are available. This returns +@@ -423,7 +424,7 @@ extern int value_bits_synthetic_pointer + byte is unavailable. */ + + extern int value_bytes_available (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Like value_bytes_available, but return false if any byte in the + whole object is unavailable. */ +@@ -433,7 +434,7 @@ extern int value_entirely_available (str + LENGTH bytes as unavailable. */ + + extern void mark_value_bytes_unavailable (struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with + LENGTH bytes of VAL2's contents starting at OFFSET2. +@@ -443,7 +444,7 @@ extern void mark_value_bytes_unavailable + example, to compare a complete object value with itself, including + its enclosing type chunk, you'd do: + +- int len = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); ++ ULONGEST len = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); + value_available_contents (val, 0, val, 0, len); + + Returns true iff the set of available contents match. Unavailable +@@ -470,9 +471,10 @@ extern void mark_value_bytes_unavailable + gone, it works with const values. Therefore, this routine must not + be called with lazy values. */ + +-extern int value_available_contents_eq (const struct value *val1, int offset1, +- const struct value *val2, int offset2, +- int length); ++extern int value_available_contents_eq (const struct value *val1, ++ LONGEST offset1, ++ const struct value *val2, ++ LONGEST offset2, LONGEST length); + + /* Read LENGTH bytes of memory starting at MEMADDR into BUFFER, which + is (or will be copied to) VAL's contents buffer offset by +@@ -481,7 +483,7 @@ extern int value_available_contents_eq ( + memory is likewise unavailable. STACK indicates whether the memory + is known to be stack memory. */ + +-extern void read_value_memory (struct value *val, int embedded_offset, ++extern void read_value_memory (struct value *val, LONGEST embedded_offset, + int stack, CORE_ADDR memaddr, + gdb_byte *buffer, size_t length); + +@@ -515,7 +517,7 @@ extern CORE_ADDR unpack_pointer (struct + + extern int unpack_value_bits_as_long (struct type *field_type, + const gdb_byte *valaddr, +- int embedded_offset, int bitpos, ++ LONGEST embedded_offset, int bitpos, + int bitsize, + const struct value *original_value, + LONGEST *result); +@@ -524,12 +526,12 @@ extern LONGEST unpack_field_as_long (str + const gdb_byte *valaddr, + int fieldno); + extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result); + + extern struct value *value_field_bitfield (struct type *type, int fieldno, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val); + + extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num); +@@ -588,12 +590,12 @@ extern struct value *default_read_var_va + extern struct value *allocate_value (struct type *type); + extern struct value *allocate_value_lazy (struct type *type); + extern void allocate_value_contents (struct value *value); +-extern void value_contents_copy (struct value *dst, int dst_offset, +- struct value *src, int src_offset, +- int length); +-extern void value_contents_copy_raw (struct value *dst, int dst_offset, +- struct value *src, int src_offset, +- int length); ++extern void value_contents_copy (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length); ++extern void value_contents_copy_raw (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length); + + extern struct value *allocate_repeat_value (struct type *type, int count); + +@@ -665,16 +667,16 @@ extern int find_overload_match (struct v + + extern struct value *value_field (struct value *arg1, int fieldno); + +-extern struct value *value_primitive_field (struct value *arg1, int offset, ++extern struct value *value_primitive_field (struct value *arg1, LONGEST offset, + int fieldno, + struct type *arg_type); + + +-extern struct type *value_rtti_indirect_type (struct value *, int *, int *, ++extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *, + int *); + + extern struct value *value_full_object (struct value *, struct type *, int, +- int, int); ++ LONGEST, int); + + extern struct value *value_cast_pointers (struct type *, struct value *, int); + +@@ -768,7 +770,7 @@ extern void set_internalvar_string (stru + extern void clear_internalvar (struct internalvar *var); + + extern void set_internalvar_component (struct internalvar *var, +- int offset, ++ LONGEST offset, + int bitpos, int bitsize, + struct value *newvalue); + +@@ -850,7 +852,7 @@ extern struct value *value_x_unop (struc + enum noside noside); + + extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f, +- int j, struct type *type, int offset); ++ int j, struct type *type, LONGEST offset); + + extern int binop_types_user_defined_p (enum exp_opcode op, + struct type *type1, +@@ -878,7 +880,8 @@ extern void release_value_or_incref (str + extern int record_latest_value (struct value *val); + + extern void modify_field (struct type *type, gdb_byte *addr, +- LONGEST fieldval, int bitpos, int bitsize); ++ LONGEST fieldval, LONGEST bitpos, ++ int bitsize); + + extern void type_print (struct type *type, const char *varstring, + struct ui_file *stream, int show); +@@ -908,7 +911,7 @@ extern void value_print_array_elements ( + extern struct value *value_release_to_mark (struct value *mark); + + extern void val_print (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -957,10 +960,11 @@ extern struct value *value_literal_compl + extern struct value *find_function_in_inferior (const char *, + struct objfile **); + +-extern struct value *value_allocate_space_in_inferior (int); ++extern struct value *value_allocate_space_in_inferior (LONGEST); + + extern struct value *value_subscripted_rvalue (struct value *array, +- LONGEST index, int lowerbound); ++ LONGEST index, ++ LONGEST lowerbound); + + /* User function handler. */ + diff --git a/SOURCES/gdb-rhbz795424-bitpos-21of25.patch b/SOURCES/gdb-rhbz795424-bitpos-21of25.patch new file mode 100644 index 0000000..81124fb --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-21of25.patch @@ -0,0 +1,224 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html +Subject: [PATCH 2/4] Add a check to ensure that a type may fit into host memory + + +--MP_/PnL6l3LUsXWpZ/olqawWlzb +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +This is part two of the bitpos expansion patch. This implements checks +in some places in the code to ensure that a type size in ULONGEST is +small enough to fit into host memory. Tested for regressions on x86_64 +Fedora 16. + +Regards, +Siddhesh + +--MP_/PnL6l3LUsXWpZ/olqawWlzb +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; filename=ChangeLog-ensure_sizet + +gdb/ChangeLog + + * alpha-tdep.c (alpha_push_dummy_call) Check for underflow in + SP. + * cp-valprint (cp_print_value): Ensure BASECLASS fits into + size_t. + * dwarf2loc.c (read_pieced_value): Ensure that THIS_SIZE fits + into size_t. + (write_pieced_value): Likewise. + * findcmd.c (parse_find_args): Ensure PATTERN_BUF_SIZE fits into + size_t. + * p-valprint (pascal_object_print_value): Ensure BASECLASS fits + into size_t. + * utils.c (ulongest_fits_host_or_error): New function to find if + a ULONGEST number fits into size_t. + * utils.h: Declare ulongest_fits_host_or_error. + * valops.c (search_struct_method): Ensure BASECLASS fits into + size_t. + * value.c (allocate_value_lazy): Ensure TYPE fits into size_t. + (allocate_value_contents): Likewise. + (set_value_enclosing_type): Ensure NEW_ENCL_TYPE fits into + size_t. + * vax-tdep.c (vax_return_value): Ensure that TYPE fits into + size_t. + +--MP_/PnL6l3LUsXWpZ/olqawWlzb +Content-Type: text/x-patch +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch + +Index: gdb-7.5.50.20130118/gdb/alpha-tdep.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/alpha-tdep.c 2013-01-18 23:33:59.277047324 +0100 ++++ gdb-7.5.50.20130118/gdb/alpha-tdep.c 2013-01-18 23:34:02.678051846 +0100 +@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *g + accumulate_size = 0; + else + accumulate_size -= sizeof(arg_reg_buffer); ++ ++ /* Check for underflow. */ ++ if (sp - accumulate_size > sp) ++ error (_("Insufficient memory in GDB host for arguments, " ++ "need %s bytes, but less than %s bytes available."), ++ plongest (accumulate_size), plongest (CORE_ADDR_MAX - sp)); ++ + sp -= accumulate_size; + + /* Keep sp aligned to a multiple of 16 as the ABI requires. */ +Index: gdb-7.5.50.20130118/gdb/cp-valprint.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/cp-valprint.c 2013-01-18 23:33:59.278047326 +0100 ++++ gdb-7.5.50.20130118/gdb/cp-valprint.c 2013-01-18 23:34:02.679051848 +0100 +@@ -540,6 +540,8 @@ cp_print_value (struct type *type, struc + gdb_byte *buf; + struct cleanup *back_to; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); ++ + buf = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, buf); + +Index: gdb-7.5.50.20130118/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/dwarf2loc.c 2013-01-18 23:33:59.280047332 +0100 ++++ gdb-7.5.50.20130118/gdb/dwarf2loc.c 2013-01-18 23:34:02.680051851 +0100 +@@ -1784,6 +1784,8 @@ read_pieced_value (struct value *v) + + this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8; + source_offset = source_offset_bits / 8; ++ ulongest_fits_host_or_error (this_size); ++ + if (buffer_size < this_size) + { + buffer_size = this_size; +@@ -1975,6 +1977,7 @@ write_pieced_value (struct value *to, st + } + else + { ++ ulongest_fits_host_or_error (this_size); + if (buffer_size < this_size) + { + buffer_size = this_size; +Index: gdb-7.5.50.20130118/gdb/findcmd.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/findcmd.c 2013-01-18 23:33:59.280047332 +0100 ++++ gdb-7.5.50.20130118/gdb/findcmd.c 2013-01-18 23:34:02.680051851 +0100 +@@ -187,6 +187,7 @@ parse_find_args (char *args, ULONGEST *m + size_t current_offset = pattern_buf_end - pattern_buf; + + pattern_buf_size = pattern_buf_size_need * 2; ++ ulongest_fits_host_or_error (pattern_buf_size); + pattern_buf = xrealloc (pattern_buf, pattern_buf_size); + pattern_buf_end = pattern_buf + current_offset; + } +Index: gdb-7.5.50.20130118/gdb/p-valprint.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/p-valprint.c 2013-01-18 23:33:59.281047334 +0100 ++++ gdb-7.5.50.20130118/gdb/p-valprint.c 2013-01-18 23:34:02.680051851 +0100 +@@ -797,6 +797,7 @@ pascal_object_print_value (struct type * + gdb_byte *buf; + struct cleanup *back_to; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); + buf = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, buf); + +Index: gdb-7.5.50.20130118/gdb/utils.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/utils.c 2013-01-18 23:33:59.282047336 +0100 ++++ gdb-7.5.50.20130118/gdb/utils.c 2013-01-18 23:34:02.681051854 +0100 +@@ -3219,6 +3219,18 @@ host_address_to_string (const void *addr + return str; + } + ++/* Ensure that the input NUM is not larger than the maximum capacity of the ++ host system. We choose SIZE_MAX / 8 as a conservative estimate of the size ++ of a resource that a system may allocate. */ ++void ++ulongest_fits_host_or_error (ULONGEST num) ++{ ++ if (num > SIZE_MAX / 8) ++ error (_("Insufficient memory in host GDB for object of size %s bytes, " ++ "maximum allowed %s bytes."), pulongest (num), ++ pulongest (SIZE_MAX / 8)); ++} ++ + char * + gdb_realpath (const char *filename) + { +Index: gdb-7.5.50.20130118/gdb/valops.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/valops.c 2013-01-18 23:33:59.283047338 +0100 ++++ gdb-7.5.50.20130118/gdb/valops.c 2013-01-18 23:34:02.682051856 +0100 +@@ -2369,6 +2369,7 @@ search_struct_method (const char *name, + struct cleanup *back_to; + CORE_ADDR address; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); + tmp = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, tmp); + address = value_address (*arg1p); +Index: gdb-7.5.50.20130118/gdb/value.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/value.c 2013-01-18 23:33:59.285047342 +0100 ++++ gdb-7.5.50.20130118/gdb/value.c 2013-01-18 23:34:02.683051858 +0100 +@@ -663,6 +663,7 @@ allocate_value_lazy (struct type *type) + description correctly. */ + check_typedef (type); + ++ ulongest_fits_host_or_error (TYPE_LENGTH (type)); + val = (struct value *) xzalloc (sizeof (struct value)); + val->contents = NULL; + val->next = all_values; +@@ -694,6 +695,8 @@ allocate_value_lazy (struct type *type) + void + allocate_value_contents (struct value *val) + { ++ ulongest_fits_host_or_error (TYPE_LENGTH (val->enclosing_type)); ++ + if (!val->contents) + val->contents = (gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type)); + } +@@ -2672,8 +2675,12 @@ void + set_value_enclosing_type (struct value *val, struct type *new_encl_type) + { + if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val))) +- val->contents = +- (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); ++ { ++ ulongest_fits_host_or_error (TYPE_LENGTH (new_encl_type)); ++ ++ val->contents = ++ (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); ++ } + + val->enclosing_type = new_encl_type; + } +Index: gdb-7.5.50.20130118/gdb/vax-tdep.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/vax-tdep.c 2013-01-18 23:34:02.683051858 +0100 ++++ gdb-7.5.50.20130118/gdb/vax-tdep.c 2013-01-18 23:34:34.950094198 +0100 +@@ -223,6 +223,7 @@ vax_return_value (struct gdbarch *gdbarc + ULONGEST addr; + + regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); ++ ulongest_fits_host_or_error (TYPE_LENGTH (type)); + read_memory (addr, readbuf, len); + } + +Index: gdb-7.5.50.20130118/gdb/defs.h +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/defs.h 2013-01-18 23:34:02.684051860 +0100 ++++ gdb-7.5.50.20130118/gdb/defs.h 2013-01-18 23:34:14.238067193 +0100 +@@ -801,4 +801,6 @@ enum block_enum + + #include "utils.h" + ++extern void ulongest_fits_host_or_error (ULONGEST num); ++ + #endif /* #ifndef DEFS_H */ diff --git a/SOURCES/gdb-rhbz795424-bitpos-22of25.patch b/SOURCES/gdb-rhbz795424-bitpos-22of25.patch new file mode 100644 index 0000000..07d0583 --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-22of25.patch @@ -0,0 +1,700 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html +Subject: [PATCH 3/4] Expand watchpoint lengths to LONGEST + + +--MP_/6HRlH6vpyqtSy4CYyMrX6b2 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +This is part three of the bitpos expansion change. Some architectures +allow arbitrary length watchpoints and combined with the fact that type +lengths could be large enough, we need LONGEST for watchpoint lengths. +It is architecture dependent however, whether the LONGEST is needed or +not. This patch updates the signatures of watchpoint insertion and +removal functions of all architectures (to comply with the function +signatures in the callback struct), but expands types only in +architectures that need it. Tested on Fedora 16 x86_64. + +Regards, +Siddhesh +--MP_/6HRlH6vpyqtSy4CYyMrX6b2 +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; filename=ChangeLog-wp + +gdb/ChangeLog: + + * arm-linux-nat.c (arm_linux_insert_watchpoint): Expand + parameter LEN to LONGEST. + (arm_linux_remove_watchpoint): Likewise. + (arm_linux_watchpoint_addr_within_range): Expand parameter + LENGTH to LONGEST. + * i386-nat.c (i386_insert_watchpoint): Expand parameter LEN to + LONGEST. + (i386_remove_watchpoint): Likewise. + * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. + (ia64_linux_remove_watchpoint): Likewise. + * inf-ttrace.c (inf_ttrace_insert_watchpoint): Likewise. + Expand NUM_PAGES, PAGE to LONGEST. + (inf_ttrace_remove_watchpoint): Likewise. + * mips-linux-nat.c (mips_linux_insert_watchpoint): Expand + parameter LEN to LONGEST. + (mips_linux_remove_watchpoint): Likewise. + * nto-procfs.c (procfs_remove_hw_watchpoint): Likewise. + (procfs_insert_hw_watchpoint): Likewise. + * ppc-linux-nat.c (calculate_dvc): Likewise. Expand I, + NUM_BYTE_ENABLE to LONGEST. + (check_condition): Expand parameter LEN to point to LONGEST. + (ppc_linux_can_accel_watchpoint_condition): Expand parameter + LEN to LONGEST. + (create_watchpoint_request): Likewise. + (ppc_linux_insert_watchpoint): Likewise. + (ppc_linux_remove_watchpoint): Likewise. + (ppc_linux_watchpoint_addr_within_range): Expand parameter + LENGTH to LONGEST. + * procfs.c (proc_set_watchpoint): Expand parameter LEN to + LONGEST. + (procfs_set_watchpoint): Likewise. + (procfs_insert_watchpoint): Likewise. + (procfs_remove_watchpoint): Likewise. + * remote-m32r-sdi.c (m32r_insert_watchpoint): Likewise. Use + plongest to format print LEN. + (m32r_remove_watchpoint): Likewise. + * remote-mips.c (mips_insert_watchpoint): Expand parameter LEN + to LONGEST. + (mips_remove_watchpoint): Likewise. + * remote.c (remote_insert_watchpoint): Likewise. + Use phex_nz to format print LEN. + (remote_remove_watchpoint): Likewise. + (remote_watchpoint_addr_within_range): Expand parameter LENGTH + to LONGEST. + * s390-nat.c (s390_insert_watchpoint): Expand parameter LEN to + LONGEST. + (s390_remove_watchpoint): Likewise. + * target.c (update_current_target): Expand parameter LEN for + callbacks to TO_INSERT_WATCHPOINT, TO_REMOVE_WATCHPOINT, + TO_CAN_ACCEL_WATCHPOINT_CONDITION, to LONGEST. + (default_watchpoint_addr_within_range): Expand parameter + LENGTH to LONGEST. + (debug_to_can_accel_watchpoint_condition): Expand parameter LEN + to LONGEST. Use plongest to format print LEN. + (debug_to_watchpoint_addr_within_range): Expand parameter LENGTH + to LONGEST. Use plongest to format print LENGTH. + (debug_to_insert_watchpoint): Expand parameter LEN to LONGEST. + Use plongest to format print LEN. + (debug_to_remove_watchpoint): Likewise. + * target.h (struct target_ops): Expand parameter LEN of + TO_REMOVE_WATCHPOINT, TO_INSERT_WATCHPOINT, + TO_WATCHPOINT_ADDR_WITHIN_RANGE and + TO_CAN_ACCEL_WATCHPOINT_CONDITION to LONGEST. + +--MP_/6HRlH6vpyqtSy4CYyMrX6b2 +Content-Type: text/x-patch +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename=bitpos-wp.patch + +Index: gdb-7.5.50.20130215/gdb/arm-linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/arm-linux-nat.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/arm-linux-nat.c 2013-02-15 22:42:45.988804306 +0100 +@@ -1105,7 +1105,7 @@ arm_linux_region_ok_for_hw_watchpoint (C + + /* Insert a Hardware breakpoint. */ + static int +-arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++arm_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -1123,7 +1123,7 @@ arm_linux_insert_watchpoint (CORE_ADDR a + + /* Remove a hardware breakpoint. */ + static int +-arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, ++arm_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -1180,7 +1180,7 @@ arm_linux_stopped_by_watchpoint (void) + static int + arm_linux_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + return start <= addr && start + length - 1 >= addr; + } +Index: gdb-7.5.50.20130215/gdb/i386-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/i386-nat.c 2013-02-15 22:41:53.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/i386-nat.c 2013-02-15 22:43:14.005838741 +0100 +@@ -589,7 +589,7 @@ i386_update_inferior_debug_regs (struct + of the type TYPE. Return 0 on success, -1 on failure. */ + + static int +-i386_insert_watchpoint (CORE_ADDR addr, int len, int type, ++i386_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct i386_debug_reg_state *state +@@ -627,7 +627,7 @@ i386_insert_watchpoint (CORE_ADDR addr, + address ADDR, whose length is LEN bytes, and for accesses of the + type TYPE. Return 0 on success, -1 on failure. */ + static int +-i386_remove_watchpoint (CORE_ADDR addr, int len, int type, ++i386_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct i386_debug_reg_state *state +Index: gdb-7.5.50.20130215/gdb/ia64-linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/ia64-linux-nat.c 2013-02-15 22:34:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/ia64-linux-nat.c 2013-02-15 22:42:45.989804309 +0100 +@@ -542,7 +542,7 @@ is_power_of_2 (int val) + } + + static int +-ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++ia64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -596,7 +596,7 @@ ia64_linux_insert_watchpoint (CORE_ADDR + } + + static int +-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, ++ia64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int idx; +Index: gdb-7.5.50.20130215/gdb/inf-ttrace.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/inf-ttrace.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/inf-ttrace.c 2013-02-15 22:42:45.989804309 +0100 +@@ -313,14 +313,14 @@ inf_ttrace_disable_page_protections (pid + type TYPE. */ + + static int +-inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, ++inf_ttrace_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + const int pagesize = inf_ttrace_page_dict.pagesize; + pid_t pid = ptid_get_pid (inferior_ptid); + CORE_ADDR page_addr; +- int num_pages; +- int page; ++ LONGEST num_pages; ++ LONGEST page; + + gdb_assert (type == hw_write); + +@@ -337,14 +337,14 @@ inf_ttrace_insert_watchpoint (CORE_ADDR + type TYPE. */ + + static int +-inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, ++inf_ttrace_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + const int pagesize = inf_ttrace_page_dict.pagesize; + pid_t pid = ptid_get_pid (inferior_ptid); + CORE_ADDR page_addr; +- int num_pages; +- int page; ++ LONGEST num_pages; ++ LONGEST page; + + gdb_assert (type == hw_write); + +Index: gdb-7.5.50.20130215/gdb/mips-linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/mips-linux-nat.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/mips-linux-nat.c 2013-02-15 22:42:45.990804311 +0100 +@@ -1017,7 +1017,7 @@ populate_regs_from_watches (struct pt_wa + watch. Return zero on success. */ + + static int +-mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, ++mips_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct pt_watch_regs regs; +@@ -1067,7 +1067,7 @@ mips_linux_insert_watchpoint (CORE_ADDR + Return zero on success. */ + + static int +-mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, ++mips_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +Index: gdb-7.5.50.20130215/gdb/nto-procfs.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/nto-procfs.c 2013-01-01 07:32:47.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/nto-procfs.c 2013-02-15 22:42:45.990804311 +0100 +@@ -69,10 +69,10 @@ static ptid_t do_attach (ptid_t ptid); + + static int procfs_can_use_hw_breakpoint (int, int, int); + +-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, ++static int procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond); + +-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, ++static int procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond); + + static int procfs_stopped_by_watchpoint (void); +@@ -1493,14 +1493,14 @@ procfs_can_use_hw_breakpoint (int type, + } + + static int +-procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_hw_watchpoint (addr, -1, type); + } + + static int +-procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_hw_watchpoint (addr, len, type); +Index: gdb-7.5.50.20130215/gdb/ppc-linux-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/ppc-linux-nat.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/ppc-linux-nat.c 2013-02-15 22:42:45.991804313 +0100 +@@ -1838,11 +1838,11 @@ can_use_watchpoint_cond_accel (void) + CONDITION_VALUE will hold the value which should be put in the + DVC register. */ + static void +-calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value, ++calculate_dvc (CORE_ADDR addr, LONGEST len, CORE_ADDR data_value, + uint32_t *condition_mode, uint64_t *condition_value) + { +- int i, num_byte_enable, align_offset, num_bytes_off_dvc, +- rightmost_enabled_byte; ++ LONGEST i, num_byte_enable; ++ int align_offset, num_bytes_off_dvc, rightmost_enabled_byte; + CORE_ADDR addr_end_data, addr_end_dvc; + + /* The DVC register compares bytes within fixed-length windows which +@@ -1929,7 +1929,7 @@ num_memory_accesses (struct value *v) + of the constant. */ + static int + check_condition (CORE_ADDR watch_addr, struct expression *cond, +- CORE_ADDR *data_value, int *len) ++ CORE_ADDR *data_value, LONGEST *len) + { + int pc = 1, num_accesses_left, num_accesses_right; + struct value *left_val, *right_val, *left_chain, *right_chain; +@@ -1996,7 +1996,7 @@ check_condition (CORE_ADDR watch_addr, s + the condition expression, thus only triggering the watchpoint when it is + true. */ + static int +-ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, ++ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + CORE_ADDR data_value; +@@ -2013,7 +2013,7 @@ ppc_linux_can_accel_watchpoint_condition + + static void + create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, +- int len, int rw, struct expression *cond, ++ LONGEST len, int rw, struct expression *cond, + int insert) + { + if (len == 1 +@@ -2058,7 +2058,7 @@ create_watchpoint_request (struct ppc_hw + } + + static int +-ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++ppc_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -2126,7 +2126,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR a + } + + static int +-ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, ++ppc_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -2266,7 +2266,7 @@ ppc_linux_stopped_by_watchpoint (void) + static int + ppc_linux_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + int mask; + +Index: gdb-7.5.50.20130215/gdb/procfs.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/procfs.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/procfs.c 2013-02-15 22:42:45.992804315 +0100 +@@ -2433,7 +2433,7 @@ procfs_address_to_host_pointer (CORE_ADD + #endif + + static int +-proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags) ++proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, LONGEST len, int wflags) + { + #if !defined (PCWATCH) && !defined (PIOCSWATCH) + /* If neither or these is defined, we can't support watchpoints. +@@ -4777,7 +4777,7 @@ procfs_pid_to_str (struct target_ops *op + /* Insert a watchpoint. */ + + static int +-procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, ++procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, LONGEST len, int rwflag, + int after) + { + #ifndef AIX5 +@@ -4897,7 +4897,7 @@ procfs_stopped_data_address (struct targ + } + + static int +-procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (!target_have_steppable_watchpoint +@@ -4919,7 +4919,7 @@ procfs_insert_watchpoint (CORE_ADDR addr + } + + static int +-procfs_remove_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); +Index: gdb-7.5.50.20130215/gdb/remote-m32r-sdi.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/remote-m32r-sdi.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/remote-m32r-sdi.c 2013-02-15 22:42:45.993804317 +0100 +@@ -1417,14 +1417,15 @@ m32r_can_use_hw_watchpoint (int type, in + watchpoint. */ + + static int +-m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, ++m32r_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int i; + + if (remote_debug) +- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n", +- paddress (target_gdbarch (), addr), len, type); ++ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%s,%d)\n", ++ paddress (target_gdbarch (), addr), plongest (len), ++ type); + + for (i = 0; i < MAX_ACCESS_BREAKS; i++) + { +@@ -1442,14 +1443,15 @@ m32r_insert_watchpoint (CORE_ADDR addr, + } + + static int +-m32r_remove_watchpoint (CORE_ADDR addr, int len, int type, ++m32r_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int i; + + if (remote_debug) +- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n", +- paddress (target_gdbarch (), addr), len, type); ++ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%s,%d)\n", ++ paddress (target_gdbarch (), addr), plongest (len), ++ type); + + for (i = 0; i < MAX_ACCESS_BREAKS; i++) + { +Index: gdb-7.5.50.20130215/gdb/remote-mips.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/remote-mips.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/remote-mips.c 2013-02-15 22:42:45.994804319 +0100 +@@ -2419,7 +2419,7 @@ calculate_mask (CORE_ADDR addr, int len) + watchpoint. */ + + static int +-mips_insert_watchpoint (CORE_ADDR addr, int len, int type, ++mips_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (mips_set_breakpoint (addr, len, type)) +@@ -2431,7 +2431,7 @@ mips_insert_watchpoint (CORE_ADDR addr, + /* Remove a watchpoint. */ + + static int +-mips_remove_watchpoint (CORE_ADDR addr, int len, int type, ++mips_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (mips_clear_breakpoint (addr, len, type)) +Index: gdb-7.5.50.20130215/gdb/remote.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/remote.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/remote.c 2013-02-15 22:42:45.996804323 +0100 +@@ -8155,7 +8155,7 @@ watchpoint_to_Z_packet (int type) + } + + static int +-remote_insert_watchpoint (CORE_ADDR addr, int len, int type, ++remote_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct remote_state *rs = get_remote_state (); +@@ -8170,7 +8170,7 @@ remote_insert_watchpoint (CORE_ADDR addr + p = strchr (rs->buf, '\0'); + addr = remote_address_masked (addr); + p += hexnumstr (p, (ULONGEST) addr); +- xsnprintf (p, endbuf - p, ",%x", len); ++ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); + + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); +@@ -8190,7 +8190,7 @@ remote_insert_watchpoint (CORE_ADDR addr + + static int + remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + CORE_ADDR diff = remote_address_masked (addr - start); + +@@ -8199,7 +8199,7 @@ remote_watchpoint_addr_within_range (str + + + static int +-remote_remove_watchpoint (CORE_ADDR addr, int len, int type, ++remote_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct remote_state *rs = get_remote_state (); +@@ -8214,7 +8214,7 @@ remote_remove_watchpoint (CORE_ADDR addr + p = strchr (rs->buf, '\0'); + addr = remote_address_masked (addr); + p += hexnumstr (p, (ULONGEST) addr); +- xsnprintf (p, endbuf - p, ",%x", len); ++ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); + +Index: gdb-7.5.50.20130215/gdb/s390-nat.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/s390-nat.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/s390-nat.c 2013-02-15 22:42:45.997804325 +0100 +@@ -516,7 +516,7 @@ s390_fix_watch_points (struct lwp_info * + } + + static int +-s390_insert_watchpoint (CORE_ADDR addr, int len, int type, ++s390_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct lwp_info *lp; +@@ -537,7 +537,7 @@ s390_insert_watchpoint (CORE_ADDR addr, + } + + static int +-s390_remove_watchpoint (CORE_ADDR addr, int len, int type, ++s390_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct lwp_info *lp; +Index: gdb-7.5.50.20130215/gdb/target.c +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/target.c 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/target.c 2013-02-15 22:42:45.997804325 +0100 +@@ -49,7 +49,8 @@ static void target_info (char *, int); + static void default_terminal_info (char *, int); + + static int default_watchpoint_addr_within_range (struct target_ops *, +- CORE_ADDR, CORE_ADDR, int); ++ CORE_ADDR, CORE_ADDR, ++ LONGEST); + + static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + +@@ -114,10 +115,10 @@ static int debug_to_insert_hw_breakpoint + static int debug_to_remove_hw_breakpoint (struct gdbarch *, + struct bp_target_info *); + +-static int debug_to_insert_watchpoint (CORE_ADDR, int, int, ++static int debug_to_insert_watchpoint (CORE_ADDR, LONGEST, int, + struct expression *); + +-static int debug_to_remove_watchpoint (CORE_ADDR, int, int, ++static int debug_to_remove_watchpoint (CORE_ADDR, LONGEST, int, + struct expression *); + + static int debug_to_stopped_by_watchpoint (void); +@@ -125,11 +126,12 @@ static int debug_to_stopped_by_watchpoin + static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); + + static int debug_to_watchpoint_addr_within_range (struct target_ops *, +- CORE_ADDR, CORE_ADDR, int); ++ CORE_ADDR, CORE_ADDR, ++ LONGEST); + + static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + +-static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, ++static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, + struct expression *); + + static void debug_to_terminal_init (void); +@@ -751,10 +753,10 @@ update_current_target (void) + (int (*) (struct gdbarch *, struct bp_target_info *)) + return_minus_one); + de_fault (to_insert_watchpoint, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_minus_one); + de_fault (to_remove_watchpoint, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_minus_one); + de_fault (to_stopped_by_watchpoint, + (int (*) (void)) +@@ -767,7 +769,7 @@ update_current_target (void) + de_fault (to_region_ok_for_hw_watchpoint, + default_region_ok_for_hw_watchpoint); + de_fault (to_can_accel_watchpoint_condition, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_zero); + de_fault (to_terminal_init, + (void (*) (void)) +@@ -3558,7 +3560,7 @@ default_region_ok_for_hw_watchpoint (COR + static int + default_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + return addr >= start && addr < start + length; + } +@@ -4265,7 +4267,7 @@ debug_to_region_ok_for_hw_watchpoint (CO + } + + static int +-debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, ++debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + int retval; +@@ -4275,8 +4277,8 @@ debug_to_can_accel_watchpoint_condition + + fprintf_unfiltered (gdb_stdlog, + "target_can_accel_watchpoint_condition " +- "(%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, rw, ++ "(%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), rw, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } +@@ -4311,7 +4313,7 @@ debug_to_stopped_data_address (struct ta + static int + debug_to_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + int retval; + +@@ -4319,9 +4321,9 @@ debug_to_watchpoint_addr_within_range (s + start, length); + + fprintf_filtered (gdb_stdlog, +- "target_watchpoint_addr_within_range (%s, %s, %d) = %d\n", ++ "target_watchpoint_addr_within_range (%s, %s, %s) = %d\n", + core_addr_to_string (addr), core_addr_to_string (start), +- length, retval); ++ plongest (length), retval); + return retval; + } + +@@ -4356,7 +4358,7 @@ debug_to_remove_hw_breakpoint (struct gd + } + + static int +-debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, ++debug_to_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +@@ -4364,14 +4366,14 @@ debug_to_insert_watchpoint (CORE_ADDR ad + retval = debug_target.to_insert_watchpoint (addr, len, type, cond); + + fprintf_unfiltered (gdb_stdlog, +- "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, type, ++ "target_insert_watchpoint (%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), type, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } + + static int +-debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, ++debug_to_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +@@ -4379,8 +4381,8 @@ debug_to_remove_watchpoint (CORE_ADDR ad + retval = debug_target.to_remove_watchpoint (addr, len, type, cond); + + fprintf_unfiltered (gdb_stdlog, +- "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, type, ++ "target_remove_watchpoint (%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), type, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } +Index: gdb-7.5.50.20130215/gdb/target.h +=================================================================== +--- gdb-7.5.50.20130215.orig/gdb/target.h 2013-02-15 22:40:18.000000000 +0100 ++++ gdb-7.5.50.20130215/gdb/target.h 2013-02-15 22:42:45.998804328 +0100 +@@ -466,8 +466,8 @@ struct target_ops + + /* Documentation of what the two routines below are expected to do is + provided with the corresponding target_* macros. */ +- int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); +- int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); ++ int (*to_remove_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); ++ int (*to_insert_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); + + int (*to_insert_mask_watchpoint) (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); +@@ -478,13 +478,13 @@ struct target_ops + int to_have_continuable_watchpoint; + int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *); + int (*to_watchpoint_addr_within_range) (struct target_ops *, +- CORE_ADDR, CORE_ADDR, int); ++ CORE_ADDR, CORE_ADDR, LONGEST); + + /* Documentation of this routine is provided with the corresponding + target_* macro. */ + int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); + +- int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, ++ int (*to_can_accel_watchpoint_condition) (CORE_ADDR, LONGEST, int, + struct expression *); + int (*to_masked_watch_num_registers) (struct target_ops *, + CORE_ADDR, CORE_ADDR); diff --git a/SOURCES/gdb-rhbz795424-bitpos-23of25.patch b/SOURCES/gdb-rhbz795424-bitpos-23of25.patch new file mode 100644 index 0000000..08e2cd4 --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-23of25.patch @@ -0,0 +1,1324 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html +Subject: [PATCH 4/4] Bitpos expansion - tdep changes + + +--MP_/X_WjDOvz/B_fvlsrmCwRdxe +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +This is the last part of the bitpos change. This patch does the same +thing that patch 1/4 does, except that it does so in the *-tdep files +wherever necessary. I separated these changes mainly because they are +related and can be reviewed independently. Tested on Fedora 16 x86_64. + +Regards, +Siddhesh + +--MP_/X_WjDOvz/B_fvlsrmCwRdxe +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; filename=ChangeLog-tdep + +gdb/ChangeLog + + * alpha-tdep.c (alpha_push_dummy_call): Expand ACCUMULATE_SIZE, + REQUIRED_ARG_REGS, OFFSET, LEN, TLEN to ssize_t. + (struct alpha_arg): Expand members LEN, OFFSET to ssize_t. + * amd64-tdep.c (amd64_push_arguments): Expand NUM_ELEMENTS, + ELEMENT and LEN to LONGEST. + (amd64_return_value): Expand LEN to LONGEST. + * amd64-windows-tdep.c (amd64_windows_return_value): Expand LEN + to LONGEST. + * arm-tdep.c (arm_vfp_cprc_sub_candidate): Return LONGEST. + Expand COUNT, SUB_COUNT to LONGEST. + (arm_vfp_call_candidate): Expand C to LONGEST. + (arm_push_dummy_call): Expand LEN to LONGEST. + * avr-tdep.c (struct stack_item): Expand member LEN to ssize_t. + (push_stack_item): Expand parameter LEN to ssize_t. + (avr_push_dummy_call): Expand LAST_REGNUM, J, LEN to ssize_t. + * bfin-tdep.c (bfin_push_dummy_call): Expand TOTAL_LEN, + CONTAINER_LEN to ssize_t. + * cris-tdep.c (struct stack_item): Expand member LEN to ssize_t. + (push_stack_item): Expand parameter LEN to ssize_t. + (cris_push_dummy_call): Expand LEN, REG_DEMAND, I to ssize_t. + * h8300-tdep.c (h8300_push_dummy_call): Expand STACK_ALLOC, + STACK_OFFSET to LONGEST. Expand LEN, PADDED_LEN, OFFSET to + ssize_t. + * hppa-tdep.c (hppa64_push_dummy_call): Expand LEN to LONGEST. + (hppa64_return_value): Likewise. + * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Expand + ARGS_SPACE to LONGEST. + * i386-tdep.c (i386_push_dummy_call): Expand ARG_SPACE, + ARG_SPACE_USED, LEN to LONGEST. + (i386_reg_struct_return_p): Expand LEN to LONGEST. + (i386_convert_register_p): Likewise. + (i386_register_to_value): Likewise. + (i386_value_to_register): Likewise. + * ia64-tdep.c (ia64_push_dummy_call): Expand ARGOFFSET, LEN, + NSLOTS, MEMSLOTS to LONGEST. + * iq2000-tdep.c (iq2000_push_dummy_call): Expand TYPELEN, + STACKSPACE to LONGEST. + * m32r-tdep.c (m32r_push_dummy_call): Expand LEN to LONGEST. + * m68k-tdep.c (m68k_reg_struct_return_p): Expand LEN to LONGEST. + (m68k_push_dummy_call): Expand LEN, CONTAINER_LEN, OFFSET to + LONGEST. + * m88k-tdep.c (m88k_store_arguments): Expand NUM_STACK_WORDS, + LEN, STACK_WORD to LONGEST. + * mep-tdep.c (push_large_arguments): Expand ARG_LEN to ULONGEST. + * microblaze-tdep.c (microblaze_store_return_value): Expand LEN to + LONGEST. + * mips-tdep.c (mips_xfer_register): Expand parameter BUF_OFFSET to + LONGEST. Use plongest to format print BUF_OFFSET. + (mips_eabi_push_dummy_call): Expand LEN to LONGEST. Use plongest + to format print LEN. + (mips_n32n64_fp_arg_chunk_p): Expand parameter OFFSET to LONGEST. + Expand POS to LONGEST. + (mips_n32n64_push_dummy_call): Expand LEN to LONGEST. + (mips_n32n64_return_value): Expand OFFSET to LONGEST. Use + plongest to format print OFFSET. + (mips_o32_push_dummy_call): Expand LEN to LONGEST. Use plongest + to format print LEN. + (mips_o64_push_dummy_call): Expand LEN, STACK_OFFSET to LONGEST. + Use plongest to format print LEN. + * mn10300-tdep.c (mn10300_push_dummy_call): Expand LEN to + LONGEST. + * mt-tdep.c (mt_push_dummy_call): Expand STACK_DEST, TYPELEN to + LONGEST. + * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Expand + ARGSPACE, ARGOFFSET, STRUCTOFFSET, LEN, to LONGEST. + (ppc64_sysv_abi_push_dummy_call): Expand BYTE, LEN to ssize_t. + * rl78-tdep.c (rl78_push_dummy_call): Expand LEN, CONTAINER_LEN + to LONGEST. + * rs6000-aix-tdep.c (rs6000_push_dummy_call): Expand ARGBYTES, + LEN to LONGEST. + (ran_out_of_registers_for_arguments): Expand SPACE, JJ to + LONGEST. + * s390-tdep.c (s390_value_from_register): Expand LEN to LONGEST. + (is_power_of_two): Expand parameter N to ULONGEST. + (s390_push_dummy_call): Expand LENGTH to ULONGEST. + * score-tdep.c (score_push_dummy_call): Expand ARGLEN to + LONGEST. + * sh-tdep.c (sh_use_struct_convention) Expand len to LONGEST. + (sh_justify_value_in_reg): Expand parameter LEN to LONGEST. + (sh_push_dummy_call_fpu): Expand LEN to LONGEST. Expand REG_SIZE + to ssize_t. + (sh_push_dummy_call_nofpu): Likewise. + * sh64-tdep.c (sh64_push_dummy_call): Expand STACK_OFFSET, + STACK_ALLOC, LEN to LONGEST. + * sparc-tdep.c (sparc32_store_arguments): Expand LEN to LONGEST. + * sparc64-tdep.c (sparc64_store_floating_fields): Expand + parameter BITPOS to LONGEST. Expand SUBPOS to LONGEST. + (sparc64_extract_floating_fields): Likewise. + (sparc64_store_arguments): Expand LEN to LONGEST. + * spu-tdep.c (spu_push_dummy_call): Expand N_REGS, LEN to LONGEST. + (spu_value_from_register): Expand LEN to LONGEST. + * tic6x-tdep.c (tic6x_push_dummy_call): Expand REFERENCES_OFFST, + LEN to LONGEST. Expand LEN to ssize_t. Use plongest to format + print LEN. + * tilegx-tdep.c (tilegx_push_dummy_call): Expand TYPELEN, + SLACKLEN, ALIGNLEN to LONGEST. + * v850-tdep.c (v850_push_dummy_call): Expand LEN to LONGEST. + * vax-tdep.c (vax_store_arguments): Expand COUNT, LEN to LONGEST. + (vax_return_value): Expand LEN to LONGEST. + * xstormy16-tdep.c (xstormy16_push_dummy_call): Expand J, TYPELEN + to LONGEST. + * xtensa-tdep.c (xtensa_store_return_value): Print LEN instead of + TYPE_LENGTH.. + (struct argument_info): Expoand member LENGTH to ssize_t. + (struct argument_info.u): Expand member OFFSET to ssize_t. + (xtensa_push_dummy_call): Expand SIZE, ONSTACK_SIZE to LONGEST. + Expand N to ssize_t. Use pulongest to format print TYPE_LENGTH. + +--MP_/X_WjDOvz/B_fvlsrmCwRdxe +Content-Type: text/x-patch +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename=bitpos-tdep.patch + +Index: gdb-7.5.50.20130310/gdb/alpha-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/alpha-tdep.c 2013-03-10 16:44:34.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/alpha-tdep.c 2013-03-10 16:44:42.111599838 +0100 +@@ -299,18 +299,18 @@ alpha_push_dummy_call (struct gdbarch *g + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int i; +- int accumulate_size = struct_return ? 8 : 0; ++ ssize_t accumulate_size = struct_return ? 8 : 0; + struct alpha_arg + { + const gdb_byte *contents; +- int len; +- int offset; ++ ssize_t len; ++ ssize_t offset; + }; + struct alpha_arg *alpha_args + = (struct alpha_arg *) alloca (nargs * sizeof (struct alpha_arg)); + struct alpha_arg *m_arg; + gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS]; +- int required_arg_regs; ++ ssize_t required_arg_regs; + CORE_ADDR func_addr = find_function_addr (function, NULL); + + /* The ABI places the address of the called function in T12. */ +@@ -430,8 +430,8 @@ alpha_push_dummy_call (struct gdbarch *g + for (i = nargs; m_arg--, --i >= 0;) + { + const gdb_byte *contents = m_arg->contents; +- int offset = m_arg->offset; +- int len = m_arg->len; ++ ssize_t offset = m_arg->offset; ++ ssize_t len = m_arg->len; + + /* Copy the bytes destined for registers into arg_reg_buffer. */ + if (offset < sizeof(arg_reg_buffer)) +@@ -443,7 +443,7 @@ alpha_push_dummy_call (struct gdbarch *g + } + else + { +- int tlen = sizeof(arg_reg_buffer) - offset; ++ ssize_t tlen = sizeof(arg_reg_buffer) - offset; + memcpy (arg_reg_buffer + offset, contents, tlen); + offset += tlen; + contents += tlen; +Index: gdb-7.5.50.20130310/gdb/amd64-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/amd64-tdep.c 2013-03-10 16:16:23.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/amd64-tdep.c 2013-03-10 16:44:42.112599838 +0100 +@@ -616,7 +616,7 @@ amd64_return_value (struct gdbarch *gdba + { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum amd64_reg_class class[2]; +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM }; + static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM }; + int integer_reg = 0; +@@ -769,8 +769,8 @@ amd64_push_arguments (struct regcache *r + that register number (or a negative value otherwise). */ + int *arg_addr_regno = alloca (nargs * sizeof (int)); + int num_stack_args = 0; +- int num_elements = 0; +- int element = 0; ++ LONGEST num_elements = 0; ++ LONGEST element = 0; + int integer_reg = 0; + int sse_reg = 0; + int i; +@@ -784,7 +784,7 @@ amd64_push_arguments (struct regcache *r + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + enum amd64_reg_class class[2]; + int needed_integer_regs = 0; + int needed_sse_regs = 0; +Index: gdb-7.5.50.20130310/gdb/amd64-windows-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/amd64-windows-tdep.c 2013-01-01 07:32:37.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/amd64-windows-tdep.c 2013-03-10 16:44:42.112599838 +0100 +@@ -79,7 +79,7 @@ amd64_windows_return_value (struct gdbar + struct type *type, struct regcache *regcache, + gdb_byte *readbuf, const gdb_byte *writebuf) + { +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + int regnum = -1; + + /* See if our value is returned through a register. If it is, then +Index: gdb-7.5.50.20130310/gdb/arm-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/arm-tdep.c 2013-03-01 16:38:23.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/arm-tdep.c 2013-03-10 16:44:42.115599840 +0100 +@@ -3496,7 +3496,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc + array). Vectors and complex types are not currently supported, + matching the generic AAPCS support. */ + +-static int ++static LONGEST + arm_vfp_cprc_sub_candidate (struct type *t, + enum arm_vfp_cprc_base_type *base_type) + { +@@ -3527,7 +3527,7 @@ arm_vfp_cprc_sub_candidate (struct type + + case TYPE_CODE_ARRAY: + { +- int count; ++ LONGEST count; + unsigned unitlen; + count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), base_type); + if (count == -1) +@@ -3547,13 +3547,15 @@ arm_vfp_cprc_sub_candidate (struct type + + case TYPE_CODE_STRUCT: + { +- int count = 0; ++ LONGEST count = 0; + unsigned unitlen; + int i; + for (i = 0; i < TYPE_NFIELDS (t); i++) + { +- int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), +- base_type); ++ LONGEST sub_count; ++ ++ sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), ++ base_type); + if (sub_count == -1) + return -1; + count += sub_count; +@@ -3573,13 +3575,15 @@ arm_vfp_cprc_sub_candidate (struct type + + case TYPE_CODE_UNION: + { +- int count = 0; ++ LONGEST count = 0; + unsigned unitlen; + int i; + for (i = 0; i < TYPE_NFIELDS (t); i++) + { +- int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), +- base_type); ++ LONGEST sub_count; ++ ++ sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), ++ base_type); + if (sub_count == -1) + return -1; + count = (count > sub_count ? count : sub_count); +@@ -3615,7 +3619,7 @@ arm_vfp_call_candidate (struct type *t, + int *count) + { + enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN; +- int c = arm_vfp_cprc_sub_candidate (t, &b); ++ LONGEST c = arm_vfp_cprc_sub_candidate (t, &b); + if (c <= 0 || c > 4) + return 0; + *base_type = b; +@@ -3696,7 +3700,7 @@ arm_push_dummy_call (struct gdbarch *gdb + + for (argnum = 0; argnum < nargs; argnum++) + { +- int len; ++ LONGEST len; + struct type *arg_type; + struct type *target_type; + enum type_code typecode; +Index: gdb-7.5.50.20130310/gdb/avr-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/avr-tdep.c 2013-03-01 16:38:24.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/avr-tdep.c 2013-03-10 16:44:42.116599840 +0100 +@@ -1170,13 +1170,14 @@ avr_dummy_id (struct gdbarch *gdbarch, s + + struct stack_item + { +- int len; ++ ssize_t len; + struct stack_item *prev; + void *data; + }; + + static struct stack_item * +-push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len) ++push_stack_item (struct stack_item *prev, const bfd_byte *contents, ++ ssize_t len) + { + struct stack_item *si; + si = xmalloc (sizeof (struct stack_item)); +@@ -1265,12 +1266,12 @@ avr_push_dummy_call (struct gdbarch *gdb + + for (i = 0; i < nargs; i++) + { +- int last_regnum; +- int j; ++ ssize_t last_regnum; ++ ssize_t j; + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); + const bfd_byte *contents = value_contents (arg); +- int len = TYPE_LENGTH (type); ++ ssize_t len = TYPE_LENGTH (type); + + /* Calculate the potential last register needed. */ + last_regnum = regnum - (len + (len & 1)); +Index: gdb-7.5.50.20130310/gdb/bfin-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/bfin-tdep.c 2013-03-01 16:38:24.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/bfin-tdep.c 2013-03-10 16:46:27.992669964 +0100 +@@ -506,7 +506,7 @@ bfin_push_dummy_call (struct gdbarch *gd + gdb_byte buf[4]; + int i; + long reg_r0, reg_r1, reg_r2; +- int total_len = 0; ++ ssize_t total_len = 0; + enum bfin_abi abi = bfin_abi (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); + +@@ -530,7 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gd + { + struct type *value_type = value_enclosing_type (args[i]); + struct type *arg_type = check_typedef (value_type); +- int container_len = (TYPE_LENGTH (value_type) + 3) & ~3; ++ ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3; + + sp -= container_len; + write_memory (sp, value_contents_writeable (args[i]), container_len); +Index: gdb-7.5.50.20130310/gdb/cris-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/cris-tdep.c 2013-03-01 16:38:24.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/cris-tdep.c 2013-03-10 16:44:42.117599841 +0100 +@@ -670,13 +670,13 @@ static CORE_ADDR cris_unwind_sp (struct + + struct stack_item + { +- int len; ++ ssize_t len; + struct stack_item *prev; + void *data; + }; + + static struct stack_item * +-push_stack_item (struct stack_item *prev, void *contents, int len) ++push_stack_item (struct stack_item *prev, void *contents, ssize_t len) + { + struct stack_item *si; + si = xmalloc (sizeof (struct stack_item)); +@@ -849,13 +849,13 @@ cris_push_dummy_call (struct gdbarch *gd + + for (argnum = 0; argnum < nargs; argnum++) + { +- int len; ++ ssize_t len; + char *val; +- int reg_demand; +- int i; ++ ssize_t reg_demand; ++ ssize_t i; + +- len = TYPE_LENGTH (value_type (args[argnum])); + val = (char *) value_contents (args[argnum]); ++ len = TYPE_LENGTH (value_type (args[argnum])); + + /* How may registers worth of storage do we need for this argument? */ + reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0); +Index: gdb-7.5.50.20130310/gdb/h8300-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/h8300-tdep.c 2013-01-01 07:32:44.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/h8300-tdep.c 2013-03-10 16:44:42.118599841 +0100 +@@ -640,7 +640,7 @@ h8300_push_dummy_call (struct gdbarch *g + int struct_return, CORE_ADDR struct_addr) + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int stack_alloc = 0, stack_offset = 0; ++ LONGEST stack_alloc = 0, stack_offset = 0; + int wordsize = BINWORD (gdbarch); + int reg = E_ARG0_REGNUM; + int argument; +@@ -667,11 +667,11 @@ h8300_push_dummy_call (struct gdbarch *g + { + struct cleanup *back_to; + struct type *type = value_type (args[argument]); +- int len = TYPE_LENGTH (type); + char *contents = (char *) value_contents (args[argument]); ++ ssize_t len = TYPE_LENGTH (type); + + /* Pad the argument appropriately. */ +- int padded_len = align_up (len, wordsize); ++ ssize_t padded_len = align_up (len, wordsize); + gdb_byte *padded = xmalloc (padded_len); + back_to = make_cleanup (xfree, padded); + +@@ -700,7 +700,7 @@ h8300_push_dummy_call (struct gdbarch *g + /* Heavens to Betsy --- it's really going in registers! + Note that on the h8/300s, there are gaps between the + registers in the register file. */ +- int offset; ++ ssize_t offset; + + for (offset = 0; offset < padded_len; offset += wordsize) + { +Index: gdb-7.5.50.20130310/gdb/hppa-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/hppa-tdep.c 2013-03-01 16:38:24.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/hppa-tdep.c 2013-03-10 16:44:42.119599842 +0100 +@@ -961,7 +961,7 @@ hppa64_push_dummy_call (struct gdbarch * + { + struct value *arg = args[i]; + struct type *type = value_type (arg); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + const bfd_byte *valbuf; + bfd_byte fptrbuf[8]; + int regnum; +@@ -1156,7 +1156,7 @@ hppa64_return_value (struct gdbarch *gdb + struct type *type, struct regcache *regcache, + gdb_byte *readbuf, const gdb_byte *writebuf) + { +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + int regnum, offset; + + if (len > 16) +Index: gdb-7.5.50.20130310/gdb/i386-darwin-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/i386-darwin-tdep.c 2013-02-12 20:03:54.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/i386-darwin-tdep.c 2013-03-10 16:44:42.119599842 +0100 +@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdba + + for (write_pass = 0; write_pass < 2; write_pass++) + { +- int args_space = 0; ++ LONGEST args_space = 0; + int num_m128 = 0; + + if (struct_return) +Index: gdb-7.5.50.20130310/gdb/i386-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/i386-tdep.c 2013-03-10 16:16:23.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/i386-tdep.c 2013-03-10 16:44:42.120599842 +0100 +@@ -2407,7 +2407,7 @@ i386_push_dummy_call (struct gdbarch *gd + gdb_byte buf[4]; + int i; + int write_pass; +- int args_space = 0; ++ LONGEST args_space = 0; + + /* Determine the total space required for arguments and struct + return address in a first pass (allowing for 16-byte-aligned +@@ -2415,7 +2415,7 @@ i386_push_dummy_call (struct gdbarch *gd + + for (write_pass = 0; write_pass < 2; write_pass++) + { +- int args_space_used = 0; ++ LONGEST args_space_used = 0; + + if (struct_return) + { +@@ -2432,7 +2432,7 @@ i386_push_dummy_call (struct gdbarch *gd + + for (i = 0; i < nargs; i++) + { +- int len = TYPE_LENGTH (value_enclosing_type (args[i])); ++ LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i])); + + if (write_pass) + { +@@ -2639,7 +2639,7 @@ i386_reg_struct_return_p (struct gdbarch + { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum type_code code = TYPE_CODE (type); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + gdb_assert (code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION +@@ -3094,7 +3094,7 @@ static int + i386_convert_register_p (struct gdbarch *gdbarch, + int regnum, struct type *type) + { +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + /* Values may be spread across multiple registers. Most debugging + formats aren't expressive enough to specify the locations, so +@@ -3127,7 +3127,7 @@ i386_register_to_value (struct frame_inf + int *optimizedp, int *unavailablep) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (i386_fp_regnum_p (gdbarch, regnum)) + return i387_register_to_value (frame, regnum, type, to, +@@ -3163,7 +3163,7 @@ static void + i386_value_to_register (struct frame_info *frame, int regnum, + struct type *type, const gdb_byte *from) + { +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (i386_fp_regnum_p (get_frame_arch (frame), regnum)) + { +Index: gdb-7.5.50.20130310/gdb/ia64-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/ia64-tdep.c 2013-03-10 16:16:23.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/ia64-tdep.c 2013-03-10 16:44:42.121599843 +0100 +@@ -3974,8 +3974,10 @@ ia64_push_dummy_call (struct gdbarch *gd + int argno; + struct value *arg; + struct type *type; +- int len, argoffset; +- int nslots, rseslots, memslots, slotnum, nfuncargs; ++ LONGEST argoffset; ++ LONGEST len; ++ int rseslots, slotnum, nfuncargs; ++ LONGEST nslots, memslots; + int floatreg; + ULONGEST bsp; + CORE_ADDR funcdescaddr, pc, global_pointer; +Index: gdb-7.5.50.20130310/gdb/iq2000-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/iq2000-tdep.c 2013-03-01 16:38:25.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/iq2000-tdep.c 2013-03-10 16:44:42.121599843 +0100 +@@ -654,8 +654,9 @@ iq2000_push_dummy_call (struct gdbarch * + const bfd_byte *val; + bfd_byte buf[4]; + struct type *type; +- int i, argreg, typelen, slacklen; +- int stackspace = 0; ++ int i, argreg, slacklen; ++ LONGEST typelen; ++ LONGEST stackspace = 0; + /* Used to copy struct arguments into the stack. */ + CORE_ADDR struct_ptr; + +Index: gdb-7.5.50.20130310/gdb/m32r-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/m32r-tdep.c 2013-01-01 07:32:46.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/m32r-tdep.c 2013-03-10 16:44:42.121599843 +0100 +@@ -695,7 +695,7 @@ m32r_push_dummy_call (struct gdbarch *gd + CORE_ADDR regval; + gdb_byte *val; + gdb_byte valbuf[MAX_REGISTER_SIZE]; +- int len; ++ LONGEST len; + + /* First force sp to a 4-byte alignment. */ + sp = sp & ~3; +Index: gdb-7.5.50.20130310/gdb/m68k-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/m68k-tdep.c 2013-01-01 07:32:46.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/m68k-tdep.c 2013-03-10 16:44:42.121599843 +0100 +@@ -384,7 +384,7 @@ m68k_reg_struct_return_p (struct gdbarch + { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum type_code code = TYPE_CODE (type); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION + || code == TYPE_CODE_COMPLEX); +@@ -516,9 +516,9 @@ m68k_push_dummy_call (struct gdbarch *gd + for (i = nargs - 1; i >= 0; i--) + { + struct type *value_type = value_enclosing_type (args[i]); +- int len = TYPE_LENGTH (value_type); +- int container_len = (len + 3) & ~3; +- int offset; ++ LONGEST len = TYPE_LENGTH (value_type); ++ LONGEST container_len = (len + 3) & ~3; ++ LONGEST offset; + + /* Non-scalars bigger than 4 bytes are left aligned, others are + right aligned. */ +Index: gdb-7.5.50.20130310/gdb/m88k-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/m88k-tdep.c 2013-01-01 07:32:47.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/m88k-tdep.c 2013-03-10 16:44:42.121599843 +0100 +@@ -260,13 +260,13 @@ m88k_store_arguments (struct regcache *r + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + int num_register_words = 0; +- int num_stack_words = 0; ++ LONGEST num_stack_words = 0; + int i; + + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (m88k_integral_or_pointer_p (type) && len < 4) + { +@@ -308,8 +308,8 @@ m88k_store_arguments (struct regcache *r + { + const bfd_byte *valbuf = value_contents (args[i]); + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); +- int stack_word = num_stack_words; ++ LONGEST len = TYPE_LENGTH (type); ++ LONGEST stack_word = num_stack_words; + + if (m88k_in_register_p (type)) + { +Index: gdb-7.5.50.20130310/gdb/mep-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/mep-tdep.c 2013-03-01 16:38:25.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/mep-tdep.c 2013-03-10 16:44:42.122599843 +0100 +@@ -2279,7 +2279,7 @@ push_large_arguments (CORE_ADDR sp, int + + for (i = 0; i < argc; i++) + { +- unsigned arg_len = TYPE_LENGTH (value_type (argv[i])); ++ ULONGEST arg_len = TYPE_LENGTH (value_type (argv[i])); + + if (arg_len > MEP_GPR_SIZE) + { +Index: gdb-7.5.50.20130310/gdb/mips-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/mips-tdep.c 2013-02-24 13:54:04.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/mips-tdep.c 2013-03-10 16:44:42.123599844 +0100 +@@ -396,7 +396,7 @@ static void + mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache, + int reg_num, int length, + enum bfd_endian endian, gdb_byte *in, +- const gdb_byte *out, int buf_offset) ++ const gdb_byte *out, LONGEST buf_offset) + { + int reg_offset = 0; + +@@ -419,8 +419,8 @@ mips_xfer_register (struct gdbarch *gdba + } + if (mips_debug) + fprintf_unfiltered (gdb_stderr, +- "xfer $%d, reg offset %d, buf offset %d, length %d, ", +- reg_num, reg_offset, buf_offset, length); ++ "xfer $%d, reg offset %d, buf offset %s, length %d, ", ++ reg_num, reg_offset, plongest (buf_offset), length); + if (mips_debug && out != NULL) + { + int i; +@@ -4346,13 +4346,13 @@ mips_eabi_push_dummy_call (struct gdbarc + gdb_byte valbuf[MAX_REGISTER_SIZE]; + struct value *arg = args[argnum]; + struct type *arg_type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (arg_type); ++ LONGEST len = TYPE_LENGTH (arg_type); + enum type_code typecode = TYPE_CODE (arg_type); + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_eabi_push_dummy_call: %d len=%d type=%d", +- argnum + 1, len, (int) typecode); ++ "mips_eabi_push_dummy_call: %d len=%s type=%d", ++ argnum + 1, plongest (len), (int) typecode); + + /* Function pointer arguments to mips16 code need to be made into + mips16 pointers. */ +@@ -4637,7 +4637,7 @@ mips_eabi_return_value (struct gdbarch * + + static int + mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, +- int offset) ++ LONGEST offset) + { + int i; + +@@ -4652,7 +4652,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbar + + for (i = 0; i < TYPE_NFIELDS (arg_type); i++) + { +- int pos; ++ LONGEST pos; + struct type *field_type; + + /* We're only looking at normal fields. */ +@@ -4694,7 +4694,7 @@ mips_n32n64_push_dummy_call (struct gdba + int argreg; + int float_argreg; + int argnum; +- int len = 0; ++ LONGEST len = 0; + int stack_offset = 0; + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); +@@ -5045,11 +5045,11 @@ mips_n32n64_return_value (struct gdbarch + : MIPS_V0_REGNUM); + field < TYPE_NFIELDS (type); field++, regnum += 2) + { +- int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field]) +- / TARGET_CHAR_BIT); ++ LONGEST offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field]) ++ / TARGET_CHAR_BIT); + if (mips_debug) +- fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", +- offset); ++ fprintf_unfiltered (gdb_stderr, "Return float struct+%s\n", ++ plongest (offset)); + if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) + { + /* A 16-byte long double field goes in two consecutive +@@ -5091,8 +5091,8 @@ mips_n32n64_return_value (struct gdbarch + if (offset + xfer > TYPE_LENGTH (type)) + xfer = TYPE_LENGTH (type) - offset; + if (mips_debug) +- fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n", +- offset, xfer, regnum); ++ fprintf_unfiltered (gdb_stderr, "Return struct+%s:%d in $%d\n", ++ plongest (offset), xfer, regnum); + mips_xfer_register (gdbarch, regcache, + gdbarch_num_regs (gdbarch) + regnum, + xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf, +@@ -5150,7 +5150,7 @@ mips_o32_push_dummy_call (struct gdbarch + int argreg; + int float_argreg; + int argnum; +- int len = 0; ++ LONGEST len = 0; + int stack_offset = 0; + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); +@@ -5214,13 +5214,13 @@ mips_o32_push_dummy_call (struct gdbarch + const gdb_byte *val; + struct value *arg = args[argnum]; + struct type *arg_type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (arg_type); ++ LONGEST len = TYPE_LENGTH (arg_type); + enum type_code typecode = TYPE_CODE (arg_type); + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_o32_push_dummy_call: %d len=%d type=%d", +- argnum + 1, len, (int) typecode); ++ "mips_o32_push_dummy_call: %d len=%s type=%d", ++ argnum + 1, plongest (len), (int) typecode); + + val = value_contents (arg); + +@@ -5678,8 +5678,8 @@ mips_o64_push_dummy_call (struct gdbarch + int argreg; + int float_argreg; + int argnum; +- int len = 0; +- int stack_offset = 0; ++ LONGEST len = 0; ++ LONGEST stack_offset = 0; + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); + +@@ -5740,13 +5740,13 @@ mips_o64_push_dummy_call (struct gdbarch + gdb_byte valbuf[MAX_REGISTER_SIZE]; + struct value *arg = args[argnum]; + struct type *arg_type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (arg_type); ++ LONGEST len = TYPE_LENGTH (arg_type); + enum type_code typecode = TYPE_CODE (arg_type); + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_o64_push_dummy_call: %d len=%d type=%d", +- argnum + 1, len, (int) typecode); ++ "mips_o64_push_dummy_call: %d len=%s type=%d", ++ argnum + 1, plongest (len), (int) typecode); + + val = value_contents (arg); + +Index: gdb-7.5.50.20130310/gdb/mn10300-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/mn10300-tdep.c 2013-03-01 16:38:25.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/mn10300-tdep.c 2013-03-10 16:44:42.123599844 +0100 +@@ -1228,7 +1228,7 @@ mn10300_push_dummy_call (struct gdbarch + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + const int push_size = register_size (gdbarch, E_PC_REGNUM); + int regs_used; +- int len, arg_len; ++ LONGEST len, arg_len; + int stack_offset = 0; + int argnum; + char *val, valbuf[MAX_REGISTER_SIZE]; +Index: gdb-7.5.50.20130310/gdb/mt-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/mt-tdep.c 2013-01-01 07:32:47.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/mt-tdep.c 2013-03-10 16:44:42.124599844 +0100 +@@ -783,9 +783,9 @@ mt_push_dummy_call (struct gdbarch *gdba + gdb_byte buf[MT_MAX_STRUCT_SIZE]; + int argreg = MT_1ST_ARGREG; + int split_param_len = 0; +- int stack_dest = sp; ++ LONGEST stack_dest = sp; + int slacklen; +- int typelen; ++ LONGEST typelen; + int i, j; + + /* First handle however many args we can fit into MT_1ST_ARGREG thru +Index: gdb-7.5.50.20130310/gdb/ppc-sysv-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/ppc-sysv-tdep.c 2013-01-23 21:03:18.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/ppc-sysv-tdep.c 2013-03-10 16:44:42.124599844 +0100 +@@ -68,7 +68,7 @@ ppc_sysv_abi_push_dummy_call (struct gdb + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function)); + ULONGEST saved_sp; +- int argspace = 0; /* 0 is an initial wrong guess. */ ++ LONGEST argspace = 0; /* 0 is an initial wrong guess. */ + int write_pass; + + gdb_assert (tdep->wordsize == 4); +@@ -99,9 +99,9 @@ ppc_sysv_abi_push_dummy_call (struct gdb + /* Next available vector register for vector arguments. */ + int vreg = 2; + /* Arguments start above the "LR save word" and "Back chain". */ +- int argoffset = 2 * tdep->wordsize; ++ LONGEST argoffset = 2 * tdep->wordsize; + /* Structures start after the arguments. */ +- int structoffset = argoffset + argspace; ++ LONGEST structoffset = argoffset + argspace; + + /* If the function is returning a `struct', then the first word + (which will be passed in r3) is used for struct return +@@ -120,7 +120,7 @@ ppc_sysv_abi_push_dummy_call (struct gdb + { + struct value *arg = args[argno]; + struct type *type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (type); ++ ssize_t len = TYPE_LENGTH (type); + const bfd_byte *val = value_contents (arg); + + if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8 +@@ -1556,14 +1556,14 @@ ppc64_sysv_abi_push_dummy_call (struct g + } + else + { +- int byte; ++ ssize_t byte; + for (byte = 0; byte < TYPE_LENGTH (type); + byte += tdep->wordsize) + { + if (write_pass && greg <= 10) + { + gdb_byte regval[MAX_REGISTER_SIZE]; +- int len = TYPE_LENGTH (type) - byte; ++ ssize_t len = TYPE_LENGTH (type) - byte; + if (len > tdep->wordsize) + len = tdep->wordsize; + memset (regval, 0, sizeof regval); +@@ -1591,7 +1591,7 @@ ppc64_sysv_abi_push_dummy_call (struct g + register. Work around this by always writing the + value to memory. Fortunately, doing this + simplifies the code. */ +- int len = TYPE_LENGTH (type); ++ ssize_t len = TYPE_LENGTH (type); + if (len < tdep->wordsize) + write_memory (gparam + tdep->wordsize - len, val, len); + else +Index: gdb-7.5.50.20130310/gdb/rl78-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/rl78-tdep.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/rl78-tdep.c 2013-03-10 16:44:42.124599844 +0100 +@@ -1019,8 +1019,8 @@ rl78_push_dummy_call (struct gdbarch *gd + for (i = nargs - 1; i >= 0; i--) + { + struct type *value_type = value_enclosing_type (args[i]); +- int len = TYPE_LENGTH (value_type); +- int container_len = (len + 1) & ~1; ++ LONGEST len = TYPE_LENGTH (value_type); ++ LONGEST container_len = (len + 1) & ~1; + + sp -= container_len; + write_memory (rl78_make_data_address (sp), +Index: gdb-7.5.50.20130310/gdb/rs6000-aix-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/rs6000-aix-tdep.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/rs6000-aix-tdep.c 2013-03-10 16:44:42.125599845 +0100 +@@ -198,9 +198,9 @@ rs6000_push_dummy_call (struct gdbarch * + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int ii; +- int len = 0; ++ LONGEST len = 0; + int argno; /* current argument number */ +- int argbytes; /* current argument byte */ ++ LONGEST argbytes; /* current argument byte */ + gdb_byte tmp_buffer[50]; + int f_argno = 0; /* current floating point argno */ + int wordsize = gdbarch_tdep (gdbarch)->wordsize; +@@ -328,7 +328,7 @@ ran_out_of_registers_for_arguments: + + if ((argno < nargs) || argbytes) + { +- int space = 0, jj; ++ LONGEST space = 0, jj; + + if (argbytes) + { +Index: gdb-7.5.50.20130310/gdb/s390-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/s390-tdep.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/s390-tdep.c 2013-03-10 16:44:42.125599845 +0100 +@@ -2482,7 +2482,7 @@ is_float_like (struct type *type) + + + static int +-is_power_of_two (unsigned int n) ++is_power_of_two (ULONGEST n) + { + return ((n & (n - 1)) == 0); + } +@@ -2668,7 +2668,7 @@ s390_push_dummy_call (struct gdbarch *gd + { + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); +- unsigned length = TYPE_LENGTH (type); ++ ULONGEST length = TYPE_LENGTH (type); + + if (s390_function_arg_pass_by_reference (type)) + { +Index: gdb-7.5.50.20130310/gdb/score-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/score-tdep.c 2013-03-01 16:38:26.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/score-tdep.c 2013-03-10 16:44:42.125599845 +0100 +@@ -515,7 +515,7 @@ score_push_dummy_call (struct gdbarch *g + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int argnum; + int argreg; +- int arglen = 0; ++ LONGEST arglen = 0; + CORE_ADDR stack_offset = 0; + CORE_ADDR addr = 0; + +Index: gdb-7.5.50.20130310/gdb/sh-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/sh-tdep.c 2013-01-01 07:32:50.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/sh-tdep.c 2013-03-10 16:44:42.126599845 +0100 +@@ -807,7 +807,7 @@ sh_skip_prologue (struct gdbarch *gdbarc + static int + sh_use_struct_convention (int renesas_abi, struct type *type) + { +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + int nelem = TYPE_NFIELDS (type); + + /* The Renesas ABI returns aggregate types always on stack. */ +@@ -909,7 +909,7 @@ sh_frame_align (struct gdbarch *ignore, + + /* Helper function to justify value in register according to endianess. */ + static char * +-sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len) ++sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, LONGEST len) + { + static char valbuf[4]; + +@@ -1069,7 +1069,8 @@ sh_push_dummy_call_fpu (struct gdbarch * + struct type *type; + CORE_ADDR regval; + char *val; +- int len, reg_size = 0; ++ LONGEST len; ++ ssize_t reg_size = 0; + int pass_on_stack = 0; + int treat_as_flt; + int last_reg_arg = INT_MAX; +@@ -1210,7 +1211,8 @@ sh_push_dummy_call_nofpu (struct gdbarch + struct type *type; + CORE_ADDR regval; + char *val; +- int len, reg_size = 0; ++ LONGEST len; ++ ssize_t reg_size = 0; + int pass_on_stack = 0; + int last_reg_arg = INT_MAX; + +Index: gdb-7.5.50.20130310/gdb/sh64-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/sh64-tdep.c 2013-03-01 16:38:26.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/sh64-tdep.c 2013-03-10 16:44:42.126599845 +0100 +@@ -1058,7 +1058,7 @@ sh64_push_dummy_call (struct gdbarch *gd + CORE_ADDR struct_addr) + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int stack_offset, stack_alloc; ++ LONGEST stack_offset, stack_alloc; + int int_argreg; + int float_argreg; + int double_argreg; +@@ -1069,7 +1069,7 @@ sh64_push_dummy_call (struct gdbarch *gd + CORE_ADDR regval; + char *val; + char valbuf[8]; +- int len; ++ LONGEST len; + int argreg_size; + int fp_args[12]; + +Index: gdb-7.5.50.20130310/gdb/sparc-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/sparc-tdep.c 2013-03-10 16:44:33.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/sparc-tdep.c 2013-03-10 16:44:42.127599846 +0100 +@@ -471,7 +471,7 @@ sparc32_store_arguments (struct regcache + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (sparc_structure_or_union_p (type) + || (sparc_floating_p (type) && len == 16) +Index: gdb-7.5.50.20130310/gdb/sparc64-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/sparc64-tdep.c 2013-01-01 07:32:51.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/sparc64-tdep.c 2013-03-10 16:44:42.127599846 +0100 +@@ -639,7 +639,8 @@ sparc64_16_byte_align_p (struct type *ty + + static void + sparc64_store_floating_fields (struct regcache *regcache, struct type *type, +- const gdb_byte *valbuf, int element, int bitpos) ++ const gdb_byte *valbuf, int element, ++ LONGEST bitpos) + { + int len = TYPE_LENGTH (type); + +@@ -681,7 +682,7 @@ sparc64_store_floating_fields (struct re + for (i = 0; i < TYPE_NFIELDS (type); i++) + { + struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); +- int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); ++ LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i); + + sparc64_store_floating_fields (regcache, subtype, valbuf, + element, subpos); +@@ -713,7 +714,7 @@ sparc64_store_floating_fields (struct re + + static void + sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, +- gdb_byte *valbuf, int bitpos) ++ gdb_byte *valbuf, LONGEST bitpos) + { + if (sparc64_floating_p (type)) + { +@@ -750,7 +751,7 @@ sparc64_extract_floating_fields (struct + for (i = 0; i < TYPE_NFIELDS (type); i++) + { + struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); +- int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); ++ LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i); + + sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos); + } +@@ -783,7 +784,7 @@ sparc64_store_arguments (struct regcache + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (sparc64_structure_or_union_p (type) + || (sparc64_complex_floating_p (type) && len == 32)) +@@ -883,7 +884,7 @@ sparc64_store_arguments (struct regcache + { + const gdb_byte *valbuf = value_contents (args[i]); + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + int regnum = -1; + gdb_byte buf[16]; + +Index: gdb-7.5.50.20130310/gdb/spu-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/spu-tdep.c 2013-01-01 07:32:51.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/spu-tdep.c 2013-03-10 16:44:42.127599846 +0100 +@@ -1373,7 +1373,7 @@ spu_push_dummy_call (struct gdbarch *gdb + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); + const gdb_byte *contents = value_contents (arg); +- int n_regs = align_up (TYPE_LENGTH (type), 16) / 16; ++ LONGEST n_regs = align_up (TYPE_LENGTH (type), 16) / 16; + + /* If the argument doesn't wholly fit into registers, it and + all subsequent arguments go to the stack. */ +@@ -1405,7 +1405,7 @@ spu_push_dummy_call (struct gdbarch *gdb + { + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + int preferred_slot; + + if (spu_scalar_value_p (type)) +Index: gdb-7.5.50.20130310/gdb/tic6x-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/tic6x-tdep.c 2013-03-01 16:38:27.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/tic6x-tdep.c 2013-03-10 16:44:42.128599846 +0100 +@@ -896,7 +896,7 @@ tic6x_push_dummy_call (struct gdbarch *g + int argreg = 0; + int argnum; + int stack_offset = 4; +- int references_offset = 4; ++ LONGEST references_offset = 4; + CORE_ADDR func_addr = find_function_addr (function, NULL); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + struct type *func_type = value_type (function); +@@ -930,7 +930,7 @@ tic6x_push_dummy_call (struct gdbarch *g + /* Now make space on the stack for the args. */ + for (argnum = 0; argnum < nargs; argnum++) + { +- int len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4); ++ LONGEST len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4); + if (argnum >= 10 - argreg) + references_offset += len; + stack_offset += len; +@@ -949,7 +949,7 @@ tic6x_push_dummy_call (struct gdbarch *g + const gdb_byte *val; + struct value *arg = args[argnum]; + struct type *arg_type = check_typedef (value_type (arg)); +- int len = TYPE_LENGTH (arg_type); ++ ssize_t len = TYPE_LENGTH (arg_type); + enum type_code typecode = TYPE_CODE (arg_type); + + val = value_contents (arg); +@@ -1109,7 +1109,8 @@ tic6x_push_dummy_call (struct gdbarch *g + } + else + internal_error (__FILE__, __LINE__, +- _("unexpected length %d of arg %d"), len, argnum); ++ _("unexpected length %s of arg %d"), ++ plongest (len), argnum); + + addr = sp + stack_offset; + write_memory (addr, val, len); +Index: gdb-7.5.50.20130310/gdb/tilegx-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/tilegx-tdep.c 2013-03-02 02:34:40.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/tilegx-tdep.c 2013-03-10 16:45:31.857629100 +0100 +@@ -291,7 +291,7 @@ tilegx_push_dummy_call (struct gdbarch * + CORE_ADDR stack_dest = sp; + int argreg = TILEGX_R0_REGNUM; + int i, j; +- int typelen, slacklen, alignlen; ++ LONGEST typelen, slacklen, alignlen; + static const gdb_byte four_zero_words[16] = { 0 }; + + /* If struct_return is 1, then the struct return address will +Index: gdb-7.5.50.20130310/gdb/v850-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/v850-tdep.c 2013-03-02 19:26:30.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/v850-tdep.c 2013-03-10 16:44:42.128599846 +0100 +@@ -817,7 +817,7 @@ v850_push_dummy_call (struct gdbarch *gd + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int argreg; + int argnum; +- int len = 0; ++ LONGEST len = 0; + int stack_offset; + + /* The offset onto the stack at which we will start copying parameters +@@ -842,7 +842,7 @@ v850_push_dummy_call (struct gdbarch *gd + in four registers available. Loop thru args from first to last. */ + for (argnum = 0; argnum < nargs; argnum++) + { +- int len; ++ LONGEST len; + gdb_byte *val; + gdb_byte valbuf[v850_reg_size]; + +Index: gdb-7.5.50.20130310/gdb/vax-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/vax-tdep.c 2013-03-10 16:44:34.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/vax-tdep.c 2013-03-10 16:44:42.128599846 +0100 +@@ -115,7 +115,7 @@ vax_store_arguments (struct regcache *re + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + gdb_byte buf[4]; +- int count = 0; ++ LONGEST count = 0; + int i; + + /* We create an argument list on the stack, and make the argument +@@ -124,7 +124,7 @@ vax_store_arguments (struct regcache *re + /* Push arguments in reverse order. */ + for (i = nargs - 1; i >= 0; i--) + { +- int len = TYPE_LENGTH (value_enclosing_type (args[i])); ++ LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i])); + + sp -= (len + 3) & ~3; + count += (len + 3) / 4; +Index: gdb-7.5.50.20130310/gdb/xstormy16-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/xstormy16-tdep.c 2013-03-01 16:38:27.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/xstormy16-tdep.c 2013-03-10 16:46:05.888653201 +0100 +@@ -235,8 +235,9 @@ xstormy16_push_dummy_call (struct gdbarc + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR stack_dest = sp; + int argreg = E_1ST_ARG_REGNUM; +- int i, j; +- int typelen, slacklen; ++ int i, slacklen; ++ LONGEST j; ++ LONGEST typelen; + const gdb_byte *val; + gdb_byte buf[xstormy16_pc_size]; + +Index: gdb-7.5.50.20130310/gdb/xtensa-tdep.c +=================================================================== +--- gdb-7.5.50.20130310.orig/gdb/xtensa-tdep.c 2013-01-01 07:41:29.000000000 +0100 ++++ gdb-7.5.50.20130310/gdb/xtensa-tdep.c 2013-03-10 16:44:42.129599847 +0100 +@@ -1653,8 +1653,7 @@ xtensa_store_return_value (struct type * + + if (len > (callsize > 8 ? 8 : 16)) + internal_error (__FILE__, __LINE__, +- _("unimplemented for this length: %d"), +- TYPE_LENGTH (type)); ++ _("unimplemented for this length: %d"), len); + areg = arreg_number (gdbarch, + gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb); + +@@ -1728,18 +1727,18 @@ xtensa_push_dummy_call (struct gdbarch * + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int i; +- int size, onstack_size; ++ LONGEST size, onstack_size; + gdb_byte *buf = (gdb_byte *) alloca (16); + CORE_ADDR ra, ps; + struct argument_info + { + const bfd_byte *contents; +- int length; ++ ssize_t length; + int onstack; /* onstack == 0 => in reg */ + int align; /* alignment */ + union + { +- int offset; /* stack offset if on stack. */ ++ ssize_t offset; /* stack offset if on stack. */ + int regno; /* regno if in register. */ + } u; + }; +@@ -1763,9 +1762,10 @@ xtensa_push_dummy_call (struct gdbarch * + { + struct value *arg = args[i]; + struct type *arg_type = check_typedef (value_type (arg)); +- fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i, +- host_address_to_string (arg), +- TYPE_LENGTH (arg_type)); ++ const char *arg_type_len_s = pulongest (TYPE_LENGTH (arg_type)); ++ ++ fprintf_unfiltered (gdb_stdlog, "%2d: %s %s ", i, ++ host_address_to_string (arg), arg_type_len_s); + switch (TYPE_CODE (arg_type)) + { + case TYPE_CODE_INT: +@@ -1835,8 +1835,8 @@ xtensa_push_dummy_call (struct gdbarch * + info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long); + break; + } +- info->length = TYPE_LENGTH (arg_type); + info->contents = value_contents (arg); ++ info->length = TYPE_LENGTH (arg_type); + + /* Align size and onstack_size. */ + size = (size + info->align - 1) & ~(info->align - 1); +@@ -1881,7 +1881,7 @@ xtensa_push_dummy_call (struct gdbarch * + + if (info->onstack) + { +- int n = info->length; ++ ssize_t n = info->length; + CORE_ADDR offset = sp + info->u.offset; + + /* Odd-sized structs are aligned to the lower side of a memory +@@ -1897,7 +1897,7 @@ xtensa_push_dummy_call (struct gdbarch * + } + else + { +- int n = info->length; ++ ssize_t n = info->length; + const bfd_byte *cp = info->contents; + int r = info->u.regno; + diff --git a/SOURCES/gdb-rhbz795424-bitpos-25of25-test.patch b/SOURCES/gdb-rhbz795424-bitpos-25of25-test.patch new file mode 100644 index 0000000..e406b99 --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-25of25-test.patch @@ -0,0 +1,627 @@ +http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html +Subject: Re: [PATCH] Expand fortran array bounds sizes to LONGEST + +On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote: +> I have filed for it now: +> Invalid debug/ array bounds w/-fno-range-check and 32-bit target +> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934 + +Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided +a hand-patched .S file for i386; patched GDB PASSes with it. + + +Thanks, +Jan + + +2012-10-15 Siddhesh Poyarekar + Jan Kratochvil + + * gdb.fortran/array-bounds.exp: New test file. + * gdb.fortran/array-bounds.f: New test file. + * gdb.fortran/array-bounds.S: New test file. + +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.exp 2012-10-15 20:53:26.427072583 +0200 +@@ -0,0 +1,43 @@ ++# 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 part of the gdb testsuite. It contains test to ensure that ++# array bounds accept LONGEST. ++ ++if { [skip_fortran_tests] } { return -1 } ++ ++set testfile "array-bounds" ++ ++if { [is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"] ++ || [istarget "x86_64-*-linux*"]) } { ++ set srcfile ${testfile}.S ++ set opts {nodebug f90} ++} else { ++ set srcfile ${testfile}.f ++ set opts {debug f90} ++} ++ ++if {[prepare_for_testing $testfile.exp $testfile $srcfile $opts]} { ++ print "compile failed" ++ return -1 ++} ++ ++if { ![runto MAIN__] } { ++ perror "Could not run to breakpoint `MAIN__'." ++ continue ++} ++ ++gdb_test "print &foo" {.*\(4294967296:4294967297\).*} ++gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*} +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.f 2012-10-15 19:35:12.500254261 +0200 +@@ -0,0 +1,22 @@ ++c Copyright 2012 Free Software Foundation, Inc. ++ ++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 . ++ ++ dimension foo(4294967296_8:4294967297_8) ++ dimension bar(-4294967297_8:-4294967296_8) ++ bar = 42 ++ foo=bar ++ stop ++ end ++ +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.S 2012-10-15 20:52:36.851118215 +0200 +@@ -0,0 +1,529 @@ ++/* 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 part of the gdb testsuite. */ ++ ++ .file "array-bounds.f" ++ .text ++.Ltext0: ++ .type MAIN__, @function ++MAIN__: ++.LFB0: ++ .file 1 "gdb.fortran/array-bounds.f" ++ # gdb.fortran/array-bounds.f:16 ++ .loc 1 16 0 ++ .cfi_startproc ++# BLOCK 2 seq:0 ++# PRED: ENTRY (FALLTHRU) ++ pushl %ebp ++.LCFI0: ++ .cfi_def_cfa_offset 8 ++ .cfi_offset 5, -8 ++ movl %esp, %ebp ++.LCFI1: ++ .cfi_def_cfa_register 5 ++ subl $40, %esp ++.LBB2: ++# SUCC: 3 (FALLTHRU) ++ # gdb.fortran/array-bounds.f:18 ++ .loc 1 18 0 ++ movl $-1, %eax ++# BLOCK 3 seq:1 ++# PRED: 2 (FALLTHRU) 4 [100.0%] ++.L3: ++ # gdb.fortran/array-bounds.f:18 ++ .loc 1 18 0 is_stmt 0 discriminator 1 ++ testl %eax, %eax ++# SUCC: 5 4 (FALLTHRU) ++ jg .L2 ++# BLOCK 4 seq:2 ++# PRED: 3 (FALLTHRU) ++ # gdb.fortran/array-bounds.f:18 ++ .loc 1 18 0 discriminator 2 ++ leal 1(%eax), %ecx ++ movl .LC0, %edx ++ movl %edx, -16(%ebp,%ecx,4) ++ addl $1, %eax ++# SUCC: 3 [100.0%] ++ jmp .L3 ++# BLOCK 5 seq:3 ++# PRED: 3 ++.L2: ++.LBE2: ++ # gdb.fortran/array-bounds.f:19 ++ .loc 1 19 0 is_stmt 1 ++ movl -16(%ebp), %eax ++ movl -12(%ebp), %edx ++ movl %eax, -24(%ebp) ++ movl %edx, -20(%ebp) ++ # gdb.fortran/array-bounds.f:20 ++ .loc 1 20 0 ++ movl $0, 4(%esp) ++ movl $0, (%esp) ++# SUCC: ++ call _gfortran_stop_string ++ .cfi_endproc ++.LFE0: ++ .size MAIN__, .-MAIN__ ++ .globl main ++ .type main, @function ++main: ++.LFB1: ++ # gdb.fortran/array-bounds.f:21 ++ .loc 1 21 0 ++ .cfi_startproc ++# BLOCK 2 seq:0 ++# PRED: ENTRY (FALLTHRU) ++ pushl %ebp ++.LCFI2: ++ .cfi_def_cfa_offset 8 ++ .cfi_offset 5, -8 ++ movl %esp, %ebp ++.LCFI3: ++ .cfi_def_cfa_register 5 ++ andl $-16, %esp ++ subl $16, %esp ++ # gdb.fortran/array-bounds.f:21 ++ .loc 1 21 0 ++ movl 12(%ebp), %eax ++ movl %eax, 4(%esp) ++ movl 8(%ebp), %eax ++ movl %eax, (%esp) ++ call _gfortran_set_args ++ movl $options.1.1824, 4(%esp) ++ movl $7, (%esp) ++ call _gfortran_set_options ++ call MAIN__ ++ movl $0, %eax ++ leave ++.LCFI4: ++ .cfi_restore 5 ++ .cfi_def_cfa 4, 4 ++# SUCC: EXIT [100.0%] ++ ret ++ .cfi_endproc ++.LFE1: ++ .size main, .-main ++ .section .rodata ++ .align 4 ++ .type options.1.1824, @object ++ .size options.1.1824, 28 ++options.1.1824: ++ .long 68 ++ .long 1023 ++ .long 0 ++ .long 0 ++ .long 1 ++ .long 1 ++ .long 0 ++ .align 4 ++.LC0: ++ .long 1109917696 ++ .text ++.Letext0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .long 2f - 1f # Length of Compilation Unit Info ++1: ++ .value 0x2 # DWARF version number ++ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section ++ .byte 0x4 # Pointer Size (in bytes) ++dieb: .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) ++ .long .LASF5 # DW_AT_producer: "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude" ++ .byte 0xe # DW_AT_language ++ .byte 0x2 # DW_AT_identifier_case ++ .long .LASF6 # DW_AT_name: "gdb.fortran/array-bounds.f" ++ .long .LASF7 # DW_AT_comp_dir: "" ++ .long .Ltext0 # DW_AT_low_pc ++ .long .Letext0 # DW_AT_high_pc ++ .long .Ldebug_line0 # DW_AT_stmt_list ++die26: .uleb128 0x2 # (DIE (0x26) DW_TAG_subprogram) ++ .long .LASF8 # DW_AT_name: "MAIN__" ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x10 # DW_AT_decl_line ++ .long .LFB0 # DW_AT_low_pc ++ .long .LFE0 # DW_AT_high_pc ++ .long .LLST0 # DW_AT_frame_base ++ .byte 0x1 # DW_AT_GNU_all_tail_call_sites ++ .byte 0x1 # DW_AT_main_subprogram ++ .byte 0x2 # DW_AT_calling_convention ++ .long die66 - .Ldebug_info0 # DW_AT_sibling ++die40: .uleb128 0x3 # (DIE (0x40) DW_TAG_variable) ++ .ascii "bar\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x11 # DW_AT_decl_line ++ .long die66 - .Ldebug_info0 # DW_AT_type ++ .byte 0x2 # DW_AT_location ++ .byte 0x91 # DW_OP_fbreg ++ .sleb128 -24 ++die4e: .uleb128 0x3 # (DIE (0x4e) DW_TAG_variable) ++ .ascii "foo\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x10 # DW_AT_decl_line ++ .long die88 - .Ldebug_info0 # DW_AT_type ++ .byte 0x2 # DW_AT_location ++ .byte 0x91 # DW_OP_fbreg ++ .sleb128 -32 ++die5c: .uleb128 0x4 # (DIE (0x5c) DW_TAG_lexical_block) ++ .long .LBB2 # DW_AT_low_pc ++ .long .LBE2 # DW_AT_high_pc ++ .byte 0 # end of children of DIE 0x26 ++die66: .uleb128 0x5 # (DIE (0x66) DW_TAG_array_type) ++ .long die81 - .Ldebug_info0 # DW_AT_type ++ .long die7a - .Ldebug_info0 # DW_AT_sibling ++die6f: .uleb128 0x6 # (DIE (0x6f) DW_TAG_subrange_type) ++ .long die7a - .Ldebug_info0 # DW_AT_type ++#if 0 ++ .long 0xffffffff # DW_AT_lower_bound ++ .byte 0 # DW_AT_upper_bound ++#else ++ .quad 0xfffffffeffffffff # DW_AT_lower_bound ++ .quad 0xffffffff00000000 # DW_AT_upper_bound ++#endif ++ .byte 0 # end of children of DIE 0x66 ++die7a: .uleb128 0x7 # (DIE (0x7a) DW_TAG_base_type) ++#if 0 ++ .byte 0x4 # DW_AT_byte_size ++#else ++ .byte 0x8 # DW_AT_byte_size ++#endif ++ .byte 0x5 # DW_AT_encoding ++ .long .LASF0 # DW_AT_name: "integer(kind=4)" ++die81: .uleb128 0x7 # (DIE (0x81) DW_TAG_base_type) ++ .byte 0x4 # DW_AT_byte_size ++ .byte 0x4 # DW_AT_encoding ++ .long .LASF1 # DW_AT_name: "real(kind=4)" ++die88: .uleb128 0x5 # (DIE (0x88) DW_TAG_array_type) ++ .long die81 - .Ldebug_info0 # DW_AT_type ++ .long die99 - .Ldebug_info0 # DW_AT_sibling ++die91: .uleb128 0x8 # (DIE (0x91) DW_TAG_subrange_type) ++ .long die7a - .Ldebug_info0 # DW_AT_type ++#if 0 ++ .byte 0 # DW_AT_lower_bound ++ .byte 0x1 # DW_AT_upper_bound ++#else ++ .quad 0x100000000 # DW_AT_lower_bound ++ .quad 0x100000001 # DW_AT_upper_bound ++#endif ++ .byte 0 # end of children of DIE 0x88 ++die99: .uleb128 0x9 # (DIE (0x99) DW_TAG_subprogram) ++ .byte 0x1 # DW_AT_external ++ .long .LASF9 # DW_AT_name: "main" ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x15 # DW_AT_decl_line ++ .long die7a - .Ldebug_info0 # DW_AT_type ++ .long .LFB1 # DW_AT_low_pc ++ .long .LFE1 # DW_AT_high_pc ++ .long .LLST1 # DW_AT_frame_base ++ .byte 0x1 # DW_AT_GNU_all_tail_call_sites ++ .long died4 - .Ldebug_info0 # DW_AT_sibling ++dieb6: .uleb128 0xa # (DIE (0xb6) DW_TAG_formal_parameter) ++ .long .LASF2 # DW_AT_name: "argc" ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x15 # DW_AT_decl_line ++ .long died4 - .Ldebug_info0 # DW_AT_type ++ .byte 0x2 # DW_AT_location ++ .byte 0x91 # DW_OP_fbreg ++ .sleb128 0 ++diec4: .uleb128 0xa # (DIE (0xc4) DW_TAG_formal_parameter) ++ .long .LASF3 # DW_AT_name: "argv" ++ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) ++ .byte 0x15 # DW_AT_decl_line ++ .long died9 - .Ldebug_info0 # DW_AT_type ++ .byte 0x3 # DW_AT_location ++ .byte 0x91 # DW_OP_fbreg ++ .sleb128 4 ++ .byte 0x6 # DW_OP_deref ++ .byte 0 # end of children of DIE 0x99 ++died4: .uleb128 0xb # (DIE (0xd4) DW_TAG_const_type) ++ .long die7a - .Ldebug_info0 # DW_AT_type ++died9: .uleb128 0xc # (DIE (0xd9) DW_TAG_pointer_type) ++ .byte 0x4 # DW_AT_byte_size ++ .long diedf - .Ldebug_info0 # DW_AT_type ++diedf: .uleb128 0x7 # (DIE (0xdf) DW_TAG_base_type) ++ .byte 0x1 # DW_AT_byte_size ++ .byte 0x8 # DW_AT_encoding ++ .long .LASF4 # DW_AT_name: "character(kind=1)" ++ .byte 0 # end of children of DIE 0xb ++2: ++ .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 0x42 # (DW_AT_identifier_case) ++ .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 0x6 # (DW_FORM_data4) ++ .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 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 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 0x6 # (DW_FORM_data4) ++ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) ++ .uleb128 0xc # (DW_FORM_flag) ++ .uleb128 0x6a # (DW_AT_main_subprogram) ++ .uleb128 0xc # (DW_FORM_flag) ++ .uleb128 0x36 # (DW_AT_calling_convention) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 # (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 0xa # (DW_FORM_block1) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 # (abbrev code) ++ .uleb128 0xb # (TAG: DW_TAG_lexical_block) ++ .byte 0 # DW_children_no ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x12 # (DW_AT_high_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 # (abbrev code) ++ .uleb128 0x1 # (TAG: DW_TAG_array_type) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 # (abbrev code) ++ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) ++ .byte 0 # DW_children_no ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++#if 0 ++ .uleb128 0x22 # (DW_AT_lower_bound) ++ .uleb128 0x6 # (DW_FORM_data4) ++ .uleb128 0x2f # (DW_AT_upper_bound) ++ .uleb128 0xb # (DW_FORM_data1) ++#else ++ .uleb128 0x22 # (DW_AT_lower_bound) ++ .uleb128 0x7 # (DW_FORM_data8) ++ .uleb128 0x2f # (DW_AT_upper_bound) ++ .uleb128 0x7 # (DW_FORM_data8) ++#endif ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 # (abbrev code) ++ .uleb128 0x24 # (TAG: DW_TAG_base_type) ++ .byte 0 # DW_children_no ++ .uleb128 0xb # (DW_AT_byte_size) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x3e # (DW_AT_encoding) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x3 # (DW_AT_name) ++ .uleb128 0xe # (DW_FORM_strp) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 # (abbrev code) ++ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) ++ .byte 0 # DW_children_no ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++#if 0 ++ .uleb128 0x22 # (DW_AT_lower_bound) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x2f # (DW_AT_upper_bound) ++ .uleb128 0xb # (DW_FORM_data1) ++#else ++ .uleb128 0x22 # (DW_AT_lower_bound) ++ .uleb128 0x7 # (DW_FORM_data8) ++ .uleb128 0x2f # (DW_AT_upper_bound) ++ .uleb128 0x7 # (DW_FORM_data8) ++#endif ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 # (abbrev code) ++ .uleb128 0x2e # (TAG: DW_TAG_subprogram) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x3f # (DW_AT_external) ++ .uleb128 0xc # (DW_FORM_flag) ++ .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 0x1 # (DW_FORM_addr) ++ .uleb128 0x40 # (DW_AT_frame_base) ++ .uleb128 0x6 # (DW_FORM_data4) ++ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) ++ .uleb128 0xc # (DW_FORM_flag) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa # (abbrev code) ++ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) ++ .byte 0 # DW_children_no ++ .uleb128 0x3 # (DW_AT_name) ++ .uleb128 0xe # (DW_FORM_strp) ++ .uleb128 0x3a # (DW_AT_decl_file) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x3b # (DW_AT_decl_line) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x2 # (DW_AT_location) ++ .uleb128 0xa # (DW_FORM_block1) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb # (abbrev code) ++ .uleb128 0x26 # (TAG: DW_TAG_const_type) ++ .byte 0 # DW_children_no ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xc # (abbrev code) ++ .uleb128 0xf # (TAG: DW_TAG_pointer_type) ++ .byte 0 # DW_children_no ++ .uleb128 0xb # (DW_AT_byte_size) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_loc,"",@progbits ++.Ldebug_loc0: ++.LLST0: ++ .long .LFB0-.Ltext0 # Location list begin address (*.LLST0) ++ .long .LCFI0-.Ltext0 # Location list end address (*.LLST0) ++ .value 0x2 # Location expression size ++ .byte 0x74 # DW_OP_breg4 ++ .sleb128 4 ++ .long .LCFI0-.Ltext0 # Location list begin address (*.LLST0) ++ .long .LCFI1-.Ltext0 # Location list end address (*.LLST0) ++ .value 0x2 # Location expression size ++ .byte 0x74 # DW_OP_breg4 ++ .sleb128 8 ++ .long .LCFI1-.Ltext0 # Location list begin address (*.LLST0) ++ .long .LFE0-.Ltext0 # Location list end address (*.LLST0) ++ .value 0x2 # Location expression size ++ .byte 0x75 # DW_OP_breg5 ++ .sleb128 8 ++ .long 0 # Location list terminator begin (*.LLST0) ++ .long 0 # Location list terminator end (*.LLST0) ++.LLST1: ++ .long .LFB1-.Ltext0 # Location list begin address (*.LLST1) ++ .long .LCFI2-.Ltext0 # Location list end address (*.LLST1) ++ .value 0x2 # Location expression size ++ .byte 0x74 # DW_OP_breg4 ++ .sleb128 4 ++ .long .LCFI2-.Ltext0 # Location list begin address (*.LLST1) ++ .long .LCFI3-.Ltext0 # Location list end address (*.LLST1) ++ .value 0x2 # Location expression size ++ .byte 0x74 # DW_OP_breg4 ++ .sleb128 8 ++ .long .LCFI3-.Ltext0 # Location list begin address (*.LLST1) ++ .long .LCFI4-.Ltext0 # Location list end address (*.LLST1) ++ .value 0x2 # Location expression size ++ .byte 0x75 # DW_OP_breg5 ++ .sleb128 8 ++ .long .LCFI4-.Ltext0 # Location list begin address (*.LLST1) ++ .long .LFE1-.Ltext0 # Location list end address (*.LLST1) ++ .value 0x2 # Location expression size ++ .byte 0x74 # DW_OP_breg4 ++ .sleb128 4 ++ .long 0 # Location list terminator begin (*.LLST1) ++ .long 0 # Location list terminator end (*.LLST1) ++ .section .debug_aranges,"",@progbits ++ .long 0x1c # Length of Address Ranges Info ++ .value 0x2 # DWARF Version ++ .long .Ldebug_info0 # Offset of Compilation Unit Info ++ .byte 0x4 # Size of Address ++ .byte 0 # Size of Segment Descriptor ++ .value 0 # Pad to 8 byte boundary ++ .value 0 ++ .long .Ltext0 # Address ++ .long .Letext0-.Ltext0 # Length ++ .long 0 ++ .long 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF4: ++ .string "character(kind=1)" ++.LASF5: ++ .string "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude" ++.LASF7: ++ .string "" ++.LASF0: ++#if 0 ++ .string "integer(kind=4)" ++#else ++ .string "integer(kind=8)" ++#endif ++.LASF9: ++ .string "main" ++.LASF8: ++ .string "MAIN__" ++.LASF6: ++ .string "gdb.fortran/array-bounds.f" ++.LASF2: ++ .string "argc" ++.LASF1: ++ .string "real(kind=4)" ++.LASF3: ++ .string "argv" ++ .ident "GCC: (GNU) 4.8.0 20121015 (experimental)" ++ .section .note.GNU-stack,"",@progbits + diff --git a/SOURCES/gdb-rhbz795424-bitpos-25of25.patch b/SOURCES/gdb-rhbz795424-bitpos-25of25.patch new file mode 100644 index 0000000..1c39b9e --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-25of25.patch @@ -0,0 +1,156 @@ +http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html +Subject: [PATCH] Expand fortran array bounds sizes to LONGEST + + +--MP_/90J7bck2fqDySEX9JkZtaqL +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +Range bounds for a gdb type can have LONGEST values for low and high +bounds. Fortran range bounds functions however use only int. The larger +ranges don't compile by default on gcc, but it is possible to override +the check in the compiler by using -fno-range-check. As a result, this +check is necessary so that we don't print junk in case of an overflow. + +Attached patch does this expansion and also includes a test case that +verifies that the problem is fixed. I have also verified on x86_64 that +this patch does not cause any regressions. + +Regards, +Siddhesh + +gdb/ChangeLog: + + * f-lang.h (f77_get_upperbound): Return LONGEST. + (f77_get_lowerbound): Likewise. + * f-typeprint.c (f_type_print_varspec_suffix): Expand + UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format + print them. + (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use + plongest to format print it. + * f-valprint.c (f77_get_lowerbound): Return LONGEST. + (f77_get_upperbound): Likewise. + (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, + LOWER_BOUND to LONGEST. + (f77_create_arrayprint_offset_tbl): Likewise. + +testsuite/ChangeLog: + + * gdb.fortran/array-bounds.exp: New test case. + * gdb.fortran/array-bounds.f: New test case. + +--MP_/90J7bck2fqDySEX9JkZtaqL +Content-Type: text/x-patch +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename=f77-bounds.patch + +Index: gdb-7.5.50.20130118/gdb/f-lang.h +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/f-lang.h 2013-01-18 23:39:40.209500968 +0100 ++++ gdb-7.5.50.20130118/gdb/f-lang.h 2013-01-18 23:40:04.010531177 +0100 +@@ -65,9 +65,9 @@ struct common_block + struct symbol *contents[1]; + }; + +-extern int f77_get_upperbound (struct type *); ++extern LONGEST f77_get_upperbound (struct type *); + +-extern int f77_get_lowerbound (struct type *); ++extern LONGEST f77_get_lowerbound (struct type *); + + extern void f77_get_dynamic_array_length (struct type *); + +Index: gdb-7.5.50.20130118/gdb/f-typeprint.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/f-typeprint.c 2013-01-18 23:39:37.564497620 +0100 ++++ gdb-7.5.50.20130118/gdb/f-typeprint.c 2013-01-18 23:39:40.210500970 +0100 +@@ -180,7 +180,7 @@ f_type_print_varspec_suffix (struct type + int show, int passed_a_ptr, int demangled_args, + int arrayprint_recurse_level) + { +- int upper_bound, lower_bound; ++ LONGEST upper_bound, lower_bound; + + /* No static variables are permitted as an error call may occur during + execution of this function. */ +@@ -210,7 +210,7 @@ f_type_print_varspec_suffix (struct type + + lower_bound = f77_get_lowerbound (type); + if (lower_bound != 1) /* Not the default. */ +- fprintf_filtered (stream, "%d:", lower_bound); ++ fprintf_filtered (stream, "%s:", plongest (lower_bound)); + + /* Make sure that, if we have an assumed size array, we + print out a warning and print the upperbound as '*'. */ +@@ -220,7 +220,7 @@ f_type_print_varspec_suffix (struct type + else + { + upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "%d", upper_bound); ++ fprintf_filtered (stream, "%s", plongest (upper_bound)); + } + + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) +@@ -288,7 +288,7 @@ void + f_type_print_base (struct type *type, struct ui_file *stream, int show, + int level) + { +- int upper_bound; ++ LONGEST upper_bound; + int index; + + QUIT; +@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, st + else + { + upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "character*%d", upper_bound); ++ fprintf_filtered (stream, "character*%s", plongest (upper_bound)); + } + break; + +Index: gdb-7.5.50.20130118/gdb/f-valprint.c +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/f-valprint.c 2013-01-18 23:39:37.564497620 +0100 ++++ gdb-7.5.50.20130118/gdb/f-valprint.c 2013-01-18 23:39:40.210500970 +0100 +@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN + + #define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) + +-int ++LONGEST + f77_get_lowerbound (struct type *type) + { + f_object_address_data_valid_or_error (type); +@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type) + return TYPE_ARRAY_LOWER_BOUND_VALUE (type); + } + +-int ++LONGEST + f77_get_upperbound (struct type *type) + { + f_object_address_data_valid_or_error (type); +@@ -92,8 +92,8 @@ f77_get_upperbound (struct type *type) + static void + f77_get_dynamic_length_of_aggregate (struct type *type) + { +- int upper_bound = -1; +- int lower_bound = 1; ++ LONGEST upper_bound = -1; ++ LONGEST lower_bound = 1; + + /* Recursively go all the way down into a possibly multi-dimensional + F77 array and get the bounds. For simple arrays, this is pretty +@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct + struct type *tmp_type; + LONGEST eltlen; + int ndimen = 1; +- int upper, lower; ++ LONGEST upper, lower; + + tmp_type = type; + diff --git a/SOURCES/gdb-rhbz795424-bitpos-lazyvalue.patch b/SOURCES/gdb-rhbz795424-bitpos-lazyvalue.patch new file mode 100644 index 0000000..64e1565 --- /dev/null +++ b/SOURCES/gdb-rhbz795424-bitpos-lazyvalue.patch @@ -0,0 +1,425 @@ +--- gdb-7.5.0.20120926-m64/gdb/value.c-orig 2012-11-09 17:08:52.137406118 +0100 ++++ gdb-7.5.0.20120926-m64/gdb/value.c 2012-11-09 17:32:38.324199230 +0100 +@@ -663,7 +663,6 @@ allocate_value_lazy (struct type *type) + description correctly. */ + check_typedef (type); + +- ulongest_fits_host_or_error (TYPE_LENGTH (type)); + val = (struct value *) xzalloc (sizeof (struct value)); + val->contents = NULL; + val->next = all_values; +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types-64bit.exp 2012-11-09 18:13:56.286587994 +0100 +@@ -0,0 +1,59 @@ ++# 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 . ++ ++standard_testfile .c longest-types-64bit.S ++ ++proc test { name } { with_test_prefix $name { ++ # 64-bit array size should not overflow ++ gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0} ++ ++ # The offset should not overflow ++ gdb_test "print &f->buf2" {= \(char \(\*\)\[2\]\) 0xffff000000} ++}} ++ ++ ++# Test 64-bit file first as it is not compiled so its compilation never fails. ++ ++set file64bitbz2uu ${srcdir}/${subdir}/${testfile}-64bit.bz2.uu ++set file64bit ${objdir}/${subdir}/${testfile}-64bit ++ ++if {[catch "system \"uudecode -o - ${file64bitbz2uu} | bzip2 -dc >${file64bit}\""] != 0} { ++ untested "failed uudecode or bzip2" ++ return -1 ++} ++file stat ${file64bit} file64bitstat ++if {$file64bitstat(size) != 9501} { ++ untested "uudecode or bzip2 produce invalid result" ++ return -1 ++} ++ ++clean_restart ${file64bit} ++ ++#if { [prepare_for_testing ${testfile}.exp ${testfile}-64bit $srcfile2 {nodebug}] } { ++# return -1 ++#} ++ ++test "64bit" ++ ++ ++# And here is the native build test. ++ ++if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } { ++ return -1 ++} ++ ++test "native" +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ ./gdb/testsuite/gdb.base/longest-types-64bit.c 2012-11-09 17:08:51.374406344 +0100 +@@ -0,0 +1,28 @@ ++/* 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 . */ ++ ++struct foo ++{ ++ char buf[0xffff000000]; ++ char buf2[2]; ++} *f; ++ ++int ++main (void) ++{ ++ return 0; ++} +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ ./gdb/testsuite/gdb.base/longest-types-64bit.S 2012-11-09 17:51:37.597846130 +0100 +@@ -0,0 +1,249 @@ ++/* 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 . */ ++ ++ .file "longest-types-64bit.c" ++ .text ++.Ltext0: ++ .globl main ++main: ++ .comm f,8,8 ++.Letext0: ++ .file 1 "gdb.base/longest-types-64bit.c" ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0x9a /* Length of Compilation Unit Info */ ++ .2byte 0x2 /* DWARF version number */ ++ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ ++ .byte 0x8 /* Pointer Size (in bytes) */ ++ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ ++ .4byte .LASF3 /* DW_AT_producer: "GNU C 4.7.3 20121109 (prerelease)" */ ++ .byte 0x1 /* DW_AT_language */ ++ .4byte .LASF4 /* DW_AT_name: "gdb.base/longest-types-64bit.c" */ ++ .4byte .LASF5 /* DW_AT_comp_dir: "" */ ++ .4byte .Ldebug_line0 /* DW_AT_stmt_list */ ++ .uleb128 0x2 /* (DIE (0x1d) DW_TAG_structure_type) */ ++ .ascii "foo\0" /* DW_AT_name */ ++ .4byte 0xff000002 /* DW_AT_byte_size */ ++ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ ++ .byte 0x12 /* DW_AT_decl_line */ ++ .4byte 0x4e /* DW_AT_sibling */ ++ .uleb128 0x3 /* (DIE (0x2c) DW_TAG_member) */ ++ .ascii "buf\0" /* DW_AT_name */ ++ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ ++ .byte 0x14 /* DW_AT_decl_line */ ++ .4byte 0x4e /* DW_AT_type */ ++ .byte 0x2 /* DW_AT_data_member_location */ ++ .byte 0x23 /* DW_OP_plus_uconst */ ++ .uleb128 0 ++ .uleb128 0x4 /* (DIE (0x3a) DW_TAG_member) */ ++ .4byte .LASF0 /* DW_AT_name: "buf2" */ ++ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ ++ .byte 0x15 /* DW_AT_decl_line */ ++ .4byte 0x73 /* DW_AT_type */ ++ .byte 0x7 /* DW_AT_data_member_location */ ++ .byte 0x23 /* DW_OP_plus_uconst */ ++ .uleb128 0xffff000000 ++ .byte 0 /* end of children of DIE 0x1d */ ++ .uleb128 0x5 /* (DIE (0x4e) DW_TAG_array_type) */ ++ .4byte 0x6c /* DW_AT_type */ ++ .4byte 0x65 /* DW_AT_sibling */ ++ .uleb128 0x6 /* (DIE (0x57) DW_TAG_subrange_type) */ ++ .4byte 0x65 /* DW_AT_type */ ++ .quad 0xfffeffffff /* DW_AT_upper_bound */ ++ .byte 0 /* end of children of DIE 0x4e */ ++ .uleb128 0x7 /* (DIE (0x65) DW_TAG_base_type) */ ++ .byte 0x8 /* DW_AT_byte_size */ ++ .byte 0x7 /* DW_AT_encoding */ ++ .4byte .LASF1 /* DW_AT_name: "sizetype" */ ++ .uleb128 0x7 /* (DIE (0x6c) DW_TAG_base_type) */ ++ .byte 0x1 /* DW_AT_byte_size */ ++ .byte 0x6 /* DW_AT_encoding */ ++ .4byte .LASF2 /* DW_AT_name: "char" */ ++ .uleb128 0x5 /* (DIE (0x73) DW_TAG_array_type) */ ++ .4byte 0x6c /* DW_AT_type */ ++ .4byte 0x83 /* DW_AT_sibling */ ++ .uleb128 0x8 /* (DIE (0x7c) DW_TAG_subrange_type) */ ++ .4byte 0x65 /* DW_AT_type */ ++ .byte 0x1 /* DW_AT_upper_bound */ ++ .byte 0 /* end of children of DIE 0x73 */ ++ .uleb128 0x9 /* (DIE (0x83) DW_TAG_variable) */ ++ .ascii "f\0" /* DW_AT_name */ ++ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ ++ .byte 0x16 /* DW_AT_decl_line */ ++ .4byte 0x97 /* DW_AT_type */ ++ .byte 0x1 /* DW_AT_external */ ++ .byte 0x9 /* DW_AT_location */ ++ .byte 0x3 /* DW_OP_addr */ ++ .quad f ++ .uleb128 0xa /* (DIE (0x97) DW_TAG_pointer_type) */ ++ .byte 0x8 /* DW_AT_byte_size */ ++ .4byte 0x1d /* 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 0x10 /* (DW_AT_stmt_list) */ ++ .uleb128 0x6 /* (DW_FORM_data4) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 /* (abbrev code) */ ++ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ ++ .byte 0x1 /* DW_children_yes */ ++ .uleb128 0x3 /* (DW_AT_name) */ ++ .uleb128 0x8 /* (DW_FORM_string) */ ++ .uleb128 0xb /* (DW_AT_byte_size) */ ++ .uleb128 0x6 /* (DW_FORM_data4) */ ++ .uleb128 0x3a /* (DW_AT_decl_file) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x3b /* (DW_AT_decl_line) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x1 /* (DW_AT_sibling) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 /* (abbrev code) */ ++ .uleb128 0xd /* (TAG: DW_TAG_member) */ ++ .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 0x38 /* (DW_AT_data_member_location) */ ++ .uleb128 0xa /* (DW_FORM_block1) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 /* (abbrev code) */ ++ .uleb128 0xd /* (TAG: DW_TAG_member) */ ++ .byte 0 /* DW_children_no */ ++ .uleb128 0x3 /* (DW_AT_name) */ ++ .uleb128 0xe /* (DW_FORM_strp) */ ++ .uleb128 0x3a /* (DW_AT_decl_file) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x3b /* (DW_AT_decl_line) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x49 /* (DW_AT_type) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .uleb128 0x38 /* (DW_AT_data_member_location) */ ++ .uleb128 0xa /* (DW_FORM_block1) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 /* (abbrev code) */ ++ .uleb128 0x1 /* (TAG: DW_TAG_array_type) */ ++ .byte 0x1 /* DW_children_yes */ ++ .uleb128 0x49 /* (DW_AT_type) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .uleb128 0x1 /* (DW_AT_sibling) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 /* (abbrev code) */ ++ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */ ++ .byte 0 /* DW_children_no */ ++ .uleb128 0x49 /* (DW_AT_type) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .uleb128 0x2f /* (DW_AT_upper_bound) */ ++ .uleb128 0x7 /* (DW_FORM_data8) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 /* (abbrev code) */ ++ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ ++ .byte 0 /* DW_children_no */ ++ .uleb128 0xb /* (DW_AT_byte_size) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x3e /* (DW_AT_encoding) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x3 /* (DW_AT_name) */ ++ .uleb128 0xe /* (DW_FORM_strp) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 /* (abbrev code) */ ++ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */ ++ .byte 0 /* DW_children_no */ ++ .uleb128 0x49 /* (DW_AT_type) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .uleb128 0x2f /* (DW_AT_upper_bound) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 /* (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 0x3f /* (DW_AT_external) */ ++ .uleb128 0xc /* (DW_FORM_flag) */ ++ .uleb128 0x2 /* (DW_AT_location) */ ++ .uleb128 0xa /* (DW_FORM_block1) */ ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa /* (abbrev code) */ ++ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */ ++ .byte 0 /* DW_children_no */ ++ .uleb128 0xb /* (DW_AT_byte_size) */ ++ .uleb128 0xb /* (DW_FORM_data1) */ ++ .uleb128 0x49 /* (DW_AT_type) */ ++ .uleb128 0x13 /* (DW_FORM_ref4) */ ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x1c /* Length of Address Ranges Info */ ++ .2byte 0x2 /* DWARF Version */ ++ .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */ ++ .byte 0x8 /* Size of Address */ ++ .byte 0 /* Size of Segment Descriptor */ ++ .2byte 0 /* Pad to 16 byte boundary */ ++ .2byte 0 ++ .quad 0 ++ .quad 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF4: ++ .string "gdb.base/longest-types-64bit.c" ++.LASF3: ++ .string "GNU C 4.7.3 20121109 (prerelease)" ++.LASF0: ++ .string "buf2" ++.LASF1: ++ .string "sizetype" ++.LASF5: ++ .string "" ++.LASF2: ++ .string "char" ++ .ident "GCC: (GNU) 4.7.3 20121109 (prerelease)" ++ .section .note.GNU-stack,"",@progbits +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu 2012-11-09 18:04:52.995692771 +0100 +@@ -0,0 +1,67 @@ ++begin 755 gdb.base/longest-types-64bit.bz2 ++M0EIH.3%!62936<'N#OH`"G/________^______?_Y______//]7SQD5'^/_% ++M=VY7?F_[X`F]]SG7531-==V:Z-.FW;M.U7=';:UH@<&FD31,E3]J'HE-/TR@ ++M]4_5/32;%/U3]1--HU/U$#$R'I'J,FC0T-,)B'J#:CU,F@]0`/4:>F@CU/4, ++MA@$S2>IH!H`TR/0-$$:9`C(&FHU3VE-J;4\%,@>4T:#]49-J/4`>HT!H#3)^ ++MJ`!H-``T]0&@-```:'J``&@`:9!`R9,@&3(`#3!#0!H``-#$--`,@``T`T#( ++M:`:`&0&@::,0:-```:``-`E-$1#4-3:4]3R9-39(Q/)#3R-30:9#$T!D!H&@ ++M,CTGI!H#(#0T`#0``T`T`:``-``T`0,F3(!DR``TP0T`:``#0Q#30#(``-`- ++M`R&@&@!D!H&FC$&C0``&@`#0)%)H32>JGZ&!)Z1B1X@)DTVC4>H`&0:``R&@ ++M,C0:``T``,C0``!H``#(`T`:#0U^\?]7K8M.96V/2[?M*DC)>WIUF)H7T\$:KKRE&\Q ++M..M]L1*,!>D!X)RW,[,1I,9N%X-N&2+*:&)DJY4(VFQG%9K[/?J06WACF6-I ++MJ&JJ9,ZK4;X28M@[==%ME(A54:%>+3->MRK(G!8#TY>@E$6DR&<_5:C&/RZE ++MI,!E6#`;*8R*E@++*))U)[6=OKFM%'+$-H5\X@1D)_Y*"NKV. ++M&\F8?SXW^HQ:Y@(Q[.>PEG=]@^ ++M%C"3EZ/1X'H*02ZQH":6"@;8Z0LEW6)> ++M6^V=*`FB'5G4MD8L3J5XT#SW;J1]ZO+"SPIS%J(P46+Q=CC2$H-`-B&TD)M` ++M&A:066DA%AB0C6,460>M8B+$:-BR&@NM()F`S',,F8+#&0.SMOK@.G<'83N. ++MDA"#5-`JVC("1*TA;/M()&8J0+YH%IFV)+OA@4,`E?3M$[$@&Q`3]A!$&A(- ++M$PBT+2,@PU+2H9(T-H3N6'(2;""%2T*1I2P@`L?AG8&A!=31J7)1(9FB'8X= ++MWJ0S#YEG9K$.#.[L.[CNA"4JSJ^GK2*)UH=MC0.R8+E75'.09[G ++MMQ1*[GI:>#>K`_NZS:V6>$K;OX6#!!N'"2413$DTL&]7KY>B<3V5!!C8#X5+ ++MF%9X!8NOKM5 ++M+"N&P4.75C16!A9Q;:C.6N`WZDV=-]!,5PG]SNP[GV^L?YGI]7_'D8N?XV ++M'[7KZJWYVMXGBQS[`!)YI%3:D)I2!;%'R`W&YB<`9O2#F"C/)F;JK9P+@3&( ++MAH31[W)=YCODQDUKNM7A"3.C!2%CHTJNZ"Z\+#F-?(DLE>XAC%07B8;$%J_L ++MJPK48QC&,916=IM+<1&WRKLB6&Q2O79*!7S$,`7J8*!`!=K:5W550[NH9M#_ ++MKL!LT,&;59GZW7S"5Z4%`%&!`9"J9`0:IR&H=MTKT=PEYC$,4K90M9AT'%;_ ++MB0HVLE)(W&YWF,C:TURXO:`M[RX(A-GT97456Q4Z*HPU*4J:*[WU-4GD.9UV ++MSA#L4X[[*Y+)8IF.EO<.TP4IC2?(4HX)W1#:GOMOD2F;HM1BV#;PH[ ++M7:PJ-!#,!6N<3')-0C,>15'IZ>@U^CJJJ+>+>%%)%BBATD\)*F6&BLMIR&?\ ++MQ2_?33@"NR1/CN\:)>5DG6`>$;$3QA94'-3]*CU6YG])<=2)'GC"RP-RK&-3 ++MZDT-M_)R+F06DS?CR>E@^!,33"U6X<@OXO$Q>U$\T@IU'@T=>K`G7H8K5GLXMS3*^@JLVBHHE'.&?9RKC?Y`&&3J5!/C$++<@U#Q' ++M9R3I.$+S`%]-.UO>WH^C73F<&;RIJR+(Q@7(3PP*W[-O,,DD3S7BUK^I@D%* ++M`Y<*2TXJ&7;2'6'R.U>]0-="M`K+&N%/==N4U@9%@M1)U&251C($^S"WL"]T ++M-XN'D2[II3-$K%+&`3['O)%,8G*E%_8RV6A5B_4(2/?-AIC.\/>,YFJ<(G.8 ++MAVP?UN*=ME:7&T!C%)I:&4H:-5>&^!&0>A.O'0G'/6&ZZ964@04&=#DC`%&: ++MUNLOS?,?'T:T!8L80='M:96K4;JX)6.('1#J$.1/L)$IS<4/*'2D34 ++M/@J\BA(I2T40JS%9G8F!7U5_!#'U!+[7$ES&)@:*QAET-IBX6'_N5^7/#>@V ++MN3&,-6(AG[8&!8LV+F_U"W?/)+Y^,;=1K:SW28<0WA2"UPHP^8FG#R$!`Y`, ++MLF<`U*NNU\[6N03"*?I8D=K7.Z*H=A_37;S=LVC(BQ,58Q_\#G`'P*_-]T!G4$`V0BS]'S)D/;V7R?.2F?SF)N+2+#P2_G(49TCE&*UIVT-MP808VTVV-$(*`VT<%>%96AHOL`(7%SI2%-R ++M#G2F02VQQH-7KT3E05I9Z)E\$Y8ED1KU`(4QHT%B]1$F:F1&8DAN.Q4&*?F@ ++M.8D965.$PRHT5HD,G=G!KTF3D ++M94"&ZA-F,.19=8`\(Q;A07Q%!19*3#*F9Q+D(0K@V87@O.=7EJIM6`!4`>D! ++M)49QHA!BV+:4O@K00$$!5*6>A@2@4D)@R\"%$2F"O:24J*L(RP#N;O4K7I&2 ++M[#)KR47H-N[VJ%3>$`9,AF8QID&I3G+D`*]BX98B$2K":A7_\ ++M_]7LT!4,$NL5)NE>9[:MK2_/'GO:7"P`=P(\L]O?"-APH(834$,W!IJS+U1F1C.!D$!&KS^-6%F90PQ[F]F=$^QE\X+- ++M@.W*LPH_78B>MHH@69RU[*'1J@8QAC\KSV@IG\(;_CUW:ZR2.,0$E3LZ_^P= ++M<_DCP"Q<`;+_;YP#^U%&E^#2M%,T?F3UN^>TSH)GFL"\%RF[KNZ+[R+@<&.$ ++MC42)B96\1-.O_I).K7)X]W>EQ):4C(XB*+:S%0_37D^EBP+1HU(D?3"%_O2R ++M6-#X>AU#<$*!/,W6QC^;O^%]LR&_X'<8X$<3CUU_QFAJ;">H)2443GD4W!4# ++?<55!2^6_8J$)-O<>\H0U/6Q^>UG0%W)%.%"0P>X.^@`` ++` ++end diff --git a/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch new file mode 100644 index 0000000..b2e0f85 --- /dev/null +++ b/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch @@ -0,0 +1,138 @@ +Index: gdb-7.5.91.20130407/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +=================================================================== +--- /dev/null ++++ gdb-7.5.91.20130407/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +@@ -0,0 +1,53 @@ ++#include ++#include ++ ++class x ++ { ++ public: ++ int n; ++ ++ x() : n(0) {} ++ }; ++ ++class y ++ { ++ public: ++ int v; ++ ++ y() : v(0) {} ++ static __thread x *xp; ++ }; ++ ++__thread x *y::xp; ++ ++static void ++foo (y *yp) ++{ ++ yp->v = 1; /* foo_marker */ ++} ++ ++static void * ++bar (void *unused) ++{ ++ x xinst; ++ y::xp= &xinst; ++ ++ y yy; ++ foo(&yy); ++ ++ return NULL; ++} ++ ++int ++main(int argc, char *argv[]) ++{ ++ pthread_t t[2]; ++ ++ pthread_create (&t[0], NULL, bar, NULL); ++ pthread_create (&t[1], NULL, bar, NULL); ++ ++ pthread_join (t[0], NULL); ++ pthread_join (t[1], NULL); ++ ++ return 0; ++} +Index: gdb-7.5.91.20130407/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +=================================================================== +--- /dev/null ++++ gdb-7.5.91.20130407/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +@@ -0,0 +1,75 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 tls-rhbz947564 ++set srcfile ${testfile}.cc ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if [istarget "*-*-linux"] then { ++ set target_cflags "-D_MIT_POSIX_THREADS" ++} else { ++ set target_cflags "" ++} ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++gdb_load ${binfile} ++ ++if { ![runto_main] } { ++ fail "Can't run to function main" ++ return 0 ++} ++ ++gdb_breakpoint "foo" ++gdb_continue_to_breakpoint "foo" ".* foo_marker .*" ++ ++proc get_xp_val {try} { ++ global expect_out ++ global gdb_prompt ++ global hex ++ ++ set xp_val "" ++ gdb_test_multiple "print *yp" "print yp value" { ++ -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } { ++ pass "print $try value of *yp" ++ set xp_val $expect_out(1,string) ++ } ++ -re "$gdb_prompt $" { ++ fail "print $try value of *yp" ++ } ++ timeout { ++ fail "print $try value of *yp (timeout)" ++ } ++ } ++ return $xp_val ++} ++ ++set first_run [get_xp_val "first"] ++ ++gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*" ++ ++set second_run [get_xp_val "second"] ++ ++if { $first_run != $second_run } { ++ pass "different values for TLS variable" ++} else { ++ fail "different values for TLS variable" ++} diff --git a/SOURCES/gdb-rhel5-compat.patch b/SOURCES/gdb-rhel5-compat.patch new file mode 100644 index 0000000..2b947d3 --- /dev/null +++ b/SOURCES/gdb-rhel5-compat.patch @@ -0,0 +1,29 @@ +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/SOURCES/gdb-rhel5-gcc44.patch b/SOURCES/gdb-rhel5-gcc44.patch new file mode 100644 index 0000000..172d067 --- /dev/null +++ b/SOURCES/gdb-rhel5-gcc44.patch @@ -0,0 +1,431 @@ +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.5.50.20130118/gdb/testsuite/gdb.base/vla.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/vla.exp 2013-01-18 23:43:04.455756362 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/vla.exp 2013-01-18 23:43:08.082761164 +0100 +@@ -16,7 +16,25 @@ + set testfile vla + set srcfile ${testfile}.c + set binfile ${objdir}/${subdir}/${testfile} +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++# Temporarily provide compiler=gcc44 saving the original value around. ++ ++set board [target_info name] ++if [board_info $board exists compiler] { ++ set old_compiler [board_info $board compiler] ++ unset_board_info compiler ++} elseif [info exists old_compiler] { ++ unset old_compiler ++} ++set_board_info compiler gcc44 ++ ++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug quiet}] ++ ++unset_board_info compiler ++if [info exists old_compiler] { ++ set_board_info compiler $old_compiler ++} ++ ++if { $err != "" } { + untested "Couldn't compile test program" + return -1 + } +Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.base/break-interp.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/break-interp.exp 2013-01-18 23:43:04.456756365 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/break-interp.exp 2013-01-18 23:43:08.082761164 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/common-block.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/common-block.exp 2013-01-18 23:43:08.082761164 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/common-block.exp 2013-01-18 23:44:23.047856182 +0100 +@@ -22,8 +22,25 @@ if {[skip_fortran_tests]} { + + standard_testfile .f90 + +-if {[prepare_for_testing ${testfile}.exp ${testfile} \ +- $srcfile {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 [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug f90 quiet}] ++ ++unset_board_info f90compiler ++if [info exists old_f90compiler] { ++ set_board_info f90compiler $old_f90compiler ++} ++ ++if {$err} { + return -1 + } + +Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/dwarf-stride.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2013-01-18 23:43:04.456756365 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/dynamic.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2013-01-18 23:43:04.457756367 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/dynamic.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -25,7 +25,25 @@ set testfile "dynamic" + set srcfile ${testfile}.f90 + set binfile ${objdir}/${subdir}/${testfile} + +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug 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.5.50.20130118/gdb/testsuite/gdb.fortran/library-module.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/library-module.exp 2013-01-18 23:43:04.457756367 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/library-module.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/module.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/module.exp 2013-01-18 23:43:04.457756367 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/module.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/string.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/string.exp 2013-01-18 23:43:04.457756367 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/string.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -23,7 +23,25 @@ set testfile "string" + set srcfile ${testfile}.f90 + set binfile ${objdir}/${subdir}/${testfile} + +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug 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.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2013-01-18 23:43:04.458756369 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp 2013-01-18 23:43:08.083761148 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/derived-type.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2013-01-18 23:43:04.458756369 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/derived-type.exp 2013-01-18 23:43:08.084761135 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.fortran/subarray.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.fortran/subarray.exp 2013-01-18 23:43:04.458756369 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/subarray.exp 2013-01-18 23:43:08.084761135 +0100 +@@ -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.5.50.20130118/gdb/testsuite/gdb.threads/tls-sepdebug.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2013-01-18 23:43:04.459756371 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2013-01-18 23:43:08.084761135 +0100 +@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi + + # FIXME: gcc dependency (-Wl,-soname). + +-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } { ++# Temporarily provide compiler=gcc44 saving the original value around. ++ ++set board [target_info name] ++if [board_info $board exists compiler] { ++ set old_compiler [board_info $board compiler] ++ unset_board_info compiler ++} elseif [info exists old_compiler] { ++ unset old_compiler ++} ++set_board_info compiler gcc44 ++ ++set err [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] ++ ++unset_board_info compiler ++if [info exists old_compiler] { ++ set_board_info compiler $old_compiler ++} ++ ++if { $err != "" } { + untested "Couldn't compile test library" + return -1 + } +Index: gdb-7.5.50.20130118/gdb/testsuite/lib/prelink-support.exp +=================================================================== +--- gdb-7.5.50.20130118.orig/gdb/testsuite/lib/prelink-support.exp 2013-01-18 23:43:04.459756371 +0100 ++++ gdb-7.5.50.20130118/gdb/testsuite/lib/prelink-support.exp 2013-01-18 23:43:08.084761135 +0100 +@@ -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/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch new file mode 100644 index 0000000..27e49dd --- /dev/null +++ b/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -0,0 +1,723 @@ +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/SOURCES/gdb-runtest-pie-override.patch b/SOURCES/gdb-runtest-pie-override.patch new file mode 100644 index 0000000..ab45237 --- /dev/null +++ b/SOURCES/gdb-runtest-pie-override.patch @@ -0,0 +1,40 @@ +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/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch b/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch new file mode 100644 index 0000000..e6e53bb --- /dev/null +++ b/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch @@ -0,0 +1,150 @@ +--- /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/SOURCES/gdb-stale-frame_info.patch b/SOURCES/gdb-stale-frame_info.patch new file mode 100644 index 0000000..59f8ea1 --- /dev/null +++ b/SOURCES/gdb-stale-frame_info.patch @@ -0,0 +1,174 @@ +http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html +Subject: [downstream patch FYI] workaround stale frame_info * (PR 13866) + +Hi, + +I did not look at which commit caused this regression but apparently it was +introduced at least with multi-inferiors. + +I understand this fix is not right fix of the crash; but in most GDB cases one +does not use multi-inferior so why to regress single-inferior by it. +Some more simple solutions still fix the single-inferior mode but they +regressed the multi-inferior mode + gdb.threads/no-unwaited-for-left.exp + gdb.multi/base.exp +so I had to put there that sorting magic. + +With proper C++ sanity check of stale live frame_info references the testcase +would be simple without the "frame_garbage_collection" reproducer below. +It is also reproducible just with valgrind but regularly running the whole +testsuite under valgrind I did not find feasible. + +No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu. + + +Thanks, +Jan + + +gdb/ +2012-04-04 Jan Kratochvil + + 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/SOURCES/gdb-test-bt-cfi-without-die.patch b/SOURCES/gdb-test-bt-cfi-without-die.patch new file mode 100644 index 0000000..5f1f967 --- /dev/null +++ b/SOURCES/gdb-test-bt-cfi-without-die.patch @@ -0,0 +1,220 @@ +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/SOURCES/gdb-test-dw2-aranges.patch b/SOURCES/gdb-test-dw2-aranges.patch new file mode 100644 index 0000000..5ddcf9d --- /dev/null +++ b/SOURCES/gdb-test-dw2-aranges.patch @@ -0,0 +1,214 @@ +[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/SOURCES/gdb-test-expr-cumulative-archer.patch b/SOURCES/gdb-test-expr-cumulative-archer.patch new file mode 100644 index 0000000..232a527 --- /dev/null +++ b/SOURCES/gdb-test-expr-cumulative-archer.patch @@ -0,0 +1,207 @@ +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/SOURCES/gdb-test-pid0-core.patch b/SOURCES/gdb-test-pid0-core.patch new file mode 100644 index 0000000..1bc221b --- /dev/null +++ b/SOURCES/gdb-test-pid0-core.patch @@ -0,0 +1,80 @@ +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/SOURCES/gdb-upstream-framefilters-1of2.patch b/SOURCES/gdb-upstream-framefilters-1of2.patch new file mode 100644 index 0000000..80a0d43 --- /dev/null +++ b/SOURCES/gdb-upstream-framefilters-1of2.patch @@ -0,0 +1,5551 @@ +http://sourceware.org/ml/gdb-cvs/2013-05/msg00084.html + +### src/gdb/ChangeLog 2013/05/09 18:03:27 1.15539 +### src/gdb/ChangeLog 2013/05/10 10:26:01 1.15540 +## -1,3 +1,52 @@ ++2013-05-10 Phil Muldoon ++ ++ * stack.c (backtrace_command_1): Add "no-filters", and Python frame ++ filter logic. ++ (backtrace_command): Add "no-filters" option parsing. ++ (_initialize_stack): Alter help to reflect "no-filters" option. ++ * Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o ++ (SUBDIR_PYTHON_SRCS): Add py-framefilter.c ++ (py-frame.o): Add target ++ * data-directory/Makefile.in (PYTHON_DIR): Add Python frame ++ filter files. ++ * python/python.h: Add new frame filter constants, and flag enum. ++ (apply_frame_filter): Add definition. ++ * python/python.c (apply_frame_filter): New non-Python ++ enabled function. ++ * python/py-utils.c (py_xdecref): New function. ++ (make_cleanup_py_xdecref): Ditto. ++ * python/py-objfile.c: Declare frame_filters dictionary. ++ (objfpy_dealloc): Add frame_filters dealloc. ++ (objfpy_new): Initialize frame_filters attribute. ++ (objfile_to_objfile_object): Ditto. ++ (objfpy_get_frame_filters): New function. ++ (objfpy_set_frame_filters): New function. ++ * python/py-progspace.c: Declare frame_filters dictionary. ++ (pspy_dealloc): Add frame_filters dealloc. ++ (pspy_new): Initialize frame_filters attribute. ++ (pspacee_to_pspace_object): Ditto. ++ (pspy_get_frame_filters): New function. ++ (pspy_set_frame_filters): New function. ++ * python/py-framefilter.c: New file. ++ * python/lib/gdb/command/frame_filters.py: New file. ++ * python/lib/gdb/frames.py: New file. ++ * python/lib/gdb/__init__.py: Initialize global frame_filters ++ dictionary ++ * python/lib/gdb/FrameDecorator.py: New file. ++ * python/lib/gdb/FrameIterator.py: New file. ++ * mi/mi-cmds.c (mi_cmds): Add frame filters command. ++ * mi/mi-cmds.h: Declare. ++ * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add ++ --no-frame-filter logic, and Python frame filter logic. ++ (stack_enable_frame_filters): New function. ++ (parse_no_frame_option): Ditto. ++ (mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame ++ filter logic. ++ (mi_cmd_stack_list_locals): Ditto. ++ (mi_cmd_stack_list_args): Ditto. ++ (mi_cmd_stack_list_variables): Ditto. ++ * NEWS: Add frame filter note. ++ + 2013-05-09 Doug Evans + + * symfile.c (syms_from_objfile_1): Delete args offsets, num_offsets. +Index: gdb-7.6/gdb/Makefile.in +=================================================================== +--- gdb-7.6.orig/gdb/Makefile.in 2013-06-10 14:31:02.704084663 +0200 ++++ gdb-7.6/gdb/Makefile.in 2013-06-10 14:31:08.351082443 +0200 +@@ -284,6 +284,7 @@ SUBDIR_PYTHON_OBS = \ + py-exitedevent.o \ + py-finishbreakpoint.o \ + py-frame.o \ ++ py-framefilter.o \ + py-function.o \ + py-gdb-readline.o \ + py-inferior.o \ +@@ -318,6 +319,7 @@ SUBDIR_PYTHON_SRCS = \ + python/py-exitedevent.c \ + python/py-finishbreakpoint.c \ + python/py-frame.c \ ++ python/py-framefilter.c \ + python/py-function.c \ + python/py-gdb-readline.c \ + python/py-inferior.c \ +@@ -2174,6 +2176,10 @@ py-frame.o: $(srcdir)/python/py-frame.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-frame.c + $(POSTCOMPILE) + ++py-framefilter.o: $(srcdir)/python/py-framefilter.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-framefilter.c ++ $(POSTCOMPILE) ++ + py-function.o: $(srcdir)/python/py-function.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c + $(POSTCOMPILE) +Index: gdb-7.6/gdb/NEWS +=================================================================== +--- gdb-7.6.orig/gdb/NEWS 2013-06-10 14:31:08.353082442 +0200 ++++ gdb-7.6/gdb/NEWS 2013-06-10 14:31:21.230077319 +0200 +@@ -4,6 +4,10 @@ + * Newly installed $prefix/bin/gcore acts as a shell interface for the + GDB command gcore. + ++* Python scripting ++ ++ ** Frame filters and frame decorators have been added. ++ + * New remote packets + + qXfer:libraries-svr4:read's annex +Index: gdb-7.6/gdb/stack.c +=================================================================== +--- gdb-7.6.orig/gdb/stack.c 2013-06-10 14:31:02.709084661 +0200 ++++ gdb-7.6/gdb/stack.c 2013-06-10 14:31:08.354082441 +0200 +@@ -54,6 +54,7 @@ + + #include "psymtab.h" + #include "symfile.h" ++#include "python/python.h" + + void (*deprecated_selected_frame_level_changed_hook) (int); + +@@ -1655,13 +1656,15 @@ frame_info (char *addr_exp, int from_tty + frames. */ + + static void +-backtrace_command_1 (char *count_exp, int show_locals, int from_tty) ++backtrace_command_1 (char *count_exp, int show_locals, int no_filters, ++ int from_tty) + { + struct frame_info *fi; + int count; + int i; + struct frame_info *trailing; +- int trailing_level; ++ int trailing_level, py_start = 0, py_end = 0; ++ enum py_bt_status result = PY_BT_ERROR; + + if (!target_has_stack) + error (_("No stack.")); +@@ -1680,6 +1683,7 @@ backtrace_command_1 (char *count_exp, in + { + struct frame_info *current; + ++ py_start = count; + count = -count; + + current = trailing; +@@ -1701,9 +1705,17 @@ backtrace_command_1 (char *count_exp, in + + count = -1; + } ++ else ++ { ++ py_start = 0; ++ py_end = count; ++ } + } + else +- count = -1; ++ { ++ py_end = -1; ++ count = -1; ++ } + + if (info_verbose) + { +@@ -1723,16 +1735,40 @@ backtrace_command_1 (char *count_exp, in + } + } + +- for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi)) ++ if (! no_filters) + { +- QUIT; ++ int flags = PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS; ++ enum py_frame_args arg_type; + +- /* Don't use print_stack_frame; if an error() occurs it probably +- means further attempts to backtrace would fail (on the other +- hand, perhaps the code does or could be fixed to make sure +- the frame->prev field gets set to NULL in that case). */ +- print_frame_info (fi, 1, LOCATION, 1); + if (show_locals) ++ flags |= PRINT_LOCALS; ++ ++ if (!strcmp (print_frame_arguments, "scalars")) ++ arg_type = CLI_SCALAR_VALUES; ++ else if (!strcmp (print_frame_arguments, "all")) ++ arg_type = CLI_ALL_VALUES; ++ else ++ arg_type = NO_VALUES; ++ ++ result = apply_frame_filter (get_current_frame (), flags, arg_type, ++ current_uiout, py_start, py_end); ++ ++ } ++ /* Run the inbuilt backtrace if there are no filters registered, or ++ "no-filters" has been specified from the command. */ ++ if (no_filters || result == PY_BT_NO_FILTERS) ++ { ++ for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi)) ++ { ++ QUIT; ++ ++ /* Don't use print_stack_frame; if an error() occurs it probably ++ means further attempts to backtrace would fail (on the other ++ hand, perhaps the code does or could be fixed to make sure ++ the frame->prev field gets set to NULL in that case). */ ++ ++ print_frame_info (fi, 1, LOCATION, 1); ++ if (show_locals) + { + struct frame_id frame_id = get_frame_id (fi); + +@@ -1748,24 +1784,25 @@ backtrace_command_1 (char *count_exp, in + } + } + +- /* Save the last frame to check for error conditions. */ +- trailing = fi; +- } ++ /* Save the last frame to check for error conditions. */ ++ trailing = fi; ++ } + +- /* If we've stopped before the end, mention that. */ +- if (fi && from_tty) +- printf_filtered (_("(More stack frames follow...)\n")); ++ /* If we've stopped before the end, mention that. */ ++ if (fi && from_tty) ++ printf_filtered (_("(More stack frames follow...)\n")); + +- /* If we've run out of frames, and the reason appears to be an error +- condition, print it. */ +- if (fi == NULL && trailing != NULL) +- { +- enum unwind_stop_reason reason; ++ /* If we've run out of frames, and the reason appears to be an error ++ condition, print it. */ ++ if (fi == NULL && trailing != NULL) ++ { ++ enum unwind_stop_reason reason; + +- reason = get_frame_unwind_stop_reason (trailing); +- if (reason >= UNWIND_FIRST_ERROR) +- printf_filtered (_("Backtrace stopped: %s\n"), +- frame_stop_reason_string (reason)); ++ reason = get_frame_unwind_stop_reason (trailing); ++ if (reason >= UNWIND_FIRST_ERROR) ++ printf_filtered (_("Backtrace stopped: %s\n"), ++ frame_stop_reason_string (reason)); ++ } + } + } + +@@ -1773,7 +1810,8 @@ static void + backtrace_command (char *arg, int from_tty) + { + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); +- int fulltrace_arg = -1, arglen = 0, argc = 0; ++ int fulltrace_arg = -1, arglen = 0, argc = 0, no_filters = -1; ++ int user_arg = 0; + + if (arg) + { +@@ -1790,25 +1828,31 @@ backtrace_command (char *arg, int from_t + for (j = 0; j < strlen (argv[i]); j++) + argv[i][j] = tolower (argv[i][j]); + +- if (fulltrace_arg < 0 && subset_compare (argv[i], "full")) +- fulltrace_arg = argc; ++ if (no_filters < 0 && subset_compare (argv[i], "no-filters")) ++ no_filters = argc; + else + { +- arglen += strlen (argv[i]); +- argc++; ++ if (fulltrace_arg < 0 && subset_compare (argv[i], "full")) ++ fulltrace_arg = argc; ++ else ++ { ++ user_arg++; ++ arglen += strlen (argv[i]); ++ } + } ++ argc++; + } +- arglen += argc; +- if (fulltrace_arg >= 0) ++ arglen += user_arg; ++ if (fulltrace_arg >= 0 || no_filters >= 0) + { + if (arglen > 0) + { + arg = xmalloc (arglen + 1); + make_cleanup (xfree, arg); + arg[0] = 0; +- for (i = 0; i < (argc + 1); i++) ++ for (i = 0; i < argc; i++) + { +- if (i != fulltrace_arg) ++ if (i != fulltrace_arg && i != no_filters) + { + strcat (arg, argv[i]); + strcat (arg, " "); +@@ -1820,7 +1864,8 @@ backtrace_command (char *arg, int from_t + } + } + +- backtrace_command_1 (arg, fulltrace_arg >= 0 /* show_locals */, from_tty); ++ backtrace_command_1 (arg, fulltrace_arg >= 0 /* show_locals */, ++ no_filters >= 0 /* no frame-filters */, from_tty); + + do_cleanups (old_chain); + } +@@ -1828,7 +1873,7 @@ backtrace_command (char *arg, int from_t + static void + backtrace_full_command (char *arg, int from_tty) + { +- backtrace_command_1 (arg, 1 /* show_locals */, from_tty); ++ backtrace_command_1 (arg, 1 /* show_locals */, 0, from_tty); + } + + +@@ -2562,7 +2607,9 @@ It can be a stack frame number or the ad + add_com ("backtrace", class_stack, backtrace_command, _("\ + Print backtrace of all stack frames, or innermost COUNT frames.\n\ + With a negative argument, print outermost -COUNT frames.\nUse of the \ +-'full' qualifier also prints the values of the local variables.\n")); ++'full' qualifier also prints the values of the local variables.\n\ ++Use of the 'no-filters' qualifier prohibits frame filters from executing\n\ ++on this backtrace.\n")); + add_com_alias ("bt", "backtrace", class_stack, 0); + if (xdb_commands) + { +Index: gdb-7.6/gdb/data-directory/Makefile.in +=================================================================== +--- gdb-7.6.orig/gdb/data-directory/Makefile.in 2013-06-10 14:31:02.710084660 +0200 ++++ gdb-7.6/gdb/data-directory/Makefile.in 2013-06-10 14:31:08.355082441 +0200 +@@ -53,7 +53,11 @@ PYTHON_DIR = python + PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) + PYTHON_FILES = \ + gdb/__init__.py \ ++ gdb/frames.py \ ++ gdb/FrameIterator.py \ ++ gdb/FrameDecorator.py \ + gdb/command/__init__.py \ ++ gdb/command/frame_filters.py \ + gdb/command/ignore_errors.py \ + gdb/command/pahole.py \ + gdb/command/type_printers.py \ +Index: gdb-7.6/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.6.orig/gdb/doc/gdb.texinfo 2013-06-10 14:31:02.727084654 +0200 ++++ gdb-7.6/gdb/doc/gdb.texinfo 2013-06-10 14:31:08.364082438 +0200 +@@ -6459,6 +6459,7 @@ currently executing frame and describes + @menu + * Frames:: Stack frames + * Backtrace:: Backtraces ++* Frame Filter Management:: Managing frame filters + * Selection:: Selecting a frame + * Frame Info:: Information on a frame + +@@ -6546,6 +6547,7 @@ line per frame, for many frames, startin + frame (frame zero), followed by its caller (frame one), and on up the + stack. + ++@anchor{backtrace-command} + @table @code + @kindex backtrace + @kindex bt @r{(@code{backtrace})} +@@ -6571,6 +6573,19 @@ Similar, but print only the outermost @v + @itemx bt full -@var{n} + Print the values of the local variables also. @var{n} specifies the + number of frames to print, as described above. ++ ++@item backtrace no-filters ++@itemx bt no-filters ++@itemx bt no-filters @var{n} ++@itemx bt no-filters -@var{n} ++@itemx bt no-filters full ++@itemx bt no-filters full @var{n} ++@itemx bt no-filters full -@var{n} ++Do not run Python frame filters on this backtrace. @xref{Frame ++Filter API}, for more information. Additionally use @ref{disable ++frame-filter all} to turn off all frame filters. This is only ++relevant when @value{GDBN} has been configured with @code{Python} ++support. + @end table + + @kindex where +@@ -6720,6 +6735,149 @@ Display an absolute filename. + Show the current way to display filenames. + @end table + ++@node Frame Filter Management ++@section Management of Frame Filters. ++@cindex managing frame filters ++ ++Frame filters are Python based utilities to manage and decorate the ++output of frames. @xref{Frame Filter API}, for further information. ++ ++Managing frame filters is performed by several commands available ++within @value{GDBN}, detailed here. ++ ++@table @code ++@kindex info frame-filter ++@item info frame-filter ++Print a list of installed frame filters from all dictionaries, showing ++their name, priority and enabled status. ++ ++@kindex disable frame-filter ++@anchor{disable frame-filter all} ++@item disable frame-filter @var{filter-dictionary} @var{filter-name} ++Disable a frame filter in the dictionary matching ++@var{filter-dictionary}, or @code{all}, and @var{filter-name}. ++@var{filter-dictionary} may be @code{all}, @code{global}, ++@code{progspace} or the name of the object file where the frame filter ++dictionary resides. When @code{all} is specified, all frame filters ++across all dictionaries are disabled. @var{filter-name} is the name ++of the frame filter and is used when @code{all} is not the option for ++@var{filter-dictionary}. A disabled frame-filter is not deleted, it ++may be enabled again later. ++ ++@kindex enable frame-filter ++@item enable frame-filter @var{filter-dictionary} @var{filter-name} ++Enable a frame filter in the dictionary matching ++@var{filter-dictionary}, or @code{all}, and @var{filter-name}. ++@var{filter-dictionary} may be @code{all}, @code{global}, ++@code{progspace} or the name of the object file where the frame filter ++dictionary resides. When @code{all} is specified, all frame filters across ++all dictionaries are enabled. @var{filter-name} is the name of the frame ++filter and is used when @code{all} is not the option for ++@var{filter-dictionary}. ++ ++Example: ++ ++@smallexample ++(gdb) info frame-filter ++ ++global frame-filters: ++ Priority Enabled Name ++ 1000 No PrimaryFunctionFilter ++ 100 Yes Reverse ++ ++progspace /build/test frame-filters: ++ Priority Enabled Name ++ 100 Yes ProgspaceFilter ++ ++objfile /build/test frame-filters: ++ Priority Enabled Name ++ 999 Yes BuildProgra Filter ++ ++(gdb) disable frame-filter /build/test BuildProgramFilter ++(gdb) info frame-filter ++ ++global frame-filters: ++ Priority Enabled Name ++ 1000 No PrimaryFunctionFilter ++ 100 Yes Reverse ++ ++progspace /build/test frame-filters: ++ Priority Enabled Name ++ 100 Yes ProgspaceFilter ++ ++objfile /build/test frame-filters: ++ Priority Enabled Name ++ 999 No BuildProgramFilter ++ ++(gdb) enable frame-filter global PrimaryFunctionFilter ++(gdb) info frame-filter ++ ++global frame-filters: ++ Priority Enabled Name ++ 1000 Yes PrimaryFunctionFilter ++ 100 Yes Reverse ++ ++progspace /build/test frame-filters: ++ Priority Enabled Name ++ 100 Yes ProgspaceFilter ++ ++objfile /build/test frame-filters: ++ Priority Enabled Name ++ 999 No BuildProgramFilter ++@end smallexample ++ ++@kindex set frame-filter priority ++@item set frame-filter priority @var{filter-dictionary} @var{filter-name} @var{priority} ++Set the @var{priority} of a frame filter in the dictionary matching ++@var{filter-dictionary}, and the frame filter name matching ++@var{filter-name}. @var{filter-dictionary} may be @code{global}, ++@code{progspace} or the name of the object file where the frame filter ++dictionary resides. @var{priority} is an integer. ++ ++@kindex show frame-filter priority ++@item show frame-filter priority @var{filter-dictionary} @var{filter-name} ++Show the @var{priority} of a frame filter in the dictionary matching ++@var{filter-dictionary}, and the frame filter name matching ++@var{filter-name}. @var{filter-dictionary} may be @code{global}, ++@code{progspace} or the name of the object file where the frame filter ++dictionary resides. ++ ++Example: ++ ++@smallexample ++(gdb) info frame-filter ++ ++global frame-filters: ++ Priority Enabled Name ++ 1000 Yes PrimaryFunctionFilter ++ 100 Yes Reverse ++ ++progspace /build/test frame-filters: ++ Priority Enabled Name ++ 100 Yes ProgspaceFilter ++ ++objfile /build/test frame-filters: ++ Priority Enabled Name ++ 999 No BuildProgramFilter ++ ++(gdb) set frame-filter priority global Reverse 50 ++(gdb) info frame-filter ++ ++global frame-filters: ++ Priority Enabled Name ++ 1000 Yes PrimaryFunctionFilter ++ 50 Yes Reverse ++ ++progspace /build/test frame-filters: ++ Priority Enabled Name ++ 100 Yes ProgspaceFilter ++ ++objfile /build/test frame-filters: ++ Priority Enabled Name ++ 999 No BuildProgramFilter ++@end smallexample ++@end table ++ + @node Selection + @section Selecting a Frame + +@@ -23100,6 +23258,9 @@ situation, a Python @code{KeyboardInterr + * Selecting Pretty-Printers:: How GDB chooses a pretty-printer. + * Writing a Pretty-Printer:: Writing a Pretty-Printer. + * Type Printing API:: Pretty-printing types. ++* Frame Filter API:: Filtering Frames. ++* Frame Decorator API:: Decorating Frames. ++* Writing a Frame Filter:: Writing a Frame Filter. + * Inferiors In Python:: Python representation of inferiors (processes) + * Events In Python:: Listening for events from @value{GDBN}. + * Threads In Python:: Accessing inferior threads from Python. +@@ -24450,6 +24611,636 @@ done then type printers would have to ma + order to avoid holding information that could become stale as the + inferior changed. + ++@node Frame Filter API ++@subsubsection Filtering Frames. ++@cindex frame filters api ++ ++Frame filters are Python objects that manipulate the visibility of a ++frame or frames when a backtrace (@pxref{Backtrace}) is printed by ++@value{GDBN}. ++ ++Only commands that print a backtrace, or, in the case of @sc{gdb/mi} ++commands (@pxref{GDB/MI}), those that return a collection of frames ++are affected. The commands that work with frame filters are: ++ ++@code{backtrace} (@pxref{backtrace-command,, The backtrace command}), ++@code{-stack-list-frames} ++(@pxref{-stack-list-frames,, The -stack-list-frames command}), ++@code{-stack-list-variables} (@pxref{-stack-list-variables,, The ++-stack-list-variables command}), @code{-stack-list-arguments} ++@pxref{-stack-list-arguments,, The -stack-list-arguments command}) and ++@code{-stack-list-locals} (@pxref{-stack-list-locals,, The ++-stack-list-locals command}). ++ ++A frame filter works by taking an iterator as an argument, applying ++actions to the contents of that iterator, and returning another ++iterator (or, possibly, the same iterator it was provided in the case ++where the filter does not perform any operations). Typically, frame ++filters utilize tools such as the Python's @code{itertools} module to ++work with and create new iterators from the source iterator. ++Regardless of how a filter chooses to apply actions, it must not alter ++the underlying @value{GDBN} frame or frames, or attempt to alter the ++call-stack within @value{GDBN}. This preserves data integrity within ++@value{GDBN}. Frame filters are executed on a priority basis and care ++should be taken that some frame filters may have been executed before, ++and that some frame filters will be executed after. ++ ++An important consideration when designing frame filters, and well ++worth reflecting upon, is that frame filters should avoid unwinding ++the call stack if possible. Some stacks can run very deep, into the ++tens of thousands in some cases. To search every frame when a frame ++filter executes may be too expensive at that step. The frame filter ++cannot know how many frames it has to iterate over, and it may have to ++iterate through them all. This ends up duplicating effort as ++@value{GDBN} performs this iteration when it prints the frames. If ++the filter can defer unwinding frames until frame decorators are ++executed, after the last filter has executed, it should. @xref{Frame ++Decorator API}, for more information on decorators. Also, there are ++examples for both frame decorators and filters in later chapters. ++@xref{Writing a Frame Filter}, for more information. ++ ++The Python dictionary @code{gdb.frame_filters} contains key/object ++pairings that comprise a frame filter. Frame filters in this ++dictionary are called @code{global} frame filters, and they are ++available when debugging all inferiors. These frame filters must ++register with the dictionary directly. In addition to the ++@code{global} dictionary, there are other dictionaries that are loaded ++with different inferiors via auto-loading (@pxref{Python ++Auto-loading}). The two other areas where frame filter dictionaries ++can be found are: @code{gdb.Progspace} which contains a ++@code{frame_filters} dictionary attribute, and each @code{gdb.Objfile} ++object which also contains a @code{frame_filters} dictionary ++attribute. ++ ++When a command is executed from @value{GDBN} that is compatible with ++frame filters, @value{GDBN} combines the @code{global}, ++@code{gdb.Progspace} and all @code{gdb.Objfile} dictionaries currently ++loaded. All of the @code{gdb.Objfile} dictionaries are combined, as ++several frames, and thus several object files, might be in use. ++@value{GDBN} then prunes any frame filter whose @code{enabled} ++attribute is @code{False}. This pruned list is then sorted according ++to the @code{priority} attribute in each filter. ++ ++Once the dictionaries are combined, pruned and sorted, @value{GDBN} ++creates an iterator which wraps each frame in the call stack in a ++@code{FrameDecorator} object, and calls each filter in order. The ++output from the previous filter will always be the input to the next ++filter, and so on. ++ ++Frame filters have a mandatory interface which each frame filter must ++implement, defined here: ++ ++@defun FrameFilter.filter (iterator) ++@value{GDBN} will call this method on a frame filter when it has ++reached the order in the priority list for that filter. ++ ++For example, if there are four frame filters: ++ ++@smallexample ++Name Priority ++ ++Filter1 5 ++Filter2 10 ++Filter3 100 ++Filter4 1 ++@end smallexample ++ ++The order that the frame filters will be called is: ++ ++@smallexample ++Filter3 -> Filter2 -> Filter1 -> Filter4 ++@end smallexample ++ ++Note that the output from @code{Filter3} is passed to the input of ++@code{Filter2}, and so on. ++ ++This @code{filter} method is passed a Python iterator. This iterator ++contains a sequence of frame decorators that wrap each ++@code{gdb.Frame}, or a frame decorator that wraps another frame ++decorator. The first filter that is executed in the sequence of frame ++filters will receive an iterator entirely comprised of default ++@code{FrameDecorator} objects. However, after each frame filter is ++executed, the previous frame filter may have wrapped some or all of ++the frame decorators with their own frame decorator. As frame ++decorators must also conform to a mandatory interface, these ++decorators can be assumed to act in a uniform manner (@pxref{Frame ++Decorator API}). ++ ++This method must return an object conforming to the Python iterator ++protocol. Each item in the iterator must be an object conforming to ++the frame decorator interface. If a frame filter does not wish to ++perform any operations on this iterator, it should return that ++iterator untouched. ++ ++This method is not optional. If it does not exist, @value{GDBN} will ++raise and print an error. ++@end defun ++ ++@defvar FrameFilter.name ++The @code{name} attribute must be Python string which contains the ++name of the filter displayed by @value{GDBN} (@pxref{Frame Filter ++Management}). This attribute may contain any combination of letters ++or numbers. Care should be taken to ensure that it is unique. This ++attribute is mandatory. ++@end defvar ++ ++@defvar FrameFilter.enabled ++The @code{enabled} attribute must be Python boolean. This attribute ++indicates to @value{GDBN} whether the frame filter is enabled, and ++should be considered when frame filters are executed. If ++@code{enabled} is @code{True}, then the frame filter will be executed ++when any of the backtrace commands detailed earlier in this chapter ++are executed. If @code{enabled} is @code{False}, then the frame ++filter will not be executed. This attribute is mandatory. ++@end defvar ++ ++@defvar FrameFilter.priority ++The @code{priority} attribute must be Python integer. This attribute ++controls the order of execution in relation to other frame filters. ++There are no imposed limits on the range of @code{priority} other than ++it must be a valid integer. The higher the @code{priority} attribute, ++the sooner the frame filter will be executed in relation to other ++frame filters. Although @code{priority} can be negative, it is ++recommended practice to assume zero is the lowest priority that a ++frame filter can be assigned. Frame filters that have the same ++priority are executed in unsorted order in that priority slot. This ++attribute is mandatory. ++@end defvar ++ ++@node Frame Decorator API ++@subsubsection Decorating Frames. ++@cindex frame decorator api ++ ++Frame decorators are sister objects to frame filters (@pxref{Frame ++Filter API}). Frame decorators are applied by a frame filter and can ++only be used in conjunction with frame filters. ++ ++The purpose of a frame decorator is to customize the printed content ++of each @code{gdb.Frame} in commands where frame filters are executed. ++This concept is called decorating a frame. Frame decorators decorate ++a @code{gdb.Frame} with Python code contained within each API call. ++This separates the actual data contained in a @code{gdb.Frame} from ++the decorated data produced by a frame decorator. This abstraction is ++necessary to maintain integrity of the data contained in each ++@code{gdb.Frame}. ++ ++Frame decorators have a mandatory interface, defined below. ++ ++@value{GDBN} already contains a frame decorator called ++@code{FrameDecorator}. This contains substantial amounts of ++boilerplate code to decorate the content of a @code{gdb.Frame}. It is ++recommended that other frame decorators inherit and extend this ++object, and only to override the methods needed. ++ ++@defun FrameDecorator.elided (self) ++ ++The @code{elided} method groups frames together in a hierarchical ++system. An example would be an interpreter, where multiple low-level ++frames make up a single call in the interpreted language. In this ++example, the frame filter would elide the low-level frames and present ++a single high-level frame, representing the call in the interpreted ++language, to the user. ++ ++The @code{elided} function must return an iterable and this iterable ++must contain the frames that are being elided wrapped in a suitable ++frame decorator. If no frames are being elided this function may ++return an empty iterable, or @code{None}. Elided frames are indented ++from normal frames in a @code{CLI} backtrace, or in the case of ++@code{GDB/MI}, are placed in the @code{children} field of the eliding ++frame. ++ ++It is the frame filter's task to also filter out the elided frames from ++the source iterator. This will avoid printing the frame twice. ++@end defun ++ ++@defun FrameDecorator.function (self) ++ ++This method returns the name of the function in the frame that is to ++be printed. ++ ++This method must return a Python string describing the function, or ++@code{None}. ++ ++If this function returns @code{None}, @value{GDBN} will not print any ++data for this field. ++@end defun ++ ++@defun FrameDecorator.address (self) ++ ++This method returns the address of the frame that is to be printed. ++ ++This method must return a Python numeric integer type of sufficient ++size to describe the address of the frame, or @code{None}. ++ ++If this function returns a @code{None}, @value{GDBN} will not print ++any data for this field. ++@end defun ++ ++@defun FrameDecorator.filename (self) ++ ++This method returns the filename and path associated with this frame. ++ ++This method must return a Python string containing the filename and ++the path to the object file backing the frame, or @code{None}. ++ ++If this function returns a @code{None}, @value{GDBN} will not print ++any data for this field. ++@end defun ++ ++@defun FrameDecorator.line (self): ++ ++This method returns the line number associated with the current ++position within the function addressed by this frame. ++ ++This method must return a Python integer type, or @code{None}. ++ ++If this function returns a @code{None}, @value{GDBN} will not print ++any data for this field. ++@end defun ++ ++@defun FrameDecorator.frame_args (self) ++@anchor{frame_args} ++ ++This method must return an iterable, or @code{None}. Returning an ++empty iterable, or @code{None} means frame arguments will not be ++printed for this frame. This iterable must contain objects that ++implement two methods, described here. ++ ++This object must implement a @code{argument} method which takes a ++single @code{self} parameter and must return a @code{gdb.Symbol} ++(@pxref{Symbols In Python}), or a Python string. The object must also ++implement a @code{value} method which takes a single @code{self} ++parameter and must return a @code{gdb.Value} (@pxref{Values From ++Inferior}), a Python value, or @code{None}. If the @code{value} ++method returns @code{None}, and the @code{argument} method returns a ++@code{gdb.Symbol}, @value{GDBN} will look-up and print the value of ++the @code{gdb.Symbol} automatically. ++ ++A brief example: ++ ++@smallexample ++class SymValueWrapper(): ++ ++ def __init__(self, symbol, value): ++ self.sym = symbol ++ self.val = value ++ ++ def value(self): ++ return self.val ++ ++ def symbol(self): ++ return self.sym ++ ++class SomeFrameDecorator() ++... ++... ++ def frame_args(self): ++ args = [] ++ try: ++ block = self.inferior_frame.block() ++ except: ++ return None ++ ++ # Iterate over all symbols in a block. Only add ++ # symbols that are arguments. ++ for sym in block: ++ if not sym.is_argument: ++ continue ++ args.append(SymValueWrapper(sym,None)) ++ ++ # Add example synthetic argument. ++ args.append(SymValueWrapper(``foo'', 42)) ++ ++ return args ++@end smallexample ++@end defun ++ ++@defun FrameDecorator.frame_locals (self) ++ ++This method must return an iterable or @code{None}. Returning an ++empty iterable, or @code{None} means frame local arguments will not be ++printed for this frame. ++ ++The object interface, the description of the various strategies for ++reading frame locals, and the example are largely similar to those ++described in the @code{frame_args} function, (@pxref{frame_args,,The ++frame filter frame_args function}). Below is a modified example: ++ ++@smallexample ++class SomeFrameDecorator() ++... ++... ++ def frame_locals(self): ++ vars = [] ++ try: ++ block = self.inferior_frame.block() ++ except: ++ return None ++ ++ # Iterate over all symbols in a block. Add all ++ # symbols, except arguments. ++ for sym in block: ++ if sym.is_argument: ++ continue ++ vars.append(SymValueWrapper(sym,None)) ++ ++ # Add an example of a synthetic local variable. ++ vars.append(SymValueWrapper(``bar'', 99)) ++ ++ return vars ++@end smallexample ++@end defun ++ ++@defun FrameDecorator.inferior_frame (self): ++ ++This method must return the underlying @code{gdb.Frame} that this ++frame decorator is decorating. @value{GDBN} requires the underlying ++frame for internal frame information to determine how to print certain ++values when printing a frame. ++@end defun ++ ++@node Writing a Frame Filter ++@subsubsection Writing a Frame Filter ++@cindex writing a frame filter ++ ++There are three basic elements that a frame filter must implement: it ++must correctly implement the documented interface (@pxref{Frame Filter ++API}), it must register itself with @value{GDBN}, and finally, it must ++decide if it is to work on the data provided by @value{GDBN}. In all ++cases, whether it works on the iterator or not, each frame filter must ++return an iterator. A bare-bones frame filter follows the pattern in ++the following example. ++ ++@smallexample ++import gdb ++ ++class FrameFilter(): ++ ++ def __init__(self): ++ # Frame filter attribute creation. ++ # ++ # 'name' is the name of the filter that GDB will display. ++ # ++ # 'priority' is the priority of the filter relative to other ++ # filters. ++ # ++ # 'enabled' is a boolean that indicates whether this filter is ++ # enabled and should be executed. ++ ++ self.name = "Foo" ++ self.priority = 100 ++ self.enabled = True ++ ++ # Register this frame filter with the global frame_filters ++ # dictionary. ++ gdb.frame_filters[self.name] = self ++ ++ def filter(self, frame_iter): ++ # Just return the iterator. ++ return frame_iter ++@end smallexample ++ ++The frame filter in the example above implements the three ++requirements for all frame filters. It implements the API, self ++registers, and makes a decision on the iterator (in this case, it just ++returns the iterator untouched). ++ ++The first step is attribute creation and assignment, and as shown in ++the comments the filter assigns the following attributes: @code{name}, ++@code{priority} and whether the filter should be enabled with the ++@code{enabled} attribute. ++ ++The second step is registering the frame filter with the dictionary or ++dictionaries that the frame filter has interest in. As shown in the ++comments, this filter just registers itself with the global dictionary ++@code{gdb.frame_filters}. As noted earlier, @code{gdb.frame_filters} ++is a dictionary that is initialized in the @code{gdb} module when ++@value{GDBN} starts. What dictionary a filter registers with is an ++important consideration. Generally, if a filter is specific to a set ++of code, it should be registered either in the @code{objfile} or ++@code{progspace} dictionaries as they are specific to the program ++currently loaded in @value{GDBN}. The global dictionary is always ++present in @value{GDBN} and is never unloaded. Any filters registered ++with the global dictionary will exist until @value{GDBN} exits. To ++avoid filters that may conflict, it is generally better to register ++frame filters against the dictionaries that more closely align with ++the usage of the filter currently in question. @xref{Python ++Auto-loading}, for further information on auto-loading Python scripts. ++ ++@value{GDBN} takes a hands-off approach to frame filter registration, ++therefore it is the frame filter's responsibility to ensure ++registration has occurred, and that any exceptions are handled ++appropriately. In particular, you may wish to handle exceptions ++relating to Python dictionary key uniqueness. It is mandatory that ++the dictionary key is the same as frame filter's @code{name} ++attribute. When a user manages frame filters (@pxref{Frame Filter ++Management}), the names @value{GDBN} will display are those contained ++in the @code{name} attribute. ++ ++The final step of this example is the implementation of the ++@code{filter} method. As shown in the example comments, we define the ++@code{filter} method and note that the method must take an iterator, ++and also must return an iterator. In this bare-bones example, the ++frame filter is not very useful as it just returns the iterator ++untouched. However this is a valid operation for frame filters that ++have the @code{enabled} attribute set, but decide not to operate on ++any frames. ++ ++In the next example, the frame filter operates on all frames and ++utilizes a frame decorator to perform some work on the frames. ++@xref{Frame Decorator API}, for further information on the frame ++decorator interface. ++ ++This example works on inlined frames. It highlights frames which are ++inlined by tagging them with an ``[inlined]'' tag. By applying a ++frame decorator to all frames with the Python @code{itertools imap} ++method, the example defers actions to the frame decorator. Frame ++decorators are only processed when @value{GDBN} prints the backtrace. ++ ++This introduces a new decision making topic: whether to perform ++decision making operations at the filtering step, or at the printing ++step. In this example's approach, it does not perform any filtering ++decisions at the filtering step beyond mapping a frame decorator to ++each frame. This allows the actual decision making to be performed ++when each frame is printed. This is an important consideration, and ++well worth reflecting upon when designing a frame filter. An issue ++that frame filters should avoid is unwinding the stack if possible. ++Some stacks can run very deep, into the tens of thousands in some ++cases. To search every frame to determine if it is inlined ahead of ++time may be too expensive at the filtering step. The frame filter ++cannot know how many frames it has to iterate over, and it would have ++to iterate through them all. This ends up duplicating effort as ++@value{GDBN} performs this iteration when it prints the frames. ++ ++In this example decision making can be deferred to the printing step. ++As each frame is printed, the frame decorator can examine each frame ++in turn when @value{GDBN} iterates. From a performance viewpoint, ++this is the most appropriate decision to make as it avoids duplicating ++the effort that the printing step would undertake anyway. Also, if ++there are many frame filters unwinding the stack during filtering, it ++can substantially delay the printing of the backtrace which will ++result in large memory usage, and a poor user experience. ++ ++@smallexample ++class InlineFilter(): ++ ++ def __init__(self): ++ self.name = "InlinedFrameFilter" ++ self.priority = 100 ++ self.enabled = True ++ gdb.frame_filters[self.name] = self ++ ++ def filter(self, frame_iter): ++ frame_iter = itertools.imap(InlinedFrameDecorator, ++ frame_iter) ++ return frame_iter ++@end smallexample ++ ++This frame filter is somewhat similar to the earlier example, except ++that the @code{filter} method applies a frame decorator object called ++@code{InlinedFrameDecorator} to each element in the iterator. The ++@code{imap} Python method is light-weight. It does not proactively ++iterate over the iterator, but rather creates a new iterator which ++wraps the existing one. ++ ++Below is the frame decorator for this example. ++ ++@smallexample ++class InlinedFrameDecorator(FrameDecorator): ++ ++ def __init__(self, fobj): ++ super(InlinedFrameDecorator, self).__init__(fobj) ++ ++ def function(self): ++ frame = fobj.inferior_frame() ++ name = str(frame.name()) ++ ++ if frame.type() == gdb.INLINE_FRAME: ++ name = name + " [inlined]" ++ ++ return name ++@end smallexample ++ ++This frame decorator only defines and overrides the @code{function} ++method. It lets the supplied @code{FrameDecorator}, which is shipped ++with @value{GDBN}, perform the other work associated with printing ++this frame. ++ ++The combination of these two objects create this output from a ++backtrace: ++ ++@smallexample ++#0 0x004004e0 in bar () at inline.c:11 ++#1 0x00400566 in max [inlined] (b=6, a=12) at inline.c:21 ++#2 0x00400566 in main () at inline.c:31 ++@end smallexample ++ ++So in the case of this example, a frame decorator is applied to all ++frames, regardless of whether they may be inlined or not. As ++@value{GDBN} iterates over the iterator produced by the frame filters, ++@value{GDBN} executes each frame decorator which then makes a decision ++on what to print in the @code{function} callback. Using a strategy ++like this is a way to defer decisions on the frame content to printing ++time. ++ ++@subheading Eliding Frames ++ ++It might be that the above example is not desirable for representing ++inlined frames, and a hierarchical approach may be preferred. If we ++want to hierarchically represent frames, the @code{elided} frame ++decorator interface might be preferable. ++ ++This example approaches the issue with the @code{elided} method. This ++example is quite long, but very simplistic. It is out-of-scope for ++this section to write a complete example that comprehensively covers ++all approaches of finding and printing inlined frames. However, this ++example illustrates the approach an author might use. ++ ++This example comprises of three sections. ++ ++@smallexample ++class InlineFrameFilter(): ++ ++ def __init__(self): ++ self.name = "InlinedFrameFilter" ++ self.priority = 100 ++ self.enabled = True ++ gdb.frame_filters[self.name] = self ++ ++ def filter(self, frame_iter): ++ return ElidingInlineIterator(frame_iter) ++@end smallexample ++ ++This frame filter is very similar to the other examples. The only ++difference is this frame filter is wrapping the iterator provided to ++it (@code{frame_iter}) with a custom iterator called ++@code{ElidingInlineIterator}. This again defers actions to when ++@value{GDBN} prints the backtrace, as the iterator is not traversed ++until printing. ++ ++The iterator for this example is as follows. It is in this section of ++the example where decisions are made on the content of the backtrace. ++ ++@smallexample ++class ElidingInlineIterator: ++ def __init__(self, ii): ++ self.input_iterator = ii ++ ++ def __iter__(self): ++ return self ++ ++ def next(self): ++ frame = next(self.input_iterator) ++ ++ if frame.inferior_frame().type() != gdb.INLINE_FRAME: ++ return frame ++ ++ try: ++ eliding_frame = next(self.input_iterator) ++ except StopIteration: ++ return frame ++ return ElidingFrameDecorator(eliding_frame, [frame]) ++@end smallexample ++ ++This iterator implements the Python iterator protocol. When the ++@code{next} function is called (when @value{GDBN} prints each frame), ++the iterator checks if this frame decorator, @code{frame}, is wrapping ++an inlined frame. If it is not, it returns the existing frame decorator ++untouched. If it is wrapping an inlined frame, it assumes that the ++inlined frame was contained within the next oldest frame, ++@code{eliding_frame}, which it fetches. It then creates and returns a ++frame decorator, @code{ElidingFrameDecorator}, which contains both the ++elided frame, and the eliding frame. ++ ++@smallexample ++class ElidingInlineDecorator(FrameDecorator): ++ ++ def __init__(self, frame, elided_frames): ++ super(ElidingInlineDecorator, self).__init__(frame) ++ self.frame = frame ++ self.elided_frames = elided_frames ++ ++ def elided(self): ++ return iter(self.elided_frames) ++@end smallexample ++ ++This frame decorator overrides one function and returns the inlined ++frame in the @code{elided} method. As before it lets ++@code{FrameDecorator} do the rest of the work involved in printing ++this frame. This produces the following output. ++ ++@smallexample ++#0 0x004004e0 in bar () at inline.c:11 ++#2 0x00400529 in main () at inline.c:25 ++ #1 0x00400529 in max (b=6, a=12) at inline.c:15 ++@end smallexample ++ ++In that output, @code{max} which has been inlined into @code{main} is ++printed hierarchically. Another approach would be to combine the ++@code{function} method, and the @code{elided} method to both print a ++marker in the inlined frame, and also show the hierarchical ++relationship. ++ + @node Inferiors In Python + @subsubsection Inferiors In Python + @cindex inferiors in Python +@@ -25280,6 +26071,11 @@ The @code{type_printers} attribute is a + @xref{Type Printing API}, for more information. + @end defvar + ++@defvar Progspace.frame_filters ++The @code{frame_filters} attribute is a dictionary of frame filter ++objects. @xref{Frame Filter API}, for more information. ++@end defvar ++ + @node Objfiles In Python + @subsubsection Objfiles In Python + +@@ -25330,6 +26126,11 @@ The @code{type_printers} attribute is a + @xref{Type Printing API}, for more information. + @end defvar + ++@defvar Objfile.frame_filters ++The @code{frame_filters} attribute is a dictionary of frame filter ++objects. @xref{Frame Filter API}, for more information. ++@end defvar ++ + A @code{gdb.Objfile} object has the following methods: + + @defun Objfile.is_valid () +@@ -26348,7 +27149,7 @@ No my-foo-pretty-printers.py + When reading an auto-loaded file, @value{GDBN} sets the + @dfn{current objfile}. This is available via the @code{gdb.current_objfile} + function (@pxref{Objfiles In Python}). This can be useful for +-registering objfile-specific pretty-printers. ++registering objfile-specific pretty-printers and frame-filters. + + @menu + * objfile-gdb.py file:: The @file{@var{objfile}-gdb.py} file +@@ -30219,6 +31020,22 @@ Is this going away???? + @node GDB/MI Stack Manipulation + @section @sc{gdb/mi} Stack Manipulation Commands + ++@subheading The @code{-enable-frame-filters} Command ++@findex -enable-frame-filters ++ ++@smallexample ++-enable-frame-filters ++@end smallexample ++ ++@value{GDBN} allows Python-based frame filters to affect the output of ++the MI commands relating to stack traces. As there is no way to ++implement this in a fully backward-compatible way, a front end must ++request that this functionality be enabled. ++ ++Once enabled, this feature cannot be disabled. ++ ++Note that if Python support has not been compiled into @value{GDBN}, ++this command will still succeed (and do nothing). + + @subheading The @code{-stack-info-frame} Command + @findex -stack-info-frame +@@ -30286,13 +31103,14 @@ For a stack with frame levels 0 through + (gdb) + @end smallexample + ++@anchor{-stack-list-arguments} + @subheading The @code{-stack-list-arguments} Command + @findex -stack-list-arguments + + @subsubheading Synopsis + + @smallexample +- -stack-list-arguments @var{print-values} ++ -stack-list-arguments [ --no-frame-filters ] @var{print-values} + [ @var{low-frame} @var{high-frame} ] + @end smallexample + +@@ -30309,7 +31127,9 @@ If @var{print-values} is 0 or @code{--no + the variables; if it is 1 or @code{--all-values}, print also their + values; and if it is 2 or @code{--simple-values}, print the name, + type and value for simple data types, and the name and type for arrays, +-structures and unions. ++structures and unions. If the option @code{--no-frame-filters} is ++supplied, then Python frame filters will not be executed. ++ + + Use of this command to obtain arguments in a single frame is + deprecated in favor of the @samp{-stack-list-variables} command. +@@ -30380,13 +31200,14 @@ args=[@{name="intarg",value="2"@}, + @c @subheading -stack-list-exception-handlers + + ++@anchor{-stack-list-frames} + @subheading The @code{-stack-list-frames} Command + @findex -stack-list-frames + + @subsubheading Synopsis + + @smallexample +- -stack-list-frames [ @var{low-frame} @var{high-frame} ] ++ -stack-list-frames [ --no-frame-filters @var{low-frame} @var{high-frame} ] + @end smallexample + + List the frames currently on the stack. For each frame it displays the +@@ -30416,7 +31237,9 @@ levels are between the two arguments (in + are equal, it shows the single frame at the corresponding level. It is + an error if @var{low-frame} is larger than the actual number of + frames. On the other hand, @var{high-frame} may be larger than the +-actual number of frames, in which case only existing frames will be returned. ++actual number of frames, in which case only existing frames will be ++returned. If the option @code{--no-frame-filters} is supplied, then ++Python frame filters will not be executed. + + @subsubheading @value{GDBN} Command + +@@ -30486,11 +31309,12 @@ Show a single frame: + + @subheading The @code{-stack-list-locals} Command + @findex -stack-list-locals ++@anchor{-stack-list-locals} + + @subsubheading Synopsis + + @smallexample +- -stack-list-locals @var{print-values} ++ -stack-list-locals [ --no-frame-filters ] @var{print-values} + @end smallexample + + Display the local variable names for the selected frame. If +@@ -30501,7 +31325,8 @@ type and value for simple data types, an + structures and unions. In this last case, a frontend can immediately + display the value of simple data types and create variable objects for + other data types when the user wishes to explore their values in +-more detail. ++more detail. If the option @code{--no-frame-filters} is supplied, then ++Python frame filters will not be executed. + + This command is deprecated in favor of the + @samp{-stack-list-variables} command. +@@ -30526,13 +31351,14 @@ This command is deprecated in favor of t + (gdb) + @end smallexample + ++@anchor{-stack-list-variables} + @subheading The @code{-stack-list-variables} Command + @findex -stack-list-variables + + @subsubheading Synopsis + + @smallexample +- -stack-list-variables @var{print-values} ++ -stack-list-variables [ --no-frame-filters ] @var{print-values} + @end smallexample + + Display the names of local variables and function arguments for the selected frame. If +@@ -30540,7 +31366,8 @@ Display the names of local variables and + the variables; if it is 1 or @code{--all-values}, print also their + values; and if it is 2 or @code{--simple-values}, print the name, + type and value for simple data types, and the name and type for arrays, +-structures and unions. ++structures and unions. If the option @code{--no-frame-filters} is ++supplied, then Python frame filters will not be executed. + + @subsubheading Example + +Index: gdb-7.6/gdb/mi/mi-cmd-stack.c +=================================================================== +--- gdb-7.6.orig/gdb/mi/mi-cmd-stack.c 2013-06-10 14:31:02.730084652 +0200 ++++ gdb-7.6/gdb/mi/mi-cmd-stack.c 2013-06-10 14:31:08.365082437 +0200 +@@ -31,6 +31,10 @@ + #include "language.h" + #include "valprint.h" + #include "exceptions.h" ++#include "utils.h" ++#include "mi-getopt.h" ++#include "python/python.h" ++#include + + enum what_to_list { locals, arguments, all }; + +@@ -38,6 +42,28 @@ static void list_args_or_locals (enum wh + enum print_values values, + struct frame_info *fi); + ++/* True if we want to allow Python-based frame filters. */ ++static int frame_filters = 0; ++ ++void ++mi_cmd_enable_frame_filters (char *command, char **argv, int argc) ++{ ++ if (argc != 0) ++ error (_("-enable-frame-filters: no arguments allowed")); ++ frame_filters = 1; ++} ++ ++/* Parse the --no-frame-filters option in commands where we cannot use ++ mi_getopt. */ ++static int ++parse_no_frames_option (const char *arg) ++{ ++ if (arg && (strcmp (arg, "--no-frame-filters") == 0)) ++ return 1; ++ ++ return 0; ++} ++ + /* Print a list of the stack frames. Args can be none, in which case + we want to print the whole backtrace, or a pair of numbers + specifying the frame numbers at which to start and stop the +@@ -52,14 +78,46 @@ mi_cmd_stack_list_frames (char *command, + int i; + struct cleanup *cleanup_stack; + struct frame_info *fi; ++ enum py_bt_status result = PY_BT_ERROR; ++ int raw_arg = 0; ++ int oind = 0; ++ enum opt ++ { ++ NO_FRAME_FILTERS ++ }; ++ static const struct mi_opt opts[] = ++ { ++ {"-no-frame-filters", NO_FRAME_FILTERS, 0}, ++ { 0, 0, 0 } ++ }; ++ ++ /* Parse arguments. In this instance we are just looking for ++ --no-frame-filters. */ ++ while (1) ++ { ++ char *oarg; ++ int opt = mi_getopt ("-stack-list-frames", argc, argv, ++ opts, &oind, &oarg); ++ if (opt < 0) ++ break; ++ switch ((enum opt) opt) ++ { ++ case NO_FRAME_FILTERS: ++ raw_arg = oind; ++ break; ++ } ++ } + +- if (argc > 2 || argc == 1) +- error (_("-stack-list-frames: Usage: [FRAME_LOW FRAME_HIGH]")); ++ /* After the last option is parsed, there should either be low - ++ high range, or no further arguments. */ ++ if ((argc - oind != 0) && (argc - oind != 2)) ++ error (_("-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW FRAME_HIGH]")); + +- if (argc == 2) ++ /* If there is a range, set it. */ ++ if (argc - oind == 2) + { +- frame_low = atoi (argv[0]); +- frame_high = atoi (argv[1]); ++ frame_low = atoi (argv[0 + oind]); ++ frame_high = atoi (argv[1 + oind]); + } + else + { +@@ -81,16 +139,37 @@ mi_cmd_stack_list_frames (char *command, + + cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack"); + +- /* Now let's print the frames up to frame_high, or until there are +- frames in the stack. */ +- for (; +- fi && (i <= frame_high || frame_high == -1); +- i++, fi = get_prev_frame (fi)) ++ if (! raw_arg && frame_filters) + { +- QUIT; +- /* Print the location and the address always, even for level 0. +- If args is 0, don't print the arguments. */ +- print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ ); ++ int flags = PRINT_LEVEL | PRINT_FRAME_INFO; ++ int py_frame_low = frame_low; ++ ++ /* We cannot pass -1 to frame_low, as that would signify a ++ relative backtrace from the tail of the stack. So, in the case ++ of frame_low == -1, assign and increment it. */ ++ if (py_frame_low == -1) ++ py_frame_low++; ++ ++ result = apply_frame_filter (get_current_frame (), flags, ++ NO_VALUES, current_uiout, ++ py_frame_low, frame_high); ++ } ++ ++ /* Run the inbuilt backtrace if there are no filters registered, or ++ if "--no-frame-filters" has been specified from the command. */ ++ if (! frame_filters || raw_arg || result == PY_BT_NO_FILTERS) ++ { ++ /* Now let's print the frames up to frame_high, or until there are ++ frames in the stack. */ ++ for (; ++ fi && (i <= frame_high || frame_high == -1); ++ i++, fi = get_prev_frame (fi)) ++ { ++ QUIT; ++ /* Print the location and the address always, even for level 0. ++ If args is 0, don't print the arguments. */ ++ print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ ); ++ } + } + + do_cleanups (cleanup_stack); +@@ -147,13 +226,34 @@ void + mi_cmd_stack_list_locals (char *command, char **argv, int argc) + { + struct frame_info *frame; ++ int raw_arg = 0; ++ enum py_bt_status result = PY_BT_ERROR; ++ int print_value; ++ ++ if (argc > 0) ++ raw_arg = parse_no_frames_option (argv[0]); ++ ++ if (argc < 1 || argc > 2 || (argc == 2 && ! raw_arg) ++ || (argc == 1 && raw_arg)) ++ error (_("-stack-list-locals: Usage: [--no-frame-filters] PRINT_VALUES")); + +- if (argc != 1) +- error (_("-stack-list-locals: Usage: PRINT_VALUES")); +- +- frame = get_selected_frame (NULL); ++ frame = get_selected_frame (NULL); ++ print_value = parse_print_values (argv[raw_arg]); + +- list_args_or_locals (locals, parse_print_values (argv[0]), frame); ++ if (! raw_arg && frame_filters) ++ { ++ int flags = PRINT_LEVEL | PRINT_LOCALS; ++ ++ result = apply_frame_filter (frame, flags, print_value, ++ current_uiout, 0, 0); ++ } ++ ++ /* Run the inbuilt backtrace if there are no filters registered, or ++ if "--no-frame-filters" has been specified from the command. */ ++ if (! frame_filters || raw_arg || result == PY_BT_NO_FILTERS) ++ { ++ list_args_or_locals (locals, print_value, frame); ++ } + } + + /* Print a list of the arguments for the current frame. With argument +@@ -170,15 +270,20 @@ mi_cmd_stack_list_args (char *command, c + struct cleanup *cleanup_stack_args; + enum print_values print_values; + struct ui_out *uiout = current_uiout; ++ int raw_arg = 0; ++ enum py_bt_status result = PY_BT_ERROR; + +- if (argc < 1 || argc > 3 || argc == 2) +- error (_("-stack-list-arguments: Usage: " +- "PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); ++ if (argc > 0) ++ raw_arg = parse_no_frames_option (argv[0]); + +- if (argc == 3) ++ if (argc < 1 || (argc > 3 && ! raw_arg) || (argc == 2 && ! raw_arg)) ++ error (_("-stack-list-arguments: Usage: " \ ++ "[--no-frame-filters] PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); ++ ++ if (argc >= 3) + { +- frame_low = atoi (argv[1]); +- frame_high = atoi (argv[2]); ++ frame_low = atoi (argv[1 + raw_arg]); ++ frame_high = atoi (argv[2 + raw_arg]); + } + else + { +@@ -188,7 +293,7 @@ mi_cmd_stack_list_args (char *command, c + frame_high = -1; + } + +- print_values = parse_print_values (argv[0]); ++ print_values = parse_print_values (argv[raw_arg]); + + /* Let's position fi on the frame at which to start the + display. Could be the innermost frame if the whole stack needs +@@ -203,21 +308,41 @@ mi_cmd_stack_list_args (char *command, c + cleanup_stack_args + = make_cleanup_ui_out_list_begin_end (uiout, "stack-args"); + +- /* Now let's print the frames up to frame_high, or until there are +- frames in the stack. */ +- for (; +- fi && (i <= frame_high || frame_high == -1); +- i++, fi = get_prev_frame (fi)) ++ if (! raw_arg && frame_filters) + { +- struct cleanup *cleanup_frame; ++ int flags = PRINT_LEVEL | PRINT_ARGS; ++ int py_frame_low = frame_low; + +- QUIT; +- cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); +- ui_out_field_int (uiout, "level", i); +- list_args_or_locals (arguments, print_values, fi); +- do_cleanups (cleanup_frame); ++ /* We cannot pass -1 to frame_low, as that would signify a ++ relative backtrace from the tail of the stack. So, in the case ++ of frame_low == -1, assign and increment it. */ ++ if (py_frame_low == -1) ++ py_frame_low++; ++ ++ result = apply_frame_filter (get_current_frame (), flags, ++ print_values, current_uiout, ++ py_frame_low, frame_high); + } + ++ /* Run the inbuilt backtrace if there are no filters registered, or ++ if "--no-frame-filters" has been specified from the command. */ ++ if (! frame_filters || raw_arg || result == PY_BT_NO_FILTERS) ++ { ++ /* Now let's print the frames up to frame_high, or until there are ++ frames in the stack. */ ++ for (; ++ fi && (i <= frame_high || frame_high == -1); ++ i++, fi = get_prev_frame (fi)) ++ { ++ struct cleanup *cleanup_frame; ++ ++ QUIT; ++ cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); ++ ui_out_field_int (uiout, "level", i); ++ list_args_or_locals (arguments, print_values, fi); ++ do_cleanups (cleanup_frame); ++ } ++ } + do_cleanups (cleanup_stack_args); + } + +@@ -230,13 +355,35 @@ void + mi_cmd_stack_list_variables (char *command, char **argv, int argc) + { + struct frame_info *frame; ++ int raw_arg = 0; ++ enum py_bt_status result = PY_BT_ERROR; ++ int print_value; ++ ++ if (argc > 0) ++ raw_arg = parse_no_frames_option (argv[0]); ++ ++ if (argc < 1 || argc > 2 || (argc == 2 && ! raw_arg) ++ || (argc == 1 && raw_arg)) ++ error (_("-stack-list-variables: Usage: " \ ++ "[--no-frame-filters] PRINT_VALUES")); + +- if (argc != 1) +- error (_("Usage: PRINT_VALUES")); +- +- frame = get_selected_frame (NULL); ++ frame = get_selected_frame (NULL); ++ print_value = parse_print_values (argv[raw_arg]); + +- list_args_or_locals (all, parse_print_values (argv[0]), frame); ++ if (! raw_arg && frame_filters) ++ { ++ int flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS; ++ ++ result = apply_frame_filter (frame, flags, print_value, ++ current_uiout, 0, 0); ++ } ++ ++ /* Run the inbuilt backtrace if there are no filters registered, or ++ if "--no-frame-filters" has been specified from the command. */ ++ if (! frame_filters || raw_arg || result == PY_BT_NO_FILTERS) ++ { ++ list_args_or_locals (all, print_value, frame); ++ } + } + + /* Print single local or argument. ARG must be already read in. For +Index: gdb-7.6/gdb/mi/mi-cmds.c +=================================================================== +--- gdb-7.6.orig/gdb/mi/mi-cmds.c 2013-06-10 14:31:02.730084652 +0200 ++++ gdb-7.6/gdb/mi/mi-cmds.c 2013-06-10 14:31:08.365082437 +0200 +@@ -86,6 +86,7 @@ static struct mi_cmd mi_cmds[] = + mi_cmd_data_write_register_values), + DEF_MI_CMD_MI ("enable-timings", mi_cmd_enable_timings), + DEF_MI_CMD_MI ("enable-pretty-printing", mi_cmd_enable_pretty_printing), ++ DEF_MI_CMD_MI ("enable-frame-filters", mi_cmd_enable_frame_filters), + DEF_MI_CMD_MI ("environment-cd", mi_cmd_env_cd), + DEF_MI_CMD_MI ("environment-directory", mi_cmd_env_dir), + DEF_MI_CMD_MI ("environment-path", mi_cmd_env_path), +Index: gdb-7.6/gdb/mi/mi-cmds.h +=================================================================== +--- gdb-7.6.orig/gdb/mi/mi-cmds.h 2013-06-10 14:31:02.730084652 +0200 ++++ gdb-7.6/gdb/mi/mi-cmds.h 2013-06-10 14:31:08.365082437 +0200 +@@ -118,6 +118,7 @@ extern mi_cmd_argv_ftype mi_cmd_var_show + extern mi_cmd_argv_ftype mi_cmd_var_show_format; + extern mi_cmd_argv_ftype mi_cmd_var_update; + extern mi_cmd_argv_ftype mi_cmd_enable_pretty_printing; ++extern mi_cmd_argv_ftype mi_cmd_enable_frame_filters; + extern mi_cmd_argv_ftype mi_cmd_var_set_update_range; + + /* Description of a single command. */ +Index: gdb-7.6/gdb/python/py-framefilter.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/python/py-framefilter.c 2013-06-10 14:31:08.366082437 +0200 +@@ -0,0 +1,1528 @@ ++/* Python frame filters ++ ++ Copyright (C) 2013 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 "objfiles.h" ++#include "symtab.h" ++#include "language.h" ++#include "exceptions.h" ++#include "arch-utils.h" ++#include "python.h" ++#include "ui-out.h" ++#include "valprint.h" ++#include "annotate.h" ++#include "hashtab.h" ++#include "demangle.h" ++#include "mi/mi-cmds.h" ++#include "python-internal.h" ++ ++enum mi_print_types ++{ ++ MI_PRINT_ARGS, ++ MI_PRINT_LOCALS ++}; ++ ++/* Helper function to extract a symbol, a name and a language ++ definition from a Python object that conforms to the "Symbol Value" ++ interface. OBJ is the Python object to extract the values from. ++ NAME is a pass-through argument where the name of the symbol will ++ be written. NAME is allocated in this function, but the caller is ++ responsible for clean up. SYM is a pass-through argument where the ++ symbol will be written. In the case of the API returning a string, ++ this will be set to NULL. LANGUAGE is also a pass-through argument ++ denoting the language attributed to the Symbol. In the case of SYM ++ being NULL, this will be set to the current language. Returns ++ PY_BT_ERROR on error with the appropriate Python exception set, and ++ PY_BT_OK on success. */ ++ ++static enum py_bt_status ++extract_sym (PyObject *obj, char **name, struct symbol **sym, ++ const struct language_defn **language) ++{ ++ PyObject *result = PyObject_CallMethod (obj, "symbol", NULL); ++ ++ if (result == NULL) ++ return PY_BT_ERROR; ++ ++ /* For 'symbol' callback, the function can return a symbol or a ++ string. */ ++ if (gdbpy_is_string (result)) ++ { ++ *name = python_string_to_host_string (result); ++ Py_DECREF (result); ++ ++ if (*name == NULL) ++ return PY_BT_ERROR; ++ /* If the API returns a string (and not a symbol), then there is ++ no symbol derived language available and the frame filter has ++ either overridden the symbol with a string, or supplied a ++ entirely synthetic symbol/value pairing. In that case, use ++ python_language. */ ++ *language = python_language; ++ *sym = NULL; ++ } ++ else ++ { ++ /* This type checks 'result' during the conversion so we ++ just call it unconditionally and check the return. */ ++ *sym = symbol_object_to_symbol (result); ++ ++ Py_DECREF (result); ++ ++ if (*sym == NULL) ++ { ++ PyErr_SetString (PyExc_RuntimeError, ++ _("Unexpected value. Expecting a " ++ "gdb.Symbol or a Python string.")); ++ return PY_BT_ERROR; ++ } ++ ++ /* Duplicate the symbol name, so the caller has consistency ++ in garbage collection. */ ++ *name = xstrdup (SYMBOL_PRINT_NAME (*sym)); ++ ++ /* If a symbol is specified attempt to determine the language ++ from the symbol. If mode is not "auto", then the language ++ has been explicitly set, use that. */ ++ if (language_mode == language_mode_auto) ++ *language = language_def (SYMBOL_LANGUAGE (*sym)); ++ else ++ *language = current_language; ++ } ++ ++ return PY_BT_OK; ++} ++ ++/* Helper function to extract a value from an object that conforms to ++ the "Symbol Value" interface. OBJ is the Python object to extract ++ the value from. VALUE is a pass-through argument where the value ++ will be written. If the object does not have the value attribute, ++ or provides the Python None for a value, VALUE will be set to NULL ++ and this function will return as successful. Returns PY_BT_ERROR ++ on error with the appropriate Python exception set, and PY_BT_OK on ++ success. */ ++ ++static enum py_bt_status ++extract_value (PyObject *obj, struct value **value) ++{ ++ if (PyObject_HasAttrString (obj, "value")) ++ { ++ PyObject *vresult = PyObject_CallMethod (obj, "value", NULL); ++ ++ if (vresult == NULL) ++ return PY_BT_ERROR; ++ ++ /* The Python code has returned 'None' for a value, so we set ++ value to NULL. This flags that GDB should read the ++ value. */ ++ if (vresult == Py_None) ++ { ++ Py_DECREF (vresult); ++ *value = NULL; ++ return PY_BT_OK; ++ } ++ else ++ { ++ *value = convert_value_from_python (vresult); ++ Py_DECREF (vresult); ++ ++ if (*value == NULL) ++ return PY_BT_ERROR; ++ ++ return PY_BT_OK; ++ } ++ } ++ else ++ *value = NULL; ++ ++ return PY_BT_OK; ++} ++ ++/* MI prints only certain values according to the type of symbol and ++ also what the user has specified. SYM is the symbol to check, and ++ MI_PRINT_TYPES is an enum specifying what the user wants emitted ++ for the MI command in question. */ ++static int ++mi_should_print (struct symbol *sym, enum mi_print_types type) ++{ ++ int print_me = 0; ++ ++ switch (SYMBOL_CLASS (sym)) ++ { ++ default: ++ case LOC_UNDEF: /* catches errors */ ++ case LOC_CONST: /* constant */ ++ case LOC_TYPEDEF: /* local typedef */ ++ case LOC_LABEL: /* local label */ ++ case LOC_BLOCK: /* local function */ ++ case LOC_CONST_BYTES: /* loc. byte seq. */ ++ case LOC_UNRESOLVED: /* unresolved static */ ++ case LOC_OPTIMIZED_OUT: /* optimized out */ ++ print_me = 0; ++ break; ++ ++ case LOC_ARG: /* argument */ ++ case LOC_REF_ARG: /* reference arg */ ++ case LOC_REGPARM_ADDR: /* indirect register arg */ ++ case LOC_LOCAL: /* stack local */ ++ case LOC_STATIC: /* static */ ++ case LOC_REGISTER: /* register */ ++ case LOC_COMPUTED: /* computed location */ ++ if (type == MI_PRINT_LOCALS) ++ print_me = ! SYMBOL_IS_ARGUMENT (sym); ++ else ++ print_me = SYMBOL_IS_ARGUMENT (sym); ++ } ++ return print_me; ++} ++ ++/* Helper function which outputs a type name extracted from VAL to a ++ "type" field in the output stream OUT. OUT is the ui-out structure ++ the type name will be output too, and VAL is the value that the ++ type will be extracted from. Returns PY_BT_ERROR on error, with ++ any GDB exceptions converted to a Python exception, or PY_BT_OK on ++ success. */ ++ ++static enum py_bt_status ++py_print_type (struct ui_out *out, struct value *val) ++{ ++ volatile struct gdb_exception except; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ struct type *type; ++ struct ui_file *stb; ++ struct cleanup *cleanup; ++ ++ stb = mem_fileopen (); ++ cleanup = make_cleanup_ui_file_delete (stb); ++ type = check_typedef (value_type (val)); ++ type_print (value_type (val), "", stb, -1); ++ ui_out_field_stream (out, "type", stb); ++ do_cleanups (cleanup); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ return PY_BT_ERROR; ++ } ++ ++ return PY_BT_OK; ++} ++ ++/* Helper function which outputs a value to an output field in a ++ stream. OUT is the ui-out structure the value will be output to, ++ VAL is the value that will be printed, OPTS contains the value ++ printing options, ARGS_TYPE is an enumerator describing the ++ argument format, and LANGUAGE is the language_defn that the value ++ will be printed with. Returns PY_BT_ERROR on error, with any GDB ++ exceptions converted to a Python exception, or PY_BT_OK on ++ success. */ ++ ++static enum py_bt_status ++py_print_value (struct ui_out *out, struct value *val, ++ const struct value_print_options *opts, ++ int indent, ++ enum py_frame_args args_type, ++ const struct language_defn *language) ++{ ++ int should_print = 0; ++ volatile struct gdb_exception except; ++ int local_indent = (4 * indent); ++ ++ /* Never set an indent level for common_val_print if MI. */ ++ if (ui_out_is_mi_like_p (out)) ++ local_indent = 0; ++ ++ /* MI does not print certain values, differentiated by type, ++ depending on what ARGS_TYPE indicates. Test type against option. ++ For CLI print all values. */ ++ if (args_type == MI_PRINT_SIMPLE_VALUES ++ || args_type == MI_PRINT_ALL_VALUES) ++ { ++ struct type *type = NULL; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ type = check_typedef (value_type (val)); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ return PY_BT_ERROR; ++ } ++ ++ if (args_type == MI_PRINT_ALL_VALUES) ++ should_print = 1; ++ else if (args_type == MI_PRINT_SIMPLE_VALUES ++ && TYPE_CODE (type) != TYPE_CODE_ARRAY ++ && TYPE_CODE (type) != TYPE_CODE_STRUCT ++ && TYPE_CODE (type) != TYPE_CODE_UNION) ++ should_print = 1; ++ } ++ else if (args_type != NO_VALUES) ++ should_print = 1; ++ ++ if (should_print) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ struct ui_file *stb; ++ struct cleanup *cleanup; ++ ++ stb = mem_fileopen (); ++ cleanup = make_cleanup_ui_file_delete (stb); ++ common_val_print (val, stb, indent, opts, language); ++ ui_out_field_stream (out, "value", stb); ++ do_cleanups (cleanup); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ return PY_BT_ERROR; ++ } ++ } ++ ++ return PY_BT_OK; ++} ++ ++/* Helper function to call a Python method and extract an iterator ++ from the result. If the function returns anything but an iterator ++ the exception is preserved and NULL is returned. FILTER is the ++ Python object to call, and FUNC is the name of the method. Returns ++ a PyObject, or NULL on error with the appropriate exception set. ++ This function can return an iterator, or NULL. */ ++ ++static PyObject * ++get_py_iter_from_func (PyObject *filter, char *func) ++{ ++ if (PyObject_HasAttrString (filter, func)) ++ { ++ PyObject *result = PyObject_CallMethod (filter, func, NULL); ++ ++ if (result != NULL) ++ { ++ if (result == Py_None) ++ { ++ return result; ++ } ++ else ++ { ++ PyObject *iterator = PyObject_GetIter (result); ++ ++ Py_DECREF (result); ++ return iterator; ++ } ++ } ++ } ++ else ++ Py_RETURN_NONE; ++ ++ return NULL; ++} ++ ++/* Helper function to output a single frame argument and value to an ++ output stream. This function will account for entry values if the ++ FV parameter is populated, the frame argument has entry values ++ associated with them, and the appropriate "set entry-value" ++ options are set. Will output in CLI or MI like format depending ++ on the type of output stream detected. OUT is the output stream, ++ SYM_NAME is the name of the symbol. If SYM_NAME is populated then ++ it must have an accompanying value in the parameter FV. FA is a ++ frame argument structure. If FA is populated, both SYM_NAME and ++ FV are ignored. OPTS contains the value printing options, ++ ARGS_TYPE is an enumerator describing the argument format, ++ PRINT_ARGS_FIELD is a flag which indicates if we output "ARGS=1" ++ in MI output in commands where both arguments and locals are ++ printed. Returns PY_BT_ERROR on error, with any GDB exceptions ++ converted to a Python exception, or PY_BT_OK on success. */ ++ ++static enum py_bt_status ++py_print_single_arg (struct ui_out *out, ++ const char *sym_name, ++ struct frame_arg *fa, ++ struct value *fv, ++ const struct value_print_options *opts, ++ enum py_frame_args args_type, ++ int print_args_field, ++ const struct language_defn *language) ++{ ++ struct value *val; ++ volatile struct gdb_exception except; ++ ++ if (fa != NULL) ++ { ++ language = language_def (SYMBOL_LANGUAGE (fa->sym)); ++ val = fa->val; ++ } ++ else ++ val = fv; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); ++ ++ /* MI has varying rules for tuples, but generally if there is only ++ one element in each item in the list, do not start a tuple. The ++ exception is -stack-list-variables which emits an ARGS="1" field ++ if the value is a frame argument. This is denoted in this ++ function with PRINT_ARGS_FIELD which is flag from the caller to ++ emit the ARGS field. */ ++ if (ui_out_is_mi_like_p (out)) ++ { ++ if (print_args_field || args_type != NO_VALUES) ++ make_cleanup_ui_out_tuple_begin_end (out, NULL); ++ } ++ ++ annotate_arg_begin (); ++ ++ /* If frame argument is populated, check for entry-values and the ++ entry value options. */ ++ if (fa != NULL) ++ { ++ struct ui_file *stb; ++ ++ stb = mem_fileopen (); ++ make_cleanup_ui_file_delete (stb); ++ fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (fa->sym), ++ SYMBOL_LANGUAGE (fa->sym), ++ DMGL_PARAMS | DMGL_ANSI); ++ if (fa->entry_kind == print_entry_values_compact) ++ { ++ fputs_filtered ("=", stb); ++ ++ fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (fa->sym), ++ SYMBOL_LANGUAGE (fa->sym), ++ DMGL_PARAMS | DMGL_ANSI); ++ } ++ if (fa->entry_kind == print_entry_values_only ++ || fa->entry_kind == print_entry_values_compact) ++ { ++ fputs_filtered ("@entry", stb); ++ } ++ ui_out_field_stream (out, "name", stb); ++ } ++ else ++ /* Otherwise, just output the name. */ ++ ui_out_field_string (out, "name", sym_name); ++ ++ annotate_arg_name_end (); ++ ++ if (! ui_out_is_mi_like_p (out)) ++ ui_out_text (out, "="); ++ ++ if (print_args_field) ++ ui_out_field_int (out, "arg", 1); ++ ++ /* For MI print the type, but only for simple values. This seems ++ weird, but this is how MI choose to format the various output ++ types. */ ++ if (args_type == MI_PRINT_SIMPLE_VALUES) ++ { ++ if (py_print_type (out, val) == PY_BT_ERROR) ++ { ++ do_cleanups (cleanups); ++ goto error; ++ } ++ } ++ ++ annotate_arg_value (value_type (val)); ++ ++ /* If the output is to the CLI, and the user option "set print ++ frame-arguments" is set to none, just output "...". */ ++ if (! ui_out_is_mi_like_p (out) && args_type == NO_VALUES) ++ ui_out_field_string (out, "value", "..."); ++ else ++ { ++ /* Otherwise, print the value for both MI and the CLI, except ++ for the case of MI_PRINT_NO_VALUES. */ ++ if (args_type != NO_VALUES) ++ { ++ if (py_print_value (out, val, opts, 0, args_type, language) ++ == PY_BT_ERROR) ++ { ++ do_cleanups (cleanups); ++ goto error; ++ } ++ } ++ } ++ ++ do_cleanups (cleanups); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ return PY_BT_OK; ++ ++ error: ++ return PY_BT_ERROR; ++} ++ ++/* Helper function to loop over frame arguments provided by the ++ "frame_arguments" Python API. Elements in the iterator must ++ conform to the "Symbol Value" interface. ITER is the Python ++ iterable object, OUT is the output stream, ARGS_TYPE is an ++ enumerator describing the argument format, PRINT_ARGS_FIELD is a ++ flag which indicates if we output "ARGS=1" in MI output in commands ++ where both arguments and locals are printed, and FRAME is the ++ backing frame. Returns PY_BT_ERROR on error, with any GDB ++ exceptions converted to a Python exception, or PY_BT_OK on ++ success. */ ++ ++static enum py_bt_status ++enumerate_args (PyObject *iter, ++ struct ui_out *out, ++ enum py_frame_args args_type, ++ int print_args_field, ++ struct frame_info *frame) ++{ ++ PyObject *item; ++ struct value_print_options opts; ++ volatile struct gdb_exception except; ++ ++ get_user_print_options (&opts); ++ ++ if (args_type == CLI_SCALAR_VALUES) ++ { ++ /* True in "summary" mode, false otherwise. */ ++ opts.summary = 1; ++ } ++ ++ opts.deref_ref = 1; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_args (); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ /* Collect the first argument outside of the loop, so output of ++ commas in the argument output is correct. At the end of the ++ loop block collect another item from the iterator, and, if it is ++ not null emit a comma. */ ++ item = PyIter_Next (iter); ++ if (item == NULL && PyErr_Occurred ()) ++ goto error; ++ ++ while (item) ++ { ++ const struct language_defn *language; ++ char *sym_name; ++ struct symbol *sym; ++ struct value *val; ++ enum py_bt_status success = PY_BT_ERROR; ++ ++ success = extract_sym (item, &sym_name, &sym, &language); ++ if (success == PY_BT_ERROR) ++ { ++ Py_DECREF (item); ++ goto error; ++ } ++ ++ success = extract_value (item, &val); ++ if (success == PY_BT_ERROR) ++ { ++ xfree (sym_name); ++ Py_DECREF (item); ++ goto error; ++ } ++ ++ Py_DECREF (item); ++ item = NULL; ++ ++ if (sym && ui_out_is_mi_like_p (out) ++ && ! mi_should_print (sym, MI_PRINT_ARGS)) ++ { ++ xfree (sym_name); ++ continue; ++ } ++ ++ /* If the object did not provide a value, read it using ++ read_frame_args and account for entry values, if any. */ ++ if (val == NULL) ++ { ++ struct frame_arg arg, entryarg; ++ ++ /* If there is no value, and also no symbol, set error and ++ exit. */ ++ if (sym == NULL) ++ { ++ PyErr_SetString (PyExc_RuntimeError, ++ _("No symbol or value provided.")); ++ xfree (sym_name); ++ goto error; ++ } ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ read_frame_arg (sym, frame, &arg, &entryarg); ++ } ++ if (except.reason < 0) ++ { ++ xfree (sym_name); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ /* The object has not provided a value, so this is a frame ++ argument to be read by GDB. In this case we have to ++ account for entry-values. */ ++ ++ if (arg.entry_kind != print_entry_values_only) ++ { ++ if (py_print_single_arg (out, NULL, &arg, ++ NULL, &opts, ++ args_type, ++ print_args_field, ++ NULL) == PY_BT_ERROR) ++ { ++ xfree (arg.error); ++ xfree (entryarg.error); ++ xfree (sym_name); ++ goto error; ++ } ++ } ++ ++ if (entryarg.entry_kind != print_entry_values_no) ++ { ++ if (arg.entry_kind != print_entry_values_only) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_text (out, ", "); ++ ui_out_wrap_hint (out, " "); ++ } ++ if (except.reason < 0) ++ { ++ xfree (arg.error); ++ xfree (entryarg.error); ++ xfree (sym_name); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ if (py_print_single_arg (out, NULL, &entryarg, NULL, ++ &opts, args_type, ++ print_args_field, NULL) == PY_BT_ERROR) ++ { ++ xfree (arg.error); ++ xfree (entryarg.error); ++ xfree (sym_name); ++ goto error; ++ } ++ } ++ ++ xfree (arg.error); ++ xfree (entryarg.error); ++ } ++ else ++ { ++ /* If the object has provided a value, we just print that. */ ++ if (val != NULL) ++ { ++ if (py_print_single_arg (out, sym_name, NULL, val, &opts, ++ args_type, print_args_field, ++ language) == PY_BT_ERROR) ++ { ++ xfree (sym_name); ++ goto error; ++ } ++ } ++ } ++ ++ xfree (sym_name); ++ ++ /* Collect the next item from the iterator. If ++ this is the last item, do not print the ++ comma. */ ++ item = PyIter_Next (iter); ++ if (item != NULL) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_text (out, ", "); ++ } ++ if (except.reason < 0) ++ { ++ Py_DECREF (item); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ else if (PyErr_Occurred ()) ++ goto error; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_arg_end (); ++ } ++ if (except.reason < 0) ++ { ++ Py_DECREF (item); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ return PY_BT_OK; ++ ++ error: ++ return PY_BT_ERROR; ++} ++ ++ ++/* Helper function to loop over variables provided by the ++ "frame_locals" Python API. Elements in the iterable must conform ++ to the "Symbol Value" interface. ITER is the Python iterable ++ object, OUT is the output stream, INDENT is whether we should ++ indent the output (for CLI), ARGS_TYPE is an enumerator describing ++ the argument format, PRINT_ARGS_FIELD is flag which indicates ++ whether to output the ARGS field in the case of ++ -stack-list-variables and FRAME is the backing frame. Returns ++ PY_BT_ERROR on error, with any GDB exceptions converted to a Python ++ exception, or PY_BT_OK on success. */ ++ ++static enum py_bt_status ++enumerate_locals (PyObject *iter, ++ struct ui_out *out, ++ int indent, ++ enum py_frame_args args_type, ++ int print_args_field, ++ struct frame_info *frame) ++{ ++ PyObject *item; ++ struct value_print_options opts; ++ ++ get_user_print_options (&opts); ++ opts.deref_ref = 1; ++ ++ while ((item = PyIter_Next (iter))) ++ { ++ const struct language_defn *language; ++ char *sym_name; ++ struct value *val; ++ enum py_bt_status success = PY_BT_ERROR; ++ struct symbol *sym; ++ volatile struct gdb_exception except; ++ int local_indent = 8 + (8 * indent); ++ struct cleanup *locals_cleanups; ++ ++ locals_cleanups = make_cleanup_py_decref (item); ++ ++ success = extract_sym (item, &sym_name, &sym, &language); ++ if (success == PY_BT_ERROR) ++ { ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ ++ make_cleanup (xfree, sym_name); ++ ++ success = extract_value (item, &val); ++ if (success == PY_BT_ERROR) ++ { ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ ++ if (sym != NULL && ui_out_is_mi_like_p (out) ++ && ! mi_should_print (sym, MI_PRINT_LOCALS)) ++ { ++ do_cleanups (locals_cleanups); ++ continue; ++ } ++ ++ /* If the object did not provide a value, read it. */ ++ if (val == NULL) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ val = read_var_value (sym, frame); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ } ++ ++ /* With PRINT_NO_VALUES, MI does not emit a tuple normally as ++ each output contains only one field. The exception is ++ -stack-list-variables, which always provides a tuple. */ ++ if (ui_out_is_mi_like_p (out)) ++ { ++ if (print_args_field || args_type != NO_VALUES) ++ make_cleanup_ui_out_tuple_begin_end (out, NULL); ++ } ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ if (! ui_out_is_mi_like_p (out)) ++ { ++ /* If the output is not MI we indent locals. */ ++ ui_out_spaces (out, local_indent); ++ } ++ ++ ui_out_field_string (out, "name", sym_name); ++ ++ if (! ui_out_is_mi_like_p (out)) ++ ui_out_text (out, " = "); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ ++ if (args_type == MI_PRINT_SIMPLE_VALUES) ++ { ++ if (py_print_type (out, val) == PY_BT_ERROR) ++ { ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ } ++ ++ /* CLI always prints values for locals. MI uses the ++ simple/no/all system. */ ++ if (! ui_out_is_mi_like_p (out)) ++ { ++ int val_indent = (indent + 1) * 4; ++ ++ if (py_print_value (out, val, &opts, val_indent, args_type, ++ language) == PY_BT_ERROR) ++ { ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ } ++ else ++ { ++ if (args_type != NO_VALUES) ++ { ++ if (py_print_value (out, val, &opts, 0, args_type, ++ language) == PY_BT_ERROR) ++ { ++ do_cleanups (locals_cleanups); ++ goto error; ++ } ++ } ++ } ++ ++ do_cleanups (locals_cleanups); ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_text (out, "\n"); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ if (item == NULL && PyErr_Occurred ()) ++ goto error; ++ ++ return PY_BT_OK; ++ ++ error: ++ return PY_BT_ERROR; ++} ++ ++/* Helper function for -stack-list-variables. Returns PY_BT_ERROR on ++ error, or PY_BT_OK on success. */ ++ ++static enum py_bt_status ++py_mi_print_variables (PyObject *filter, struct ui_out *out, ++ struct value_print_options *opts, ++ enum py_frame_args args_type, ++ struct frame_info *frame) ++{ ++ struct cleanup *old_chain; ++ PyObject *args_iter; ++ PyObject *locals_iter; ++ ++ args_iter = get_py_iter_from_func (filter, "frame_args"); ++ old_chain = make_cleanup_py_xdecref (args_iter); ++ if (args_iter == NULL) ++ goto error; ++ ++ locals_iter = get_py_iter_from_func (filter, "frame_locals"); ++ if (locals_iter == NULL) ++ goto error; ++ ++ make_cleanup_py_decref (locals_iter); ++ make_cleanup_ui_out_list_begin_end (out, "variables"); ++ ++ if (args_iter != Py_None) ++ if (enumerate_args (args_iter, out, args_type, 1, frame) == PY_BT_ERROR) ++ goto error; ++ ++ if (locals_iter != Py_None) ++ if (enumerate_locals (locals_iter, out, 1, args_type, 1, frame) ++ == PY_BT_ERROR) ++ goto error; ++ ++ do_cleanups (old_chain); ++ return PY_BT_OK; ++ ++ error: ++ do_cleanups (old_chain); ++ return PY_BT_ERROR; ++} ++ ++/* Helper function for printing locals. This function largely just ++ creates the wrapping tuple, and calls enumerate_locals. Returns ++ PY_BT_ERROR on error, or PY_BT_OK on success.*/ ++ ++static enum py_bt_status ++py_print_locals (PyObject *filter, ++ struct ui_out *out, ++ enum py_frame_args args_type, ++ int indent, ++ struct frame_info *frame) ++{ ++ PyObject *locals_iter = get_py_iter_from_func (filter, ++ "frame_locals"); ++ struct cleanup *old_chain = make_cleanup_py_xdecref (locals_iter); ++ ++ if (locals_iter == NULL) ++ goto locals_error; ++ ++ make_cleanup_ui_out_list_begin_end (out, "locals"); ++ ++ if (locals_iter != Py_None) ++ if (enumerate_locals (locals_iter, out, indent, args_type, ++ 0, frame) == PY_BT_ERROR) ++ goto locals_error; ++ ++ do_cleanups (old_chain); ++ return PY_BT_OK;; ++ ++ locals_error: ++ do_cleanups (old_chain); ++ return PY_BT_ERROR; ++} ++ ++/* Helper function for printing frame arguments. This function ++ largely just creates the wrapping tuple, and calls enumerate_args. ++ Returns PY_BT_ERROR on error, with any GDB exceptions converted to ++ a Python exception, or PY_BT_OK on success. */ ++ ++static enum py_bt_status ++py_print_args (PyObject *filter, ++ struct ui_out *out, ++ enum py_frame_args args_type, ++ struct frame_info *frame) ++{ ++ PyObject *args_iter = get_py_iter_from_func (filter, "frame_args"); ++ struct cleanup *old_chain = make_cleanup_py_xdecref (args_iter); ++ volatile struct gdb_exception except; ++ ++ if (args_iter == NULL) ++ goto args_error; ++ ++ make_cleanup_ui_out_list_begin_end (out, "args"); ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_args (); ++ if (! ui_out_is_mi_like_p (out)) ++ ui_out_text (out, " ("); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto args_error; ++ } ++ ++ if (args_iter != Py_None) ++ if (enumerate_args (args_iter, out, args_type, 0, frame) == PY_BT_ERROR) ++ goto args_error; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ if (! ui_out_is_mi_like_p (out)) ++ ui_out_text (out, ")"); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto args_error; ++ } ++ ++ do_cleanups (old_chain); ++ return PY_BT_OK; ++ ++ args_error: ++ do_cleanups (old_chain); ++ return PY_BT_ERROR; ++} ++ ++/* Print a single frame to the designated output stream, detecting ++ whether the output is MI or console, and formatting the output ++ according to the conventions of that protocol. FILTER is the ++ frame-filter associated with this frame. FLAGS is an integer ++ describing the various print options. The FLAGS variables is ++ described in "apply_frame_filter" function. ARGS_TYPE is an ++ enumerator describing the argument format. OUT is the output ++ stream to print, INDENT is the level of indention for this frame ++ (in the case of elided frames), and LEVELS_PRINTED is a hash-table ++ containing all the frames level that have already been printed. ++ If a frame level has been printed, do not print it again (in the ++ case of elided frames). Returns PY_BT_ERROR on error, with any ++ GDB exceptions converted to a Python exception, or PY_BT_COMPLETED ++ on success. */ ++ ++static enum py_bt_status ++py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type, ++ struct ui_out *out, int indent, htab_t levels_printed) ++{ ++ int has_addr = 0; ++ CORE_ADDR address = 0; ++ struct gdbarch *gdbarch = NULL; ++ struct frame_info *frame = NULL; ++ struct cleanup *cleanup_stack = make_cleanup (null_cleanup, NULL); ++ struct value_print_options opts; ++ PyObject *py_inf_frame, *elided; ++ int print_level, print_frame_info, print_args, print_locals; ++ volatile struct gdb_exception except; ++ ++ /* Extract print settings from FLAGS. */ ++ print_level = (flags & PRINT_LEVEL) ? 1 : 0; ++ print_frame_info = (flags & PRINT_FRAME_INFO) ? 1 : 0; ++ print_args = (flags & PRINT_ARGS) ? 1 : 0; ++ print_locals = (flags & PRINT_LOCALS) ? 1 : 0; ++ ++ get_user_print_options (&opts); ++ ++ /* Get the underlying frame. This is needed to determine GDB ++ architecture, and also, in the cases of frame variables/arguments to ++ read them if they returned filter object requires us to do so. */ ++ py_inf_frame = PyObject_CallMethod (filter, "inferior_frame", NULL); ++ if (py_inf_frame == NULL) ++ goto error; ++ ++ frame = frame_object_to_frame_info (py_inf_frame);; ++ ++ Py_DECREF (py_inf_frame); ++ ++ if (frame == NULL) ++ goto error; ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ gdbarch = get_frame_arch (frame); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ ++ /* stack-list-variables. */ ++ if (print_locals && print_args && ! print_frame_info) ++ { ++ if (py_mi_print_variables (filter, out, &opts, ++ args_type, frame) == PY_BT_ERROR) ++ goto error; ++ else ++ { ++ do_cleanups (cleanup_stack); ++ return PY_BT_COMPLETED; ++ } ++ } ++ ++ /* -stack-list-locals does not require a ++ wrapping frame attribute. */ ++ if (print_frame_info || (print_args && ! print_locals)) ++ make_cleanup_ui_out_tuple_begin_end (out, "frame"); ++ ++ if (print_frame_info) ++ { ++ /* Elided frames are also printed with this function (recursively) ++ and are printed with indention. */ ++ if (indent > 0) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_spaces (out, indent*4); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ /* The address is required for frame annotations, and also for ++ address printing. */ ++ if (PyObject_HasAttrString (filter, "address")) ++ { ++ PyObject *paddr = PyObject_CallMethod (filter, "address", NULL); ++ if (paddr != NULL) ++ { ++ if (paddr != Py_None) ++ { ++ address = PyLong_AsLong (paddr); ++ has_addr = 1; ++ } ++ Py_DECREF (paddr); ++ } ++ else ++ goto error; ++ } ++ } ++ ++ /* Print frame level. MI does not require the level if ++ locals/variables only are being printed. */ ++ if ((print_frame_info || print_args) && print_level) ++ { ++ struct frame_info **slot; ++ int level; ++ volatile struct gdb_exception except; ++ ++ slot = (struct frame_info **) htab_find_slot (levels_printed, ++ frame, INSERT); ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ level = frame_relative_level (frame); ++ ++ /* Check if this frame has already been printed (there are cases ++ where elided synthetic dummy-frames have to 'borrow' the frame ++ architecture from the eliding frame. If that is the case, do ++ not print 'level', but print spaces. */ ++ if (*slot == frame) ++ ui_out_field_skip (out, "level"); ++ else ++ { ++ *slot = frame; ++ annotate_frame_begin (print_level ? level : 0, ++ gdbarch, address); ++ ui_out_text (out, "#"); ++ ui_out_field_fmt_int (out, 2, ui_left, "level", ++ level); ++ } ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ if (print_frame_info) ++ { ++ /* Print address to the address field. If an address is not provided, ++ print nothing. */ ++ if (opts.addressprint && has_addr) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_address (); ++ ui_out_field_core_addr (out, "addr", gdbarch, address); ++ annotate_frame_address_end (); ++ ui_out_text (out, " in "); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ /* Print frame function name. */ ++ if (PyObject_HasAttrString (filter, "function")) ++ { ++ PyObject *py_func = PyObject_CallMethod (filter, "function", NULL); ++ ++ if (py_func != NULL) ++ { ++ const char *function = NULL; ++ ++ if (gdbpy_is_string (py_func)) ++ { ++ function = PyString_AsString (py_func); ++ ++ if (function == NULL) ++ { ++ Py_DECREF (py_func); ++ goto error; ++ } ++ } ++ else if (PyLong_Check (py_func)) ++ { ++ CORE_ADDR addr = PyLong_AsUnsignedLongLong (py_func); ++ struct minimal_symbol *msymbol; ++ ++ if (PyErr_Occurred ()) ++ goto error; ++ ++ msymbol = lookup_minimal_symbol_by_pc (addr); ++ if (msymbol != NULL) ++ function = SYMBOL_PRINT_NAME (msymbol); ++ } ++ else if (py_func != Py_None) ++ { ++ PyErr_SetString (PyExc_RuntimeError, ++ _("FrameDecorator.function: expecting a " \ ++ "String, integer or None.")); ++ Py_DECREF (py_func); ++ goto error; ++ } ++ ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_function_name (); ++ if (function == NULL) ++ ui_out_field_skip (out, "func"); ++ else ++ ui_out_field_string (out, "func", function); ++ } ++ if (except.reason < 0) ++ { ++ Py_DECREF (py_func); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ Py_DECREF (py_func); ++ } ++ else ++ goto error; ++ } ++ ++ ++ /* Frame arguments. Check the result, and error if something went ++ wrong. */ ++ if (print_args) ++ { ++ if (py_print_args (filter, out, args_type, frame) == PY_BT_ERROR) ++ goto error; ++ } ++ ++ /* File name/source/line number information. */ ++ if (print_frame_info) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_source_begin (); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ if (PyObject_HasAttrString (filter, "filename")) ++ { ++ PyObject *py_fn = PyObject_CallMethod (filter, "filename", ++ NULL); ++ if (py_fn != NULL) ++ { ++ if (py_fn != Py_None) ++ { ++ char *filename = PyString_AsString (py_fn); ++ ++ if (filename == NULL) ++ { ++ Py_DECREF (py_fn); ++ goto error; ++ } ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_wrap_hint (out, " "); ++ ui_out_text (out, " at "); ++ annotate_frame_source_file (); ++ ui_out_field_string (out, "file", filename); ++ annotate_frame_source_file_end (); ++ } ++ if (except.reason < 0) ++ { ++ Py_DECREF (py_fn); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ Py_DECREF (py_fn); ++ } ++ else ++ goto error; ++ } ++ ++ if (PyObject_HasAttrString (filter, "line")) ++ { ++ PyObject *py_line = PyObject_CallMethod (filter, "line", NULL); ++ int line; ++ ++ if (py_line != NULL) ++ { ++ if (py_line != Py_None) ++ { ++ line = PyLong_AsLong (py_line); ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ ui_out_text (out, ":"); ++ annotate_frame_source_line (); ++ ui_out_field_int (out, "line", line); ++ } ++ if (except.reason < 0) ++ { ++ Py_DECREF (py_line); ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ Py_DECREF (py_line); ++ } ++ else ++ goto error; ++ } ++ } ++ ++ /* For MI we need to deal with the "children" list population of ++ elided frames, so if MI output detected do not send newline. */ ++ if (! ui_out_is_mi_like_p (out)) ++ { ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ annotate_frame_end (); ++ ui_out_text (out, "\n"); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ } ++ ++ if (print_locals) ++ { ++ if (py_print_locals (filter, out, args_type, indent, ++ frame) == PY_BT_ERROR) ++ goto error; ++ } ++ ++ /* Finally recursively print elided frames, if any. */ ++ elided = get_py_iter_from_func (filter, "elided"); ++ if (elided == NULL) ++ goto error; ++ ++ make_cleanup_py_decref (elided); ++ if (elided != Py_None) ++ { ++ PyObject *item; ++ ++ make_cleanup_ui_out_list_begin_end (out, "children"); ++ ++ if (! ui_out_is_mi_like_p (out)) ++ indent++; ++ ++ while ((item = PyIter_Next (elided))) ++ { ++ enum py_bt_status success = py_print_frame (item, flags, ++ args_type, out, ++ indent, ++ levels_printed); ++ ++ if (success == PY_BT_ERROR) ++ { ++ Py_DECREF (item); ++ goto error; ++ } ++ ++ Py_DECREF (item); ++ } ++ if (item == NULL && PyErr_Occurred ()) ++ goto error; ++ } ++ ++ ++ do_cleanups (cleanup_stack); ++ return PY_BT_COMPLETED; ++ ++ error: ++ do_cleanups (cleanup_stack); ++ return PY_BT_ERROR; ++} ++ ++/* Helper function to initiate frame filter invocation at starting ++ frame FRAME. */ ++ ++static PyObject * ++bootstrap_python_frame_filters (struct frame_info *frame, ++ int frame_low, int frame_high) ++{ ++ struct cleanup *cleanups = ++ make_cleanup (null_cleanup, NULL); ++ PyObject *module, *sort_func, *iterable, *frame_obj, *iterator; ++ PyObject *py_frame_low, *py_frame_high; ++ ++ frame_obj = frame_info_to_frame_object (frame); ++ if (frame_obj == NULL) ++ goto error; ++ make_cleanup_py_decref (frame_obj); ++ ++ module = PyImport_ImportModule ("gdb.frames"); ++ if (module == NULL) ++ goto error; ++ make_cleanup_py_decref (module); ++ ++ sort_func = PyObject_GetAttrString (module, "execute_frame_filters"); ++ if (sort_func == NULL) ++ goto error; ++ make_cleanup_py_decref (sort_func); ++ ++ py_frame_low = PyInt_FromLong (frame_low); ++ if (py_frame_low == NULL) ++ goto error; ++ make_cleanup_py_decref (py_frame_low); ++ ++ py_frame_high = PyInt_FromLong (frame_high); ++ if (py_frame_high == NULL) ++ goto error; ++ make_cleanup_py_decref (py_frame_high); ++ ++ iterable = PyObject_CallFunctionObjArgs (sort_func, frame_obj, ++ py_frame_low, ++ py_frame_high, ++ NULL); ++ if (iterable == NULL) ++ goto error; ++ ++ do_cleanups (cleanups); ++ ++ if (iterable != Py_None) ++ { ++ iterator = PyObject_GetIter (iterable); ++ Py_DECREF (iterable); ++ } ++ else ++ { ++ return iterable; ++ } ++ ++ return iterator; ++ ++ error: ++ do_cleanups (cleanups); ++ return NULL; ++} ++ ++/* This is the only publicly exported function in this file. FRAME ++ is the source frame to start frame-filter invocation. FLAGS is an ++ integer holding the flags for printing. The following elements of ++ the FRAME_FILTER_FLAGS enum denotes the make-up of FLAGS: ++ PRINT_LEVEL is a flag indicating whether to print the frame's ++ relative level in the output. PRINT_FRAME_INFO is a flag that ++ indicates whether this function should print the frame ++ information, PRINT_ARGS is a flag that indicates whether to print ++ frame arguments, and PRINT_LOCALS, likewise, with frame local ++ variables. ARGS_TYPE is an enumerator describing the argument ++ format, OUT is the output stream to print. FRAME_LOW is the ++ beginning of the slice of frames to print, and FRAME_HIGH is the ++ upper limit of the frames to count. Returns PY_BT_ERROR on error, ++ or PY_BT_COMPLETED on success.*/ ++ ++enum py_bt_status ++apply_frame_filter (struct frame_info *frame, int flags, ++ enum py_frame_args args_type, ++ struct ui_out *out, int frame_low, ++ int frame_high) ++ ++{ ++ struct gdbarch *gdbarch = NULL; ++ struct cleanup *cleanups; ++ enum py_bt_status success = PY_BT_ERROR; ++ PyObject *iterable; ++ volatile struct gdb_exception except; ++ PyObject *item; ++ htab_t levels_printed; ++ ++ cleanups = ensure_python_env (gdbarch, current_language); ++ ++ TRY_CATCH (except, RETURN_MASK_ALL) ++ { ++ gdbarch = get_frame_arch (frame); ++ } ++ if (except.reason < 0) ++ { ++ gdbpy_convert_exception (except); ++ goto error; ++ } ++ ++ iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high); ++ ++ if (iterable == NULL) ++ goto error; ++ ++ /* If iterable is None, then there are no frame filters registered. ++ If this is the case, defer to default GDB printing routines in MI ++ and CLI. */ ++ make_cleanup_py_decref (iterable); ++ if (iterable == Py_None) ++ { ++ success = PY_BT_NO_FILTERS; ++ goto done; ++ } ++ ++ levels_printed = htab_create (20, ++ htab_hash_pointer, ++ htab_eq_pointer, ++ NULL); ++ make_cleanup_htab_delete (levels_printed); ++ ++ while ((item = PyIter_Next (iterable))) ++ { ++ success = py_print_frame (item, flags, args_type, out, 0, ++ levels_printed); ++ ++ /* Do not exit on error printing a single frame. Print the ++ error and continue with other frames. */ ++ if (success == PY_BT_ERROR) ++ gdbpy_print_stack (); ++ ++ Py_DECREF (item); ++ } ++ ++ if (item == NULL && PyErr_Occurred ()) ++ goto error; ++ ++ done: ++ do_cleanups (cleanups); ++ return success; ++ ++ error: ++ gdbpy_print_stack (); ++ do_cleanups (cleanups); ++ return PY_BT_ERROR; ++} +Index: gdb-7.6/gdb/python/py-objfile.c +=================================================================== +--- gdb-7.6.orig/gdb/python/py-objfile.c 2013-06-10 14:31:02.731084652 +0200 ++++ gdb-7.6/gdb/python/py-objfile.c 2013-06-10 14:31:08.366082437 +0200 +@@ -33,6 +33,8 @@ typedef struct + /* The pretty-printer list of functions. */ + PyObject *printers; + ++ /* The frame filter list of functions. */ ++ PyObject *frame_filters; + /* The type-printer list. */ + PyObject *type_printers; + } objfile_object; +@@ -61,6 +63,7 @@ objfpy_dealloc (PyObject *o) + objfile_object *self = (objfile_object *) o; + + Py_XDECREF (self->printers); ++ Py_XDECREF (self->frame_filters); + Py_XDECREF (self->type_printers); + Py_TYPE (self)->tp_free (self); + } +@@ -81,6 +84,13 @@ objfpy_new (PyTypeObject *type, PyObject + return NULL; + } + ++ self->frame_filters = PyDict_New (); ++ if (!self->frame_filters) ++ { ++ Py_DECREF (self); ++ return NULL; ++ } ++ + self->type_printers = PyList_New (0); + if (!self->type_printers) + { +@@ -129,6 +139,47 @@ objfpy_set_printers (PyObject *o, PyObje + return 0; + } + ++/* Return the Python dictionary attribute containing frame filters for ++ this object file. */ ++PyObject * ++objfpy_get_frame_filters (PyObject *o, void *ignore) ++{ ++ objfile_object *self = (objfile_object *) o; ++ ++ Py_INCREF (self->frame_filters); ++ return self->frame_filters; ++} ++ ++/* Set this object file's frame filters dictionary to FILTERS. */ ++static int ++objfpy_set_frame_filters (PyObject *o, PyObject *filters, void *ignore) ++{ ++ PyObject *tmp; ++ objfile_object *self = (objfile_object *) o; ++ ++ if (! filters) ++ { ++ PyErr_SetString (PyExc_TypeError, ++ _("Cannot delete the frame filters attribute.")); ++ return -1; ++ } ++ ++ if (! PyDict_Check (filters)) ++ { ++ PyErr_SetString (PyExc_TypeError, ++ _("The frame_filters attribute must be a dictionary.")); ++ return -1; ++ } ++ ++ /* Take care in case the LHS and RHS are related somehow. */ ++ tmp = self->frame_filters; ++ Py_INCREF (filters); ++ self->frame_filters = filters; ++ Py_XDECREF (tmp); ++ ++ return 0; ++} ++ + /* Get the 'type_printers' attribute. */ + + static PyObject * +@@ -225,6 +276,13 @@ objfile_to_objfile_object (struct objfil + return NULL; + } + ++ object->frame_filters = PyDict_New (); ++ if (!object->frame_filters) ++ { ++ Py_DECREF (object); ++ return NULL; ++ } ++ + object->type_printers = PyList_New (0); + if (!object->type_printers) + { +@@ -270,6 +328,8 @@ static PyGetSetDef objfile_getset[] = + "The objfile's filename, or None.", NULL }, + { "pretty_printers", objfpy_get_printers, objfpy_set_printers, + "Pretty printers.", NULL }, ++ { "frame_filters", objfpy_get_frame_filters, ++ objfpy_set_frame_filters, "Frame Filters.", NULL }, + { "type_printers", objfpy_get_type_printers, objfpy_set_type_printers, + "Type printers.", NULL }, + { NULL } +Index: gdb-7.6/gdb/python/py-progspace.c +=================================================================== +--- gdb-7.6.orig/gdb/python/py-progspace.c 2013-06-10 14:31:02.731084652 +0200 ++++ gdb-7.6/gdb/python/py-progspace.c 2013-06-10 14:31:08.366082437 +0200 +@@ -35,6 +35,8 @@ typedef struct + /* The pretty-printer list of functions. */ + PyObject *printers; + ++ /* The frame filter list of functions. */ ++ PyObject *frame_filters; + /* The type-printer list. */ + PyObject *type_printers; + } pspace_object; +@@ -69,6 +71,7 @@ pspy_dealloc (PyObject *self) + pspace_object *ps_self = (pspace_object *) self; + + Py_XDECREF (ps_self->printers); ++ Py_XDECREF (ps_self->frame_filters); + Py_XDECREF (ps_self->type_printers); + Py_TYPE (self)->tp_free (self); + } +@@ -89,6 +92,13 @@ pspy_new (PyTypeObject *type, PyObject * + return NULL; + } + ++ self->frame_filters = PyDict_New (); ++ if (!self->frame_filters) ++ { ++ Py_DECREF (self); ++ return NULL; ++ } ++ + self->type_printers = PyList_New (0); + if (!self->type_printers) + { +@@ -137,6 +147,47 @@ pspy_set_printers (PyObject *o, PyObject + return 0; + } + ++/* Return the Python dictionary attribute containing frame filters for ++ this program space. */ ++PyObject * ++pspy_get_frame_filters (PyObject *o, void *ignore) ++{ ++ pspace_object *self = (pspace_object *) o; ++ ++ Py_INCREF (self->frame_filters); ++ return self->frame_filters; ++} ++ ++/* Set this object file's frame filters dictionary to FILTERS. */ ++static int ++pspy_set_frame_filters (PyObject *o, PyObject *frame, void *ignore) ++{ ++ PyObject *tmp; ++ pspace_object *self = (pspace_object *) o; ++ ++ if (! frame) ++ { ++ PyErr_SetString (PyExc_TypeError, ++ "cannot delete the frame filter attribute"); ++ return -1; ++ } ++ ++ if (! PyDict_Check (frame)) ++ { ++ PyErr_SetString (PyExc_TypeError, ++ "the frame filter attribute must be a dictionary"); ++ return -1; ++ } ++ ++ /* Take care in case the LHS and RHS are related somehow. */ ++ tmp = self->frame_filters; ++ Py_INCREF (frame); ++ self->frame_filters = frame; ++ Py_XDECREF (tmp); ++ ++ return 0; ++} ++ + /* Get the 'type_printers' attribute. */ + + static PyObject * +@@ -221,6 +272,13 @@ pspace_to_pspace_object (struct program_ + return NULL; + } + ++ object->frame_filters = PyDict_New (); ++ if (!object->frame_filters) ++ { ++ Py_DECREF (object); ++ return NULL; ++ } ++ + object->type_printers = PyList_New (0); + if (!object->type_printers) + { +@@ -257,6 +315,8 @@ static PyGetSetDef pspace_getset[] = + "The progspace's main filename, or None.", NULL }, + { "pretty_printers", pspy_get_printers, pspy_set_printers, + "Pretty printers.", NULL }, ++ { "frame_filters", pspy_get_frame_filters, pspy_set_frame_filters, ++ "Frame filters.", NULL }, + { "type_printers", pspy_get_type_printers, pspy_set_type_printers, + "Type printers.", NULL }, + { NULL } +Index: gdb-7.6/gdb/python/py-utils.c +=================================================================== +--- gdb-7.6.orig/gdb/python/py-utils.c 2013-06-10 14:31:02.732084652 +0200 ++++ gdb-7.6/gdb/python/py-utils.c 2013-06-10 14:31:08.366082437 +0200 +@@ -48,6 +48,28 @@ make_cleanup_py_decref (PyObject *py) + return make_cleanup (py_decref, (void *) py); + } + ++/* This is a cleanup function which decrements the refcount on a ++ Python object. This function accounts appropriately for NULL ++ references. */ ++ ++static void ++py_xdecref (void *p) ++{ ++ PyObject *py = p; ++ ++ Py_XDECREF (py); ++} ++ ++/* Return a new cleanup which will decrement the Python object's ++ refcount when run. Account for and operate on NULL references ++ correctly. */ ++ ++struct cleanup * ++make_cleanup_py_xdecref (PyObject *py) ++{ ++ return make_cleanup (py_xdecref, py); ++} ++ + /* Converts a Python 8-bit string to a unicode string object. Assumes the + 8-bit string is in the host charset. If an error occurs during conversion, + returns NULL with a python exception set. +Index: gdb-7.6/gdb/python/python-internal.h +=================================================================== +--- gdb-7.6.orig/gdb/python/python-internal.h 2013-06-10 14:31:02.732084652 +0200 ++++ gdb-7.6/gdb/python/python-internal.h 2013-06-10 14:31:08.367082436 +0200 +@@ -251,9 +251,11 @@ PyObject *frame_info_to_frame_object (st + + PyObject *pspace_to_pspace_object (struct program_space *); + PyObject *pspy_get_printers (PyObject *, void *); ++PyObject *pspy_get_frame_filters (PyObject *, void *); + + PyObject *objfile_to_objfile_object (struct objfile *); + PyObject *objfpy_get_printers (PyObject *, void *); ++PyObject *objfpy_get_frame_filters (PyObject *, void *); + + PyObject *gdbarch_to_arch_object (struct gdbarch *gdbarch); + +@@ -304,6 +306,7 @@ void gdbpy_initialize_new_objfile_event + void gdbpy_initialize_arch (void); + + struct cleanup *make_cleanup_py_decref (PyObject *py); ++struct cleanup *make_cleanup_py_xdecref (PyObject *py); + + struct cleanup *ensure_python_env (struct gdbarch *gdbarch, + const struct language_defn *language); +Index: gdb-7.6/gdb/python/python.c +=================================================================== +--- gdb-7.6.orig/gdb/python/python.c 2013-06-10 14:31:02.732084652 +0200 ++++ gdb-7.6/gdb/python/python.c 2013-06-10 14:31:08.367082436 +0200 +@@ -1442,6 +1442,15 @@ free_type_printers (void *arg) + { + } + ++enum py_bt_status ++apply_frame_filter (struct frame_info *frame, int flags, ++ enum py_frame_args args_type, ++ struct ui_out *out, int frame_low, ++ int frame_high) ++{ ++ return PY_BT_NO_FILTERS; ++} ++ + #endif /* HAVE_PYTHON */ + + +Index: gdb-7.6/gdb/python/python.h +=================================================================== +--- gdb-7.6.orig/gdb/python/python.h 2013-06-10 14:31:02.732084652 +0200 ++++ gdb-7.6/gdb/python/python.h 2013-06-10 14:31:08.367082436 +0200 +@@ -21,6 +21,7 @@ + #define GDB_PYTHON_H + + #include "value.h" ++#include "mi/mi-cmds.h" + + struct breakpoint_object; + +@@ -28,6 +29,66 @@ struct breakpoint_object; + E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */ + #define GDBPY_AUTO_FILE_NAME "-gdb.py" + ++/* Python frame-filter status return values. */ ++enum py_bt_status ++ { ++ /* Return when an error has occurred in processing frame filters, ++ or when printing the stack. */ ++ PY_BT_ERROR = -1, ++ ++ /* Return from internal routines to indicate that the function ++ succeeded. */ ++ PY_BT_OK = 1, ++ ++ /* Return when the frame filter process is complete, and all ++ operations have succeeded. */ ++ PY_BT_COMPLETED = 2, ++ ++ /* Return when the frame filter process is complete, but there ++ were no filter registered and enabled to process. */ ++ PY_BT_NO_FILTERS = 3 ++ }; ++ ++/* Flags to pass to apply_frame_filter. */ ++ ++enum frame_filter_flags ++ { ++ /* Set this flag if frame level is to be printed. */ ++ PRINT_LEVEL = 1, ++ ++ /* Set this flag if frame information is to be printed. */ ++ PRINT_FRAME_INFO = 2, ++ ++ /* Set this flag if frame arguments are to be printed. */ ++ PRINT_ARGS = 4, ++ ++ /* Set this flag if frame locals are to be printed. */ ++ PRINT_LOCALS = 8, ++ }; ++ ++/* A choice of the different frame argument printing strategies that ++ can occur in different cases of frame filter instantiation. */ ++typedef enum py_frame_args ++{ ++ /* Print no values for arguments when invoked from the MI. */ ++ NO_VALUES = PRINT_NO_VALUES, ++ ++ MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES, ++ ++ /* Print only simple values (what MI defines as "simple") for ++ arguments when invoked from the MI. */ ++ MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES, ++ ++ ++ /* Print only scalar values for arguments when invoked from the ++ CLI. */ ++ CLI_SCALAR_VALUES, ++ ++ /* Print all values for arguments when invoked from the ++ CLI. */ ++ CLI_ALL_VALUES ++} py_frame_args; ++ + extern void finish_python_initialization (void); + + void eval_python_from_control_command (struct command_line *); +@@ -43,6 +104,11 @@ int apply_val_pretty_printer (struct typ + const struct value_print_options *options, + const struct language_defn *language); + ++enum py_bt_status apply_frame_filter (struct frame_info *frame, int flags, ++ enum py_frame_args args_type, ++ struct ui_out *out, int frame_low, ++ int frame_high); ++ + void preserve_python_values (struct objfile *objfile, htab_t copied_types); + + void gdbpy_load_auto_scripts_for_objfile (struct objfile *objfile); +Index: gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py 2013-06-10 14:31:08.367082436 +0200 +@@ -0,0 +1,285 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 FrameDecorator(object): ++ """Basic implementation of a Frame Decorator""" ++ ++ """ This base frame decorator decorates a frame or another frame ++ decorator, and provides convenience methods. If this object is ++ wrapping a frame decorator, defer to that wrapped object's method ++ if it has one. This allows for frame decorators that have ++ sub-classed FrameDecorator object, but also wrap other frame ++ decorators on the same frame to correctly execute. ++ ++ E.g ++ ++ If the result of frame filters running means we have one gdb.Frame ++ wrapped by multiple frame decorators, all sub-classed from ++ FrameDecorator, the resulting hierarchy will be: ++ ++ Decorator1 ++ -- (wraps) Decorator2 ++ -- (wraps) FrameDecorator ++ -- (wraps) gdb.Frame ++ ++ In this case we have two frame decorators, both of which are ++ sub-classed from FrameDecorator. If Decorator1 just overrides the ++ 'function' method, then all of the other methods are carried out ++ by the super-class FrameDecorator. But Decorator2 may have ++ overriden other methods, so FrameDecorator will look at the ++ 'base' parameter and defer to that class's methods. And so on, ++ down the chain.""" ++ ++ # 'base' can refer to a gdb.Frame or another frame decorator. In ++ # the latter case, the child class will have called the super ++ # method and _base will be an object conforming to the Frame Filter ++ # class. ++ def __init__(self, base): ++ self._base = base ++ ++ @staticmethod ++ def _is_limited_frame(frame): ++ """Internal utility to determine if the frame is special or ++ limited.""" ++ sal = frame.find_sal() ++ ++ if (not sal.symtab or not sal.symtab.filename ++ or frame.type() == gdb.DUMMY_FRAME ++ or frame.type() == gdb.SIGTRAMP_FRAME): ++ ++ return True ++ ++ return False ++ ++ def elided(self): ++ """Return any elided frames that this class might be ++ wrapping, or None.""" ++ if hasattr(self._base, "elided"): ++ return self._base.elided() ++ ++ return None ++ ++ def function(self): ++ """ Return the name of the frame's function or an address of ++ the function of the frame. First determine if this is a ++ special frame. If not, try to determine filename from GDB's ++ frame internal function API. Finally, if a name cannot be ++ determined return the address. If this function returns an ++ address, GDB will attempt to determine the function name from ++ its internal minimal symbols store (for example, for inferiors ++ without debug-info).""" ++ ++ # Both gdb.Frame, and FrameDecorator have a method called ++ # "function", so determine which object this is. ++ if not isinstance(self._base, gdb.Frame): ++ if hasattr(self._base, "function"): ++ # If it is not a gdb.Frame, and there is already a ++ # "function" method, use that. ++ return self._base.function() ++ ++ frame = self.inferior_frame() ++ ++ if frame.type() == gdb.DUMMY_FRAME: ++ return "" ++ elif frame.type() == gdb.SIGTRAMP_FRAME: ++ return "" ++ ++ func = frame.function() ++ ++ # If we cannot determine the function name, return the ++ # address. If GDB detects an integer value from this function ++ # it will attempt to find the function name from minimal ++ # symbols via its own internal functions. ++ if func == None: ++ pc = frame.pc() ++ return pc ++ ++ return str(func) ++ ++ def address(self): ++ """ Return the address of the frame's pc""" ++ ++ if hasattr(self._base, "address"): ++ return self._base.address() ++ ++ frame = self.inferior_frame() ++ return frame.pc() ++ ++ def filename(self): ++ """ Return the filename associated with this frame, detecting ++ and returning the appropriate library name is this is a shared ++ library.""" ++ ++ if hasattr(self._base, "filename"): ++ return self._base.filename() ++ ++ frame = self.inferior_frame() ++ sal = frame.find_sal() ++ if not sal.symtab or not sal.symtab.filename: ++ pc = frame.pc() ++ return gdb.solib_name(pc) ++ else: ++ return sal.symtab.filename ++ ++ def frame_args(self): ++ """ Return an iterable of frame arguments for this frame, if ++ any. The iterable object contains objects conforming with the ++ Symbol/Value interface. If there are no frame arguments, or ++ if this frame is deemed to be a special case, return None.""" ++ ++ if hasattr(self._base, "frame_args"): ++ return self._base.frame_args() ++ ++ frame = self.inferior_frame() ++ if self._is_limited_frame(frame): ++ return None ++ ++ args = FrameVars(frame) ++ return args.fetch_frame_args() ++ ++ def frame_locals(self): ++ """ Return an iterable of local variables for this frame, if ++ any. The iterable object contains objects conforming with the ++ Symbol/Value interface. If there are no frame locals, or if ++ this frame is deemed to be a special case, return None.""" ++ ++ if hasattr(self._base, "frame_locals"): ++ return self._base.frame_locals() ++ ++ frame = self.inferior_frame() ++ if self._is_limited_frame(frame): ++ return None ++ ++ args = FrameVars(frame) ++ return args.fetch_frame_locals() ++ ++ def line(self): ++ """ Return line number information associated with the frame's ++ pc. If symbol table/line information does not exist, or if ++ this frame is deemed to be a special case, return None""" ++ ++ if hasattr(self._base, "line"): ++ return self._base.line() ++ ++ frame = self.inferior_frame() ++ if self._is_limited_frame(frame): ++ return None ++ ++ sal = frame.find_sal() ++ if (sal): ++ return sal.line ++ else: ++ return None ++ ++ def inferior_frame(self): ++ """ Return the gdb.Frame underpinning this frame decorator.""" ++ ++ # If 'base' is a frame decorator, we want to call its inferior ++ # frame method. If '_base' is a gdb.Frame, just return that. ++ if hasattr(self._base, "inferior_frame"): ++ return self._base.inferior_frame() ++ return self._base ++ ++class SymValueWrapper(object): ++ """A container class conforming to the Symbol/Value interface ++ which holds frame locals or frame arguments.""" ++ def __init__(self, symbol, value): ++ self.sym = symbol ++ self.val = value ++ ++ def value(self): ++ """ Return the value associated with this symbol, or None""" ++ return self.val ++ ++ def symbol(self): ++ """ Return the symbol, or Python text, associated with this ++ symbol, or None""" ++ return self.sym ++ ++class FrameVars(object): ++ ++ """Utility class to fetch and store frame local variables, or ++ frame arguments.""" ++ ++ def __init__(self, frame): ++ self.frame = frame ++ self.symbol_class = { ++ gdb.SYMBOL_LOC_STATIC: True, ++ gdb.SYMBOL_LOC_REGISTER: True, ++ gdb.SYMBOL_LOC_ARG: True, ++ gdb.SYMBOL_LOC_REF_ARG: True, ++ gdb.SYMBOL_LOC_LOCAL: True, ++ gdb.SYMBOL_LOC_REGPARM_ADDR: True, ++ gdb.SYMBOL_LOC_COMPUTED: True ++ } ++ ++ def fetch_b(self, sym): ++ """ Local utility method to determine if according to Symbol ++ type whether it should be included in the iterator. Not all ++ symbols are fetched, and only symbols that return ++ True from this method should be fetched.""" ++ ++ # SYM may be a string instead of a symbol in the case of ++ # synthetic local arguments or locals. If that is the case, ++ # always fetch. ++ if isinstance(sym, basestring): ++ return True ++ ++ sym_type = sym.addr_class ++ ++ return self.symbol_class.get(sym_type, False) ++ ++ def fetch_frame_locals(self): ++ """Public utility method to fetch frame local variables for ++ the stored frame. Frame arguments are not fetched. If there ++ are no frame local variables, return an empty list.""" ++ lvars = [] ++ ++ block = self.frame.block() ++ ++ while block != None: ++ if block.is_global or block.is_static: ++ break ++ for sym in block: ++ if sym.is_argument: ++ continue; ++ if self.fetch_b(sym): ++ lvars.append(SymValueWrapper(sym, None)) ++ ++ block = block.superblock ++ ++ return lvars ++ ++ def fetch_frame_args(self): ++ """Public utility method to fetch frame arguments for the ++ stored frame. Frame arguments are the only type fetched. If ++ there are no frame argument variables, return an empty list.""" ++ ++ args = [] ++ block = self.frame.block() ++ while block != None: ++ if block.function != None: ++ break ++ block = block.superblock ++ ++ if block != None: ++ for sym in block: ++ if not sym.is_argument: ++ continue; ++ args.append(SymValueWrapper(sym, None)) ++ ++ return args +Index: gdb-7.6/gdb/python/lib/gdb/FrameIterator.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/python/lib/gdb/FrameIterator.py 2013-06-10 14:31:08.367082436 +0200 +@@ -0,0 +1,45 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 ++ ++class FrameIterator(object): ++ """A gdb.Frame iterator. Iterates over gdb.Frames or objects that ++ conform to that interface.""" ++ ++ def __init__(self, frame_obj): ++ """Initialize a FrameIterator. ++ ++ Arguments: ++ frame_obj the starting frame.""" ++ ++ super(FrameIterator, self).__init__() ++ self.frame = frame_obj ++ ++ def __iter__(self): ++ return self ++ ++ def next(self): ++ """next implementation. ++ ++ Returns: ++ The next oldest frame.""" ++ ++ result = self.frame ++ if result is None: ++ raise StopIteration ++ self.frame = result.older() ++ return result +Index: gdb-7.6/gdb/python/lib/gdb/frames.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/python/lib/gdb/frames.py 2013-06-10 14:31:08.368082436 +0200 +@@ -0,0 +1,229 @@ ++# Frame-filter commands. ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++"""Internal functions for working with frame-filters.""" ++ ++import gdb ++from gdb.FrameIterator import FrameIterator ++from gdb.FrameDecorator import FrameDecorator ++import itertools ++import collections ++ ++def get_priority(filter_item): ++ """ Internal worker function to return the frame-filter's priority ++ from a frame filter object. This is a fail free function as it is ++ used in sorting and filtering. If a badly implemented frame ++ filter does not implement the priority attribute, return zero ++ (otherwise sorting/filtering will fail and prevent other frame ++ filters from executing). ++ ++ Arguments: ++ filter_item: An object conforming to the frame filter ++ interface. ++ ++ Returns: ++ The priority of the frame filter from the "priority" ++ attribute, or zero. ++ """ ++ # Do not fail here, as the sort will fail. If a filter has not ++ # (incorrectly) set a priority, set it to zero. ++ return getattr(filter_item, "priority", 0) ++ ++def set_priority(filter_item, priority): ++ """ Internal worker function to set the frame-filter's priority. ++ ++ Arguments: ++ filter_item: An object conforming to the frame filter ++ interface. ++ priority: The priority to assign as an integer. ++ """ ++ ++ filter_item.priority = priority ++ ++def get_enabled(filter_item): ++ """ Internal worker function to return a filter's enabled state ++ from a frame filter object. This is a fail free function as it is ++ used in sorting and filtering. If a badly implemented frame ++ filter does not implement the enabled attribute, return False ++ (otherwise sorting/filtering will fail and prevent other frame ++ filters from executing). ++ ++ Arguments: ++ filter_item: An object conforming to the frame filter ++ interface. ++ ++ Returns: ++ The enabled state of the frame filter from the "enabled" ++ attribute, or False. ++ """ ++ ++ # If the filter class is badly implemented when called from the ++ # Python filter command, do not cease filter operations, just set ++ # enabled to False. ++ return getattr(filter_item, "enabled", False) ++ ++def set_enabled(filter_item, state): ++ """ Internal Worker function to set the frame-filter's enabled ++ state. ++ ++ Arguments: ++ filter_item: An object conforming to the frame filter ++ interface. ++ state: True or False, depending on desired state. ++ """ ++ ++ filter_item.enabled = state ++ ++def return_list(name): ++ """ Internal Worker function to return the frame filter ++ dictionary, depending on the name supplied as an argument. If the ++ name is not "all", "global" or "progspace", it is assumed to name ++ an object-file. ++ ++ Arguments: ++ name: The name of the list, as specified by GDB user commands. ++ ++ Returns: ++ A dictionary object for a single specified dictionary, or a ++ list containing all the items for "all" ++ ++ Raises: ++ gdb.GdbError: A dictionary of that name cannot be found. ++ """ ++ ++ # If all dictionaries are wanted in the case of "all" we ++ # cannot return a combined dictionary as keys() may clash in ++ # between different dictionaries. As we just want all the frame ++ # filters to enable/disable them all, just return the combined ++ # items() as a list. ++ if name == "all": ++ all_dicts = gdb.frame_filters.values() ++ all_dicts = all_dicts + gdb.current_progspace().frame_filters.values() ++ for objfile in gdb.objfiles(): ++ all_dicts = all_dicts + objfile.frame_filters.values() ++ return all_dicts ++ ++ if name == "global": ++ return gdb.frame_filters ++ else: ++ if name == "progspace": ++ cp = gdb.current_progspace() ++ return cp.frame_filters ++ else: ++ for objfile in gdb.objfiles(): ++ if name == objfile.filename: ++ return objfile.frame_filters ++ ++ msg = "Cannot find frame-filter dictionary for '" + name + "'" ++ raise gdb.GdbError(msg) ++ ++def _sort_list(): ++ """ Internal Worker function to merge all known frame-filter ++ lists, prune any filters with the state set to "disabled", and ++ sort the list on the frame-filter's "priority" attribute. ++ ++ Returns: ++ sorted_list: A sorted, pruned list of frame filters to ++ execute. ++ """ ++ ++ all_filters = [] ++ for objfile in gdb.objfiles(): ++ all_filters = all_filters + objfile.frame_filters.values() ++ cp = gdb.current_progspace() ++ ++ all_filters = all_filters + cp.frame_filters.values() ++ all_filters = all_filters + gdb.frame_filters.values() ++ ++ sorted_frame_filters = sorted(all_filters, key = get_priority, ++ reverse = True) ++ ++ sorted_frame_filters = filter(get_enabled, ++ sorted_frame_filters) ++ ++ return sorted_frame_filters ++ ++def execute_frame_filters(frame, frame_low, frame_high): ++ """ Internal function called from GDB that will execute the chain ++ of frame filters. Each filter is executed in priority order. ++ After the execution completes, slice the iterator to frame_low - ++ frame_high range. ++ ++ Arguments: ++ frame: The initial frame. ++ ++ frame_low: The low range of the slice. If this is a negative ++ integer then it indicates a backward slice (ie bt -4) which ++ counts backward from the last frame in the backtrace. ++ ++ frame_high: The high range of the slice. If this is -1 then ++ it indicates all frames until the end of the stack from ++ frame_low. ++ ++ Returns: ++ frame_iterator: The sliced iterator after all frame ++ filters have had a change to execute, or None if no frame ++ filters are registered. ++ """ ++ ++ # Get a sorted list of frame filters. ++ sorted_list = _sort_list() ++ ++ # Check to see if there are any frame-filters. If not, just ++ # return None and let default backtrace printing occur. ++ if len(sorted_list) == 0: ++ return None ++ ++ frame_iterator = FrameIterator(frame) ++ ++ # Apply a basic frame decorator to all gdb.Frames. This unifies the ++ # interface. ++ frame_iterator = itertools.imap(FrameDecorator, frame_iterator) ++ ++ for ff in sorted_list: ++ frame_iterator = ff.filter(frame_iterator) ++ ++ # Slicing ++ ++ # Is this a slice from the end of the backtrace, ie bt -2? ++ if frame_low < 0: ++ count = 0 ++ slice_length = abs(frame_low) ++ # We cannot use MAXLEN argument for deque as it is 2.6 onwards ++ # and some GDB versions might be < 2.6. ++ sliced = collections.deque() ++ ++ for frame_item in frame_iterator: ++ if count >= slice_length: ++ sliced.popleft(); ++ count = count + 1 ++ sliced.append(frame_item) ++ ++ return iter(sliced) ++ ++ # -1 for frame_high means until the end of the backtrace. Set to ++ # None if that is the case, to indicate to itertools.islice to ++ # slice to the end of the iterator. ++ if frame_high == -1: ++ frame_high = None ++ else: ++ # As frames start from 0, add one to frame_high so islice ++ # correctly finds the end ++ frame_high = frame_high + 1; ++ ++ sliced = itertools.islice(frame_iterator, frame_low, frame_high) ++ ++ return sliced +Index: gdb-7.6/gdb/python/lib/gdb/__init__.py +=================================================================== +--- gdb-7.6.orig/gdb/python/lib/gdb/__init__.py 2013-06-10 14:31:02.733084651 +0200 ++++ gdb-7.6/gdb/python/lib/gdb/__init__.py 2013-06-10 14:31:08.368082436 +0200 +@@ -67,6 +67,8 @@ pretty_printers = [] + + # Initial type printers. + type_printers = [] ++# Initial frame filters. ++frame_filters = {} + + # Convenience variable to GDB's python directory + PYTHONDIR = os.path.dirname(os.path.dirname(__file__)) +Index: gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py 2013-06-10 14:31:08.368082436 +0200 +@@ -0,0 +1,461 @@ ++# Frame-filter commands. ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++"""GDB commands for working with frame-filters.""" ++ ++import gdb ++import copy ++from gdb.FrameIterator import FrameIterator ++from gdb.FrameDecorator import FrameDecorator ++import gdb.frames ++import itertools ++ ++# GDB Commands. ++class SetFilterPrefixCmd(gdb.Command): ++ """Prefix command for 'set' frame-filter related operations.""" ++ ++ def __init__(self): ++ super(SetFilterPrefixCmd, self).__init__("set frame-filter", ++ gdb.COMMAND_OBSCURE, ++ gdb.COMPLETE_NONE, True) ++ ++class ShowFilterPrefixCmd(gdb.Command): ++ """Prefix command for 'show' frame-filter related operations.""" ++ def __init__(self): ++ super(ShowFilterPrefixCmd, self).__init__("show frame-filter", ++ gdb.COMMAND_OBSCURE, ++ gdb.COMPLETE_NONE, True) ++class InfoFrameFilter(gdb.Command): ++ """List all registered Python frame-filters. ++ ++ Usage: info frame-filters ++ """ ++ ++ def __init__(self): ++ super(InfoFrameFilter, self).__init__("info frame-filter", ++ gdb.COMMAND_DATA) ++ @staticmethod ++ def enabled_string(state): ++ """Return "Yes" if filter is enabled, otherwise "No".""" ++ if state: ++ return "Yes" ++ else: ++ return "No" ++ ++ def list_frame_filters(self, frame_filters): ++ """ Internal worker function to list and print frame filters ++ in a dictionary. ++ ++ Arguments: ++ frame_filters: The name of the dictionary, as ++ specified by GDB user commands. ++ """ ++ ++ sorted_frame_filters = sorted(frame_filters.items(), ++ key=lambda i: gdb.frames.get_priority(i[1]), ++ reverse=True) ++ ++ if len(sorted_frame_filters) == 0: ++ print(" No frame filters registered.") ++ else: ++ print(" Priority Enabled Name") ++ for frame_filter in sorted_frame_filters: ++ name = frame_filter[0] ++ try: ++ priority = '{:<8}'.format( ++ str(gdb.frames.get_priority(frame_filter[1]))) ++ enabled = '{:<7}'.format( ++ self.enabled_string(gdb.frames.get_enabled(frame_filter[1]))) ++ except Exception as e: ++ print(" Error printing filter '"+name+"': "+str(e)) ++ else: ++ print(" %s %s %s" % (priority, enabled, name)) ++ ++ def print_list(self, title, filter_list, blank_line): ++ print(title) ++ self.list_frame_filters(filter_list) ++ if blank_line: ++ print("") ++ ++ def invoke(self, arg, from_tty): ++ self.print_list("global frame-filters:", gdb.frame_filters, True) ++ ++ cp = gdb.current_progspace() ++ self.print_list("progspace %s frame-filters:" % cp.filename, ++ cp.frame_filters, True) ++ ++ for objfile in gdb.objfiles(): ++ self.print_list("objfile %s frame-filters:" % objfile.filename, ++ objfile.frame_filters, False) ++ ++# Internal enable/disable functions. ++ ++def _enable_parse_arg(cmd_name, arg): ++ """ Internal worker function to take an argument from ++ enable/disable and return a tuple of arguments. ++ ++ Arguments: ++ cmd_name: Name of the command invoking this function. ++ args: The argument as a string. ++ ++ Returns: ++ A tuple containing the dictionary, and the argument, or just ++ the dictionary in the case of "all". ++ """ ++ ++ argv = gdb.string_to_argv(arg); ++ argc = len(argv) ++ if argv[0] == "all" and argc > 1: ++ raise gdb.GdbError(cmd_name + ": with 'all' " \ ++ "you may not specify a filter.") ++ else: ++ if argv[0] != "all" and argc != 2: ++ raise gdb.GdbError(cmd_name + " takes exactly two arguments.") ++ ++ return argv ++ ++def _do_enable_frame_filter(command_tuple, flag): ++ """Worker for enabling/disabling frame_filters. ++ ++ Arguments: ++ command_type: A tuple with the first element being the ++ frame filter dictionary, and the second being ++ the frame filter name. ++ flag: True for Enable, False for Disable. ++ """ ++ ++ list_op = command_tuple[0] ++ op_list = gdb.frames.return_list(list_op) ++ ++ if list_op == "all": ++ for item in op_list: ++ gdb.frames.set_enabled(item, flag) ++ else: ++ frame_filter = command_tuple[1] ++ try: ++ ff = op_list[frame_filter] ++ except KeyError: ++ msg = "frame-filter '" + str(name) + "' not found." ++ raise gdb.GdbError(msg) ++ ++ gdb.frames.set_enabled(ff, flag) ++ ++def _complete_frame_filter_list(text, word, all_flag): ++ """Worker for frame filter dictionary name completion. ++ ++ Arguments: ++ text: The full text of the command line. ++ word: The most recent word of the command line. ++ all_flag: Whether to include the word "all" in completion. ++ ++ Returns: ++ A list of suggested frame filter dictionary name completions ++ from text/word analysis. This list can be empty when there ++ are no suggestions for completion. ++ """ ++ if all_flag == True: ++ filter_locations = ["all", "global", "progspace"] ++ else: ++ filter_locations = ["global", "progspace"] ++ for objfile in gdb.objfiles(): ++ filter_locations.append(objfile.filename) ++ ++ # If the user just asked for completions with no completion ++ # hints, just return all the frame filter dictionaries we know ++ # about. ++ if (text == ""): ++ return filter_locations ++ ++ # Otherwise filter on what we know. ++ flist = filter(lambda x,y=text:x.startswith(y), filter_locations) ++ ++ # If we only have one completion, complete it and return it. ++ if len(flist) == 1: ++ flist[0] = flist[0][len(text)-len(word):] ++ ++ # Otherwise, return an empty list, or a list of frame filter ++ # dictionaries that the previous filter operation returned. ++ return flist ++ ++def _complete_frame_filter_name(word, printer_dict): ++ """Worker for frame filter name completion. ++ ++ Arguments: ++ ++ word: The most recent word of the command line. ++ ++ printer_dict: The frame filter dictionary to search for frame ++ filter name completions. ++ ++ Returns: A list of suggested frame filter name completions ++ from word analysis of the frame filter dictionary. This list ++ can be empty when there are no suggestions for completion. ++ """ ++ ++ printer_keys = printer_dict.keys() ++ if (word == ""): ++ return printer_keys ++ ++ flist = filter(lambda x,y=word:x.startswith(y), printer_keys) ++ return flist ++ ++class EnableFrameFilter(gdb.Command): ++ """GDB command to disable the specified frame-filter. ++ ++ Usage: enable frame-filter enable DICTIONARY [NAME] ++ ++ DICTIONARY is the name of the frame filter dictionary on which to ++ operate. If dictionary is set to "all", perform operations on all ++ dictionaries. Named dictionaries are: "global" for the global ++ frame filter dictionary, "progspace" for the program space's frame ++ filter dictionary. If either all, or the two named dictionaries ++ are not specified, the dictionary name is assumed to be the name ++ of the object-file name. ++ ++ NAME matches the name of the frame-filter to operate on. If ++ DICTIONARY is "all", NAME is ignored. ++ """ ++ def __init__(self): ++ super(EnableFrameFilter, self).__init__("enable frame-filter", ++ gdb.COMMAND_DATA) ++ def complete(self, text, word): ++ """Completion function for both frame filter dictionary, and ++ frame filter name.""" ++ if text.count(" ") == 0: ++ return _complete_frame_filter_list(text, word, True) ++ else: ++ printer_list = gdb.frames.return_list(text.split()[0].rstrip()) ++ return _complete_frame_filter_name(word, printer_list) ++ ++ def invoke(self, arg, from_tty): ++ command_tuple = _enable_parse_arg("enable frame-filter", arg) ++ _do_enable_frame_filter(command_tuple, True) ++ ++ ++class DisableFrameFilter(gdb.Command): ++ """GDB command to disable the specified frame-filter. ++ ++ Usage: disable frame-filter disable DICTIONARY [NAME] ++ ++ DICTIONARY is the name of the frame filter dictionary on which to ++ operate. If dictionary is set to "all", perform operations on all ++ dictionaries. Named dictionaries are: "global" for the global ++ frame filter dictionary, "progspace" for the program space's frame ++ filter dictionary. If either all, or the two named dictionaries ++ are not specified, the dictionary name is assumed to be the name ++ of the object-file name. ++ ++ NAME matches the name of the frame-filter to operate on. If ++ DICTIONARY is "all", NAME is ignored. ++ """ ++ def __init__(self): ++ super(DisableFrameFilter, self).__init__("disable frame-filter", ++ gdb.COMMAND_DATA) ++ ++ def complete(self, text, word): ++ """Completion function for both frame filter dictionary, and ++ frame filter name.""" ++ if text.count(" ") == 0: ++ return _complete_frame_filter_list(text, word, True) ++ else: ++ printer_list = gdb.frames.return_list(text.split()[0].rstrip()) ++ return _complete_frame_filter_name(word, printer_list) ++ ++ def invoke(self, arg, from_tty): ++ command_tuple = _enable_parse_arg("disable frame-filter", arg) ++ _do_enable_frame_filter(command_tuple, False) ++ ++class SetFrameFilterPriority(gdb.Command): ++ """GDB command to set the priority of the specified frame-filter. ++ ++ Usage: set frame-filter priority DICTIONARY NAME PRIORITY ++ ++ DICTIONARY is the name of the frame filter dictionary on which to ++ operate. Named dictionaries are: "global" for the global frame ++ filter dictionary, "progspace" for the program space's framefilter ++ dictionary. If either of these two are not specified, the ++ dictionary name is assumed to be the name of the object-file name. ++ ++ NAME matches the name of the frame filter to operate on. ++ ++ PRIORITY is the an integer to assign the new priority to the frame ++ filter. ++ """ ++ ++ def __init__(self): ++ super(SetFrameFilterPriority, self).__init__("set frame-filter " \ ++ "priority", ++ gdb.COMMAND_DATA) ++ ++ def _parse_pri_arg(self, arg): ++ """Internal worker to parse a priority from a tuple. ++ ++ Arguments: ++ arg: Tuple which contains the arguments from the command. ++ ++ Returns: ++ A tuple containing the dictionary, name and priority from ++ the arguments. ++ ++ Raises: ++ gdb.GdbError: An error parsing the arguments. ++ """ ++ ++ argv = gdb.string_to_argv(arg); ++ argc = len(argv) ++ if argc != 3: ++ print("set frame-filter priority " \ ++ "takes exactly three arguments.") ++ return None ++ ++ return argv ++ ++ def _set_filter_priority(self, command_tuple): ++ """Internal worker for setting priority of frame-filters, by ++ parsing a tuple and calling _set_priority with the parsed ++ tuple. ++ ++ Arguments: ++ command_tuple: Tuple which contains the arguments from the ++ command. ++ """ ++ ++ list_op = command_tuple[0] ++ frame_filter = command_tuple[1] ++ priority = command_tuple[2] ++ ++ op_list = gdb.frames.return_list(list_op) ++ ++ try: ++ ff = op_list[frame_filter] ++ except KeyError: ++ msg = "frame-filter '" + str(name) + "' not found." ++ raise gdb.GdbError(msg) ++ ++ gdb.frames.set_priority(ff, priority) ++ ++ def complete(self, text, word): ++ """Completion function for both frame filter dictionary, and ++ frame filter name.""" ++ if text.count(" ") == 0: ++ return _complete_frame_filter_list(text, word, False) ++ else: ++ printer_list = gdb.frames.return_list(text.split()[0].rstrip()) ++ return _complete_frame_filter_name(word, printer_list) ++ ++ def invoke(self, arg, from_tty): ++ command_tuple = self._parse_pri_arg(arg) ++ if command_tuple != None: ++ self._set_filter_priority(command_tuple) ++ ++class ShowFrameFilterPriority(gdb.Command): ++ """GDB command to show the priority of the specified frame-filter. ++ ++ Usage: show frame-filter priority DICTIONARY NAME ++ ++ DICTIONARY is the name of the frame filter dictionary on which to ++ operate. Named dictionaries are: "global" for the global frame ++ filter dictionary, "progspace" for the program space's framefilter ++ dictionary. If either of these two are not specified, the ++ dictionary name is assumed to be the name of the object-file name. ++ ++ NAME matches the name of the frame-filter to operate on. ++ """ ++ ++ def __init__(self): ++ super(ShowFrameFilterPriority, self).__init__("show frame-filter " \ ++ "priority", ++ gdb.COMMAND_DATA) ++ ++ def _parse_pri_arg(self, arg): ++ """Internal worker to parse a dictionary and name from a ++ tuple. ++ ++ Arguments: ++ arg: Tuple which contains the arguments from the command. ++ ++ Returns: ++ A tuple containing the dictionary, and frame filter name. ++ ++ Raises: ++ gdb.GdbError: An error parsing the arguments. ++ """ ++ ++ argv = gdb.string_to_argv(arg); ++ argc = len(argv) ++ if argc != 2: ++ print("show frame-filter priority " \ ++ "takes exactly two arguments.") ++ return None ++ ++ return argv ++ ++ def get_filter_priority(self, frame_filters, name): ++ """Worker for retrieving the priority of frame_filters. ++ ++ Arguments: ++ frame_filters: Name of frame filter dictionary. ++ name: object to select printers. ++ ++ Returns: ++ The priority of the frame filter. ++ ++ Raises: ++ gdb.GdbError: A frame filter cannot be found. ++ """ ++ ++ op_list = gdb.frames.return_list(frame_filters) ++ ++ try: ++ ff = op_list[name] ++ except KeyError: ++ msg = "frame-filter '" + str(name) + "' not found." ++ raise gdb.GdbError(msg) ++ ++ return gdb.frames.get_priority(ff) ++ ++ def complete(self, text, word): ++ """Completion function for both frame filter dictionary, and ++ frame filter name.""" ++ ++ if text.count(" ") == 0: ++ return _complete_frame_filter_list(text, word, False) ++ else: ++ printer_list = frame._return_list(text.split()[0].rstrip()) ++ return _complete_frame_filter_name(word, printer_list) ++ ++ def invoke(self, arg, from_tty): ++ command_tuple = self._parse_pri_arg(arg) ++ if command_tuple == None: ++ return ++ filter_name = command_tuple[1] ++ list_name = command_tuple[0] ++ try: ++ priority = self.get_filter_priority(list_name, filter_name); ++ except Exception as e: ++ print("Error printing filter priority for '"+name+"':"+str(e)) ++ else: ++ print("Priority of filter '" + filter_name + "' in list '" \ ++ + list_name + "' is: " + str(priority)) ++ ++# Register commands ++SetFilterPrefixCmd() ++ShowFilterPrefixCmd() ++InfoFrameFilter() ++EnableFrameFilter() ++DisableFrameFilter() ++SetFrameFilterPriority() ++ShowFrameFilterPriority() +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in 2013-06-10 14:31:08.368082436 +0200 +@@ -0,0 +1,48 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 part of the GDB testsuite. It tests Python-based ++# frame-filters. ++import gdb ++import itertools ++from gdb.FrameDecorator import FrameDecorator ++ ++ ++class FrameObjFile (): ++ ++ def __init__ (self): ++ self.name = "Filter1" ++ self.priority = 1 ++ self.enabled = False ++ gdb.current_progspace().frame_filters ["Progspace" + self.name] = self ++ gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self ++ ++ def filter (self, frame_iter): ++ return frame_iter ++ ++class FrameObjFile2 (): ++ ++ def __init__ (self): ++ self.name = "Filter2" ++ self.priority = 100 ++ self.enabled = True ++ gdb.current_progspace().frame_filters ["Progspace" + self.name] = self ++ gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self ++ ++ def filter (self, frame_iter): ++ return frame_iter ++ ++FrameObjFile() ++FrameObjFile2() +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c 2013-06-10 14:31:08.368082436 +0200 +@@ -0,0 +1,138 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 funca(void); ++int count = 0; ++ ++typedef struct ++{ ++ char *nothing; ++ int f; ++ short s; ++} foobar; ++ ++void end_func (int foo, char *bar, foobar *fb, foobar bf) ++{ ++ const char *str = "The End"; ++ const char *st2 = "Is Near"; ++ int b = 12; ++ short c = 5; ++ { ++ int d = 15; ++ int e = 14; ++ const char *foo = "Inside block"; ++ { ++ int f = 42; ++ int g = 19; ++ const char *bar = "Inside block x2"; ++ { ++ short h = 9; ++ h = h +1; /* Inner test breakpoint */ ++ } ++ } ++ } ++ ++ return; /* Backtrace end breakpoint */ ++} ++ ++void funcb(int j) ++{ ++ struct foo ++ { ++ int a; ++ int b; ++ }; ++ ++ struct foo bar; ++ ++ bar.a = 42; ++ bar.b = 84; ++ ++ funca(); ++ return; ++} ++ ++void funca(void) ++{ ++ foobar fb; ++ foobar *bf; ++ ++ if (count < 10) ++ { ++ count++; ++ funcb(count); ++ } ++ ++ fb.nothing = "Foo Bar"; ++ fb.f = 42; ++ fb.s = 19; ++ ++ bf = malloc (sizeof (foobar)); ++ bf->nothing = malloc (128); ++ bf->nothing = "Bar Foo"; ++ bf->f = 24; ++ bf->s = 91; ++ ++ end_func(21, "Param", bf, fb); ++ free (bf->nothing); ++ free (bf); ++ return; ++} ++ ++ ++void func1(void) ++{ ++ funca(); ++ return; ++} ++ ++int func2(void) ++{ ++ func1(); ++ return 1; ++} ++ ++void func3(int i) ++{ ++ func2(); ++ ++ return; ++} ++ ++int func4(int j) ++{ ++ func3(j); ++ ++ return 2; ++} ++ ++int func5(int f, int d) ++{ ++ int i = 0; ++ char *random = "random"; ++ i=i+f; ++ ++ func4(i); ++ return i; ++} ++ ++main() ++{ ++ func5(3,5); ++} +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp 2013-06-10 14:31:08.368082436 +0200 +@@ -0,0 +1,179 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 part of the GDB testsuite. It tests Python-based ++# frame-filters. ++load_lib mi-support.exp ++load_lib gdb-python.exp ++ ++set MIFLAGS "-i=mi2" ++ ++gdb_exit ++if [mi_gdb_start] { ++ continue ++} ++ ++standard_testfile py-framefilter-mi.c ++set pyfile py-framefilter.py ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DMI}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++mi_delete_breakpoints ++mi_gdb_reinitialize_dir $srcdir/$subdir ++mi_gdb_load ${binfile} ++ ++if {[lsearch -exact [mi_get_features] python] < 0} { ++ unsupported "python support is disabled" ++ return -1 ++} ++ ++mi_runto main ++ ++set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}] ++ ++mi_gdb_test "python execfile ('${remote_python_file}')" ".*\\^done." \ ++ "Load python file" ++ ++# Multiple blocks test ++mi_continue_to_line [gdb_get_line_number {Inner test breakpoint} ${srcfile}] \ ++ "step to breakpoint" ++ ++mi_gdb_test "-stack-list-locals --all-values" \ ++ "\\^done,locals=\\\[{name=\"h\",value=\"9\"},{name=\"f\",value=\"42\"},{name=\"g\",value=\"19\"},{name=\"bar\",value=\"$hex \\\\\"Inside block x2\\\\\"\"},{name=\"d\",value=\"15\"},{name=\"e\",value=\"14\"},{name=\"foo\",value=\"$hex \\\\\"Inside block\\\\\"\"},{name=\"str\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",value=\"12\"},{name=\"c\",value=\"5\"}\\\]" \ ++ "stack-list-locals --all-values" ++ ++mi_gdb_test "-enable-frame-filters" ".*\\^done." "enable frame filters" ++mi_gdb_test "-stack-list-locals --all-values" \ ++ "\\^done,locals=\\\[{name=\"h\",value=\"9\"},{name=\"f\",value=\"42\"},{name=\"g\",value=\"19\"},{name=\"bar\",value=\"$hex \\\\\"Inside block x2\\\\\"\"},{name=\"d\",value=\"15\"},{name=\"e\",value=\"14\"},{name=\"foo\",value=\"$hex \\\\\"Inside block\\\\\"\"},{name=\"str\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",value=\"12\"},{name=\"c\",value=\"5\"}\\\]" \ ++ "stack-list-locals --all-values frame filters enabled" ++ ++mi_continue_to_line [gdb_get_line_number {Backtrace end breakpoint} ${srcfile}] \ ++ "step to breakpoint" ++ ++mi_gdb_test "-stack-list-frames" \ ++ "\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*},frame={level=\"27\",addr=\"$hex\",func=\"niam\".*}\\\].*" \ ++ "filtered stack listing" ++mi_gdb_test "-stack-list-frames 0 3" \ ++ "\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*}\\\]" \ ++ "filtered stack list 0 3" ++mi_gdb_test "-stack-list-frames 22 24" \ ++ "\\^done,stack=\\\[frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*}\\\]" \ ++ "filtered stack list 22 24" ++ ++#stack list arguments ++ ++ ++mi_gdb_test "-stack-list-arguments 0" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[name=\"foo\",name=\"bar\",name=\"fb\",name=\"bf\"\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[name=\"j\"\\\]},.*frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[name=\"f\",name=\"d\"\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 0" ++ ++mi_gdb_test "-stack-list-arguments --no-frame-filters 0" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[name=\"foo\",name=\"bar\",name=\"fb\",name=\"bf\"\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[name=\"j\"\\\]},.*frame={level=\"22\",args=\\\[\\\]},frame={level=\"23\",args=\\\[\\\]},.*frame={level=\"26\",args=\\\[name=\"f\",name=\"d\"\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments --no-frame-filters 0" ++ ++mi_gdb_test "-stack-list-arguments 0 0 3" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[name=\"foo\",name=\"bar\",name=\"fb\",name=\"bf\"\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[name=\"j\"\\\]},frame={level=\"3\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 0 0 3" ++ ++mi_gdb_test "-stack-list-arguments 0 22 27" \ ++ "\\^done,stack-args=\\\[frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[name=\"f\",name=\"d\"\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 0 22 27" ++ ++mi_gdb_test "-stack-list-arguments 1" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",value=\"21\"},{name=\"bar\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",value=\"$hex\"},{name=\"bf\",value=\"{nothing = $hex \\\\\"Foo Bar\\\\\", f = 42, s = 19}\"}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",value=\"10\"}\\\]},.*frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",value=\"3\"},{name=\"d\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 1" ++ ++mi_gdb_test "-stack-list-arguments --no-frame-filters 1" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",value=\"21\"},{name=\"bar\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",value=\"$hex\"},{name=\"bf\",value=\"{nothing = $hex \\\\\"Foo Bar\\\\\", f = 42, s = 19}\"}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",value=\"10\"}\\\]},.*frame={level=\"22\",args=\\\[\\\]},frame={level=\"23\",args=\\\[\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",value=\"3\"},{name=\"d\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments --no-frame-filters 1" ++ ++ ++mi_gdb_test "-stack-list-arguments 1 0 3" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",value=\"21\"},{name=\"bar\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",value=\"$hex\"},{name=\"bf\",value=\"{nothing = $hex \\\\\"Foo Bar\\\\\", f = 42, s = 19}\"}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",value=\"10\"}\\\]},frame={level=\"3\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 1 0 3" ++ ++mi_gdb_test "-stack-list-arguments 1 22 27" \ ++ "\\^done,stack-args=\\\[frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",value=\"3\"},{name=\"d\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 1 22 27" ++ ++mi_gdb_test "-stack-list-arguments 2" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",type=\"int\",value=\"21\"},{name=\"bar\",type=\"char \\\*\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",type=\"foobar \\\*\",value=\"$hex\"},{name=\"bf\",type=\"foobar\"\}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",type=\"int\",value=\"10\"}\\\]},.*frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",type=\"int\",value=\"3\"},{name=\"d\",type=\"int\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 2" ++ ++mi_gdb_test "-stack-list-arguments --no-frame-filters 2" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",type=\"int\",value=\"21\"},{name=\"bar\",type=\"char \\\*\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",type=\"foobar \\\*\",value=\"$hex\"},{name=\"bf\",type=\"foobar\"}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",type=\"int\",value=\"10\"}\\\]},.*frame={level=\"22\",args=\\\[\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",type=\"int\",value=\"3\"},{name=\"d\",type=\"int\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments --no-frame-filters 2" ++ ++ ++mi_gdb_test "-stack-list-arguments 2 0 3" \ ++ "\\^done,stack-args=\\\[frame={level=\"0\",args=\\\[{name=\"foo\",type=\"int\",value=\"21\"},{name=\"bar\",type=\"char \\\*\",value=\"$hex \\\\\"Param\\\\\"\"},{name=\"fb\",type=\"foobar \\\*\",value=\"$hex\"},{name=\"bf\",type=\"foobar\"}\\\]},frame={level=\"1\",args=\\\[\\\]},frame={level=\"2\",args=\\\[{name=\"j\",type=\"int\",value=\"10\"}\\\]},frame={level=\"3\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 2 0 3" ++ ++mi_gdb_test "-stack-list-arguments 2 22 27" \ ++ "\\^done,stack-args=\\\[frame={level=\"22\",args=\\\[\\\],children=\\\[frame={level=\"23\",args=\\\[\\\]}\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",type=\"int\",value=\"3\"},{name=\"d\",type=\"int\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments 2 22 27" ++ ++mi_gdb_test "-stack-list-arguments --no-frame-filters 2 22 27" \ ++ "\\^done,stack-args=\\\[frame={level=\"22\",args=\\\[\\\]},frame={level=\"23\",args=\\\[\\\]},.*frame={level=\"26\",args=\\\[{name=\"f\",type=\"int\",value=\"3\"},{name=\"d\",type=\"int\",value=\"5\"}\\\]},frame={level=\"27\",args=\\\[\\\]}\\\]" \ ++ "stack-list-arguments --no-frame-filters 2 22 27" ++ ++#stack-list-locals ++mi_gdb_test "-stack-list-locals --no-frame-filters 0" \ ++ "\\^done,locals=\\\[name=\"str\",name=\"st2\",name=\"b\",name=\"c\"\\\]" \ ++ "stack-list-locals --no-frame-filters 0" ++ ++mi_gdb_test "-stack-list-locals --no-frame-filters 1" \ ++ "\\^done,locals=\\\[{name=\"str\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",value=\"12\"},{name=\"c\",value=\"5\"}\\\]" \ ++ "stack-list-locals --no-frame-filters 1" ++ ++mi_gdb_test "-stack-list-locals --no-frame-filters 2" \ ++ "\\^done,locals=\\\[{name=\"str\",type=\"const char \\\*\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",type=\"const char \\\*\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",type=\"int\",value=\"12\"},{name=\"c\",type=\"short\",value=\"5\"}\\\]" \ ++ "stack-list-locals --no-frame-filters 2" ++ ++mi_gdb_test "-stack-list-locals --no-frame-filters --no-values" \ ++ "\\^done,locals=\\\[name=\"str\",name=\"st2\",name=\"b\",name=\"c\"\\\]" \ ++ "stack-list-locals --no-frame-filters --no-values" ++ ++mi_gdb_test "-stack-list-locals --no-frame-filters --all-values" \ ++ "\\^done,locals=\\\[{name=\"str\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",value=\"12\"},{name=\"c\",value=\"5\"}\\\]" \ ++ "stack-list-locals --no-frame-filters --all-values" ++ ++mi_gdb_test "-stack-list-locals --no-frame-filters --simple-values" \ ++ "\\^done,locals=\\\[{name=\"str\",type=\"const char \\\*\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",type=\"const char \\\*\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",type=\"int\",value=\"12\"},{name=\"c\",type=\"short\",value=\"5\"}\\\]" \ ++ "stack-list-locals --no-frame-filters --simple-values" ++ ++mi_gdb_test "-stack-list-locals 0" \ ++ "\\^done,locals=\\\[name=\"str\",name=\"st2\",name=\"b\",name=\"c\"\\\]" \ ++ "stack-list-locals 0" ++ ++mi_gdb_test "-stack-list-locals 1" \ ++ "\\^done,locals=\\\[{name=\"str\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",value=\"12\"},{name=\"c\",value=\"5\"}\\\]" \ ++ "stack-list-locals 1" ++ ++mi_gdb_test "-stack-list-locals 2" \ ++ "\\^done,locals=\\\[{name=\"str\",type=\"const char \\\*\",value=\"$hex \\\\\"The End\\\\\"\"},{name=\"st2\",type=\"const char \\\*\",value=\"$hex \\\\\"Is Near\\\\\"\"},{name=\"b\",type=\"int\",value=\"12\"},{name=\"c\",type=\"short\",value=\"5\"}\\\]" \ ++ "stack-list-locals 2" ++ ++# stack-list-variables ++mi_gdb_test "-stack-list-variables --no-frame-filters 0" \ ++ "\\^done,variables=\\\[{name=\"foo\",arg=\"1\"},{name=\"bar\",arg=\"1\"},{name=\"fb\",arg=\"1\"},{name=\"bf\",arg=\"1\"},{name=\"str\"},{name=\"st2\"},{name=\"b\"},{name=\"c\"}\\\]" \ ++ "stack-list-variables --no-frame-filters 0" ++ ++mi_gdb_test "-stack-list-variables 0" \ ++ "\\^done,variables=\\\[{name=\"foo\",arg=\"1\"},{name=\"bar\",arg=\"1\"},{name=\"fb\",arg=\"1\"},{name=\"bf\",arg=\"1\"},{name=\"str\"},{name=\"st2\"},{name=\"b\"},{name=\"c\"}\\\]" \ ++ "stack-list-variables 0" +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c 2013-06-10 14:31:08.369082436 +0200 +@@ -0,0 +1,155 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 funca(void); ++int count = 0; ++ ++typedef struct ++{ ++ char *nothing; ++ int f; ++ short s; ++} foobar; ++ ++void end_func (int foo, char *bar, foobar *fb, foobar bf) ++{ ++ const char *str = "The End"; ++ const char *st2 = "Is Near"; ++ int b = 12; ++ short c = 5; ++ ++ { ++ int d = 15; ++ int e = 14; ++ const char *foo = "Inside block"; ++ { ++ int f = 42; ++ int g = 19; ++ const char *bar = "Inside block x2"; ++ { ++ short h = 9; ++ h = h +1; /* Inner test breakpoint */ ++ } ++ } ++ } ++ ++ return; /* Backtrace end breakpoint */ ++} ++ ++void funcb(int j) ++{ ++ struct foo ++ { ++ int a; ++ int b; ++ }; ++ ++ struct foo bar; ++ ++ bar.a = 42; ++ bar.b = 84; ++ ++ funca(); ++ return; ++} ++ ++void funca(void) ++{ ++ foobar fb; ++ foobar *bf = NULL; ++ ++ if (count < 10) ++ { ++ count++; ++ funcb(count); ++ } ++ ++ fb.nothing = "Foo Bar"; ++ fb.f = 42; ++ fb.s = 19; ++ ++ bf = alloca (sizeof (foobar)); ++ bf->nothing = alloca (128); ++ bf->nothing = "Bar Foo"; ++ bf->f = 24; ++ bf->s = 91; ++ ++ end_func(21, "Param", bf, fb); ++ return; ++} ++ ++ ++void func1(void) ++{ ++ funca(); ++ return; ++} ++ ++int func2(int f) ++{ ++ int c; ++ const char *elided = "Elided frame"; ++ foobar fb; ++ foobar *bf = NULL; ++ ++ fb.nothing = "Elided Foo Bar"; ++ fb.f = 84; ++ fb.s = 38; ++ ++ bf = alloca (sizeof (foobar)); ++ bf->nothing = alloca (128); ++ bf->nothing = "Elided Bar Foo"; ++ bf->f = 48; ++ bf->s = 182; ++ ++ func1(); ++ return 1; ++} ++ ++void func3(int i) ++{ ++ func2(i); ++ ++ return; ++} ++ ++int func4(int j) ++{ ++ func3(j); ++ ++ return 2; ++} ++ ++int func5(int f, int d) ++{ ++ int i = 0; ++ char *random = "random"; ++ i=i+f; ++ ++ func4(i); ++ return i; ++} ++ ++main() ++{ ++ int z = 32; ++ int y = 44; ++ const char *foo1 = "Test"; ++ func5(3,5); ++} +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp 2013-06-10 14:31:08.369082436 +0200 +@@ -0,0 +1,239 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 part of the GDB testsuite. It tests Python-based ++# frame-filters. ++ ++load_lib gdb-python.exp ++ ++standard_testfile ++ ++# We cannot use prepare_for_testing as we have to set the safe-patch ++# to check objfile and progspace printers. ++if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { ++ return -1 ++} ++ ++# Start with a fresh gdb. ++gdb_exit ++gdb_start ++ ++# Skip all tests if Python scripting is not enabled. ++if { [skip_python_tests] } { continue } ++ ++# Make the -gdb.py script available to gdb, it is automagically loaded by gdb. ++# Care is taken to put it in the same directory as the binary so that ++# gdb will find it. ++set remote_obj_python_file \ ++ [remote_download \ ++ host ${srcdir}/${subdir}/${testfile}-gdb.py.in \ ++ ${subdir}/${testfile}-gdb.py] ++ ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \ ++ "set auto-load safe-path" ++gdb_load ${binfile} ++# Verify gdb loaded the script. ++gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \ ++ "Test auto-load had loaded python scripts" ++ ++if ![runto_main] then { ++ perror "couldn't run to breakpoint" ++ return ++} ++gdb_test_no_output "set python print-stack full" \ ++ "Set python print-stack to full" ++ ++# Load global frame-filters ++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] ++gdb_test_no_output "python execfile ('${remote_python_file}')" \ ++ "Load python file" ++ ++gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"] ++gdb_breakpoint [gdb_get_line_number "Inner test breakpoint"] ++gdb_continue_to_breakpoint "Inner test breakpoint" ++ ++# Test multiple local blocks. ++gdb_test "bt full no-filters" \ ++ ".*#0.*end_func.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \ ++ "bt full no-filters" ++gdb_test "bt full" \ ++ ".*#0.*cnuf_dne.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \ ++ "bt full with filters" ++ ++gdb_continue_to_breakpoint "Backtrace end breakpoint" ++ ++# Test set/show ++gdb_test "info frame-filter" \ ++ ".*900.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \ ++ "info frame filter before setting priority" ++gdb_test "show frame-filter priority global Elider" \ ++ "Priority of filter 'Elider' in list 'global' is: 900" \ ++ "show frame-filter priority global Elider before setting" ++gdb_test_no_output "set frame-filter priority global Elider 1000" \ ++ "set frame-filter priotiy global Elider 1000" ++gdb_test "show frame-filter priority global Elider" \ ++ "Priority of filter 'Elider' in list 'global' is: 1000" \ ++ "show frame-filter priority global Elider after setting" ++gdb_test "info frame-filter" \ ++ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \ ++ "info frame filter after setting priority" ++ ++# Test enable/disable ++gdb_test "info frame-filter" \ ++ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \ ++ "info frame filter before disable frame filter" ++gdb_test_no_output "disable frame-filter global Elider" \ ++ "disable frame-filter global Elider" ++gdb_test "info frame-filter" \ ++ ".*1000.*No.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \ ++ "info frame filter after disable frame filter" ++gdb_test_no_output "enable frame-filter global Elider" \ ++ "enable frame-filter global Elider" ++gdb_test "info frame-filter" \ ++ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \ ++ "info frame filter after reenabling frame filter" ++ ++# Test no-filters ++gdb_test "bt no-filters" \ ++ ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*" \ ++ "bt no-filters" ++ ++# Test reverse ++gdb_test "bt" \ ++ ".*#0.*cnuf_dne.*#22.*in 1cnuf.*#27.*in niam \\(\\).*" \ ++ "bt with frame filters" ++ ++# Disable Reverse ++gdb_test_no_output "disable frame-filter global Reverse" \ ++ "disable frame-filter global Reverse" ++gdb_test "bt" \ ++ ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*" \ ++ "bt with frame-filter Reverse disabled" ++gdb_test "bt -2" \ ++ ".*#26.*func5.*#27.*in main \\(\\).*" \ ++ "bt -2 with frame-filter Reverse disabled" ++gdb_test "bt 3" \ ++ ".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*" \ ++ "bt 3 with frame-filter Reverse disabled" ++gdb_test "bt no-filter full" \ ++ ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*" \ ++ "bt no-filters full with Reverse disabled" ++gdb_test "bt full" \ ++ ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(f=3\\).*elided = $hex \"Elided frame\".*fb = \{nothing = $hex \"Elided Foo Bar\", f = 84, s = 38\}.*bf = $hex.*" \ ++ "bt full with Reverse disabled" ++ ++# Test set print frame-arguments ++# none ++gdb_test_no_output "set print frame-arguments none" \ ++ "turn off frame arguments" ++gdb_test "bt no-filter 1" \ ++ "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \ ++ "bt no-filter 1 no args" ++gdb_test "bt 1" \ ++ "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \ ++ "bt 1 no args" ++ ++# scalars ++gdb_test_no_output "set print frame-arguments scalars" \ ++ "turn frame arguments to scalars only" ++gdb_test "bt no-filter 1" \ ++ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \ ++ "bt no-filter 1 scalars" ++gdb_test "bt 1" \ ++ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \ ++ "bt 1 scalars" ++ ++# all ++gdb_test_no_output "set print frame-arguments all" \ ++ "turn on frame arguments" ++gdb_test "bt no-filter 1" \ ++ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ ++ "bt no-filter 1 all args" ++gdb_test "bt 1" \ ++ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ ++ "bt 1 all args" ++ ++# set print address off ++gdb_test_no_output "set print address off" \ ++ "Turn off address printing" ++gdb_test "bt no-filter 1" \ ++ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ ++ "bt no-filter 1 no address" ++gdb_test "bt 1" \ ++ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ ++ "bt 1 no addresss" ++ ++remote_file host delete ${remote_python_file} ++ ++# Test with no debuginfo ++ ++# We cannot use prepare_for_testing as we have to set the safe-patch ++# to check objfile and progspace printers. ++if {[build_executable $testfile.exp $testfile $srcfile {nodebug}] == -1} { ++ return -1 ++} ++ ++# Start with a fresh gdb. ++gdb_exit ++gdb_start ++ ++# Skip all tests if Python scripting is not enabled. ++if { [skip_python_tests] } { continue } ++ ++# Make the -gdb.py script available to gdb, it is automagically loaded by gdb. ++# Care is taken to put it in the same directory as the binary so that ++# gdb will find it. ++set remote_obj_python_file \ ++ [remote_download \ ++ host ${srcdir}/${subdir}/${testfile}-gdb.py.in \ ++ ${subdir}/${testfile}-gdb.py] ++ ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \ ++ "set auto-load safe-path for no debug info" ++gdb_load ${binfile} ++ ++# Verify gdb loaded the script. ++gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \ ++ "Set autoload path for no debug info tests" ++if ![runto_main] then { ++ perror "couldn't run to breakpoint" ++ return ++} ++ ++gdb_test_no_output "set python print-stack full" \ ++ "set python print-stack full for no debuginfo tests" ++ ++# Load global frame-filters ++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] ++gdb_test_no_output "python execfile ('${remote_python_file}')" \ ++ "Load python file for no debuginfo tests" ++ ++# Disable Reverse ++gdb_test_no_output "disable frame-filter global Reverse" \ ++ "disable frame-filter gloval Reverse for no debuginfo" ++gdb_test "bt" \ ++ ".*#0..*in main \\(\\).*" \ ++ "bt for no debuginfo" ++gdb_test "bt full" \ ++ ".*#0..*in main \\(\\).*" \ ++ "bt full for no debuginfo" ++gdb_test "bt no-filters" \ ++ ".*#0..*in main \\(\\).*" \ ++ "bt no filters for no debuginfo" ++gdb_test "bt no-filters full" \ ++ ".*#0..*in main \\(\\).*" \ ++ "bt no-filters full no debuginfo" +Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.py 2013-06-10 14:31:08.369082436 +0200 +@@ -0,0 +1,117 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 part of the GDB testsuite. It tests Python-based ++# frame-filters. ++import gdb ++import itertools ++from gdb.FrameDecorator import FrameDecorator ++import copy ++ ++class Reverse_Function (FrameDecorator): ++ ++ def __init__(self, fobj): ++ super(Reverse_Function, self).__init__(fobj) ++ self.fobj = fobj ++ ++ def function (self): ++ fname = str (self.fobj.function()) ++ if (fname == None or fname == ""): ++ return None ++ else: ++ fname = fname[::-1] ++ return fname ++ ++class Dummy (FrameDecorator): ++ ++ def __init__(self, fobj): ++ super(Dummy, self).__init__(fobj) ++ self.fobj = fobj ++ ++ def function (self): ++ return "Dummy function" ++ ++ def address (self): ++ return 0x123 ++ ++ def filename (self): ++ return "Dummy filename" ++ ++ def frame_args (self): ++ return [("Foo",gdb.Value(12)),("Bar","Stuff"), ("FooBar",42)] ++ ++ def frame_locals (self): ++ return [] ++ ++ def line (self): ++ return 0 ++ ++ def elided (self): ++ return None ++ ++class FrameFilter (): ++ ++ def __init__ (self): ++ self.name = "Reverse" ++ self.priority = 100 ++ self.enabled = True ++ gdb.frame_filters [self.name] = self ++ ++ def filter (self, frame_iter): ++ frame_iter = itertools.imap (Reverse_Function, ++ frame_iter) ++ return frame_iter ++ ++class ElidingFrameDecorator(FrameDecorator): ++ ++ def __init__(self, frame, elided_frames): ++ super(ElidingFrameDecorator, self).__init__(frame) ++ self.elided_frames = elided_frames ++ ++ def elided(self): ++ return iter(self.elided_frames) ++ ++class ElidingIterator: ++ def __init__(self, ii): ++ self.input_iterator = ii ++ ++ def __iter__(self): ++ return self ++ ++ def next(self): ++ frame = next(self.input_iterator) ++ if str(frame.function()) != 'func1': ++ return frame ++ ++ # Suppose we want to return the 'func1' frame but elide the ++ # next frame. E.g., if call in our interpreter language takes ++ # two C frames to implement, and the first one we see is the ++ # "sentinel". ++ elided = next(self.input_iterator) ++ return ElidingFrameDecorator(frame, [elided]) ++ ++class FrameElider (): ++ ++ def __init__ (self): ++ self.name = "Elider" ++ self.priority = 900 ++ self.enabled = True ++ gdb.frame_filters [self.name] = self ++ ++ def filter (self, frame_iter): ++ return ElidingIterator (frame_iter) ++ ++FrameFilter() ++FrameElider() diff --git a/SOURCES/gdb-upstream-framefilters-2of2.patch b/SOURCES/gdb-upstream-framefilters-2of2.patch new file mode 100644 index 0000000..0446ef6 --- /dev/null +++ b/SOURCES/gdb-upstream-framefilters-2of2.patch @@ -0,0 +1,175 @@ +http://sourceware.org/ml/gdb-cvs/2013-05/msg00141.html + +### src/gdb/ChangeLog 2013/05/17 06:58:33 1.15565 +### src/gdb/ChangeLog 2013/05/17 08:34:18 1.15566 +## -1,3 +1,18 @@ ++2013-05-17 Phil Muldoon ++ ++ * frame.c (frame_stash): Convert to htab. ++ (frame_addr_hash): New function. ++ (frame_addr_hash_eq): New function. ++ (frame_stash_create): Convert function to create ++ a hash table. ++ (frame_stash_add): Convert function to add an entry to a hash ++ table. ++ (frame_stash_find): Convert function to search the hash table. ++ (frame_stash_invalidate): Convert function to empty the hash ++ table. ++ (get_frame_id): Only add to stash if a frame_id is created. ++ (_initialize_frame): Call frame_stash_create. ++ + 2013-05-16 Yue Lu (tiny change) + + * configure.ac: Ensure MIG is available when building for GNU Hurd +--- src/gdb/frame.c 2013/04/10 15:11:11 1.317 ++++ src/gdb/frame.c 2013/05/17 08:34:18 1.318 +@@ -43,6 +43,7 @@ + #include "block.h" + #include "inline-frame.h" + #include "tracepoint.h" ++#include "hashtab.h" + + static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame); + static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame); +@@ -128,38 +129,107 @@ + enum unwind_stop_reason stop_reason; + }; + +-/* A frame stash used to speed up frame lookups. */ ++/* A frame stash used to speed up frame lookups. Create a hash table ++ to stash frames previously accessed from the frame cache for ++ quicker subsequent retrieval. The hash table is emptied whenever ++ the frame cache is invalidated. */ ++ ++static htab_t frame_stash; ++ ++/* Internal function to calculate a hash from the frame_id addresses, ++ using as many valid addresses as possible. Frames below level 0 ++ are not stored in the hash table. */ ++ ++static hashval_t ++frame_addr_hash (const void *ap) ++{ ++ const struct frame_info *frame = ap; ++ const struct frame_id f_id = frame->this_id.value; ++ hashval_t hash = 0; ++ ++ gdb_assert (f_id.stack_addr_p || f_id.code_addr_p ++ || f_id.special_addr_p); ++ ++ if (f_id.stack_addr_p) ++ hash = iterative_hash (&f_id.stack_addr, ++ sizeof (f_id.stack_addr), hash); ++ if (f_id.code_addr_p) ++ hash = iterative_hash (&f_id.code_addr, ++ sizeof (f_id.code_addr), hash); ++ if (f_id.special_addr_p) ++ hash = iterative_hash (&f_id.special_addr, ++ sizeof (f_id.special_addr), hash); + +-/* We currently only stash one frame at a time, as this seems to be +- sufficient for now. */ +-static struct frame_info *frame_stash = NULL; ++ return hash; ++} ++ ++/* Internal equality function for the hash table. This function ++ defers equality operations to frame_id_eq. */ ++ ++static int ++frame_addr_hash_eq (const void *a, const void *b) ++{ ++ const struct frame_info *f_entry = a; ++ const struct frame_info *f_element = b; + +-/* Add the following FRAME to the frame stash. */ ++ return frame_id_eq (f_entry->this_id.value, ++ f_element->this_id.value); ++} ++ ++/* Internal function to create the frame_stash hash table. 100 seems ++ to be a good compromise to start the hash table at. */ ++ ++static void ++frame_stash_create (void) ++{ ++ frame_stash = htab_create (100, ++ frame_addr_hash, ++ frame_addr_hash_eq, ++ NULL); ++} ++ ++/* Internal function to add a frame to the frame_stash hash table. Do ++ not store frames below 0 as they may not have any addresses to ++ calculate a hash. */ + + static void + frame_stash_add (struct frame_info *frame) + { +- frame_stash = frame; ++ /* Do not stash frames below level 0. */ ++ if (frame->level >= 0) ++ { ++ struct frame_info **slot; ++ ++ slot = (struct frame_info **) htab_find_slot (frame_stash, ++ frame, ++ INSERT); ++ *slot = frame; ++ } + } + +-/* Search the frame stash for an entry with the given frame ID. +- If found, return that frame. Otherwise return NULL. */ ++/* Internal function to search the frame stash for an entry with the ++ given frame ID. If found, return that frame. Otherwise return ++ NULL. */ + + static struct frame_info * + frame_stash_find (struct frame_id id) + { +- if (frame_stash && frame_id_eq (frame_stash->this_id.value, id)) +- return frame_stash; ++ struct frame_info dummy; ++ struct frame_info *frame; + +- return NULL; ++ dummy.this_id.value = id; ++ frame = htab_find (frame_stash, &dummy); ++ return frame; + } + +-/* Invalidate the frame stash by removing all entries in it. */ ++/* Internal function to invalidate the frame stash by removing all ++ entries in it. This only occurs when the frame cache is ++ invalidated. */ + + static void + frame_stash_invalidate (void) + { +- frame_stash = NULL; ++ htab_empty (frame_stash); + } + + /* Flag to control debugging. */ +@@ -345,10 +415,9 @@ + fprint_frame_id (gdb_stdlog, fi->this_id.value); + fprintf_unfiltered (gdb_stdlog, " }\n"); + } ++ frame_stash_add (fi); + } + +- frame_stash_add (fi); +- + return fi->this_id.value; + } + +@@ -2451,6 +2520,8 @@ + { + obstack_init (&frame_cache_obstack); + ++ frame_stash_create (); ++ + observer_attach_target_changed (frame_observer_target_changed); + + add_prefix_cmd ("backtrace", class_maintenance, set_backtrace_cmd, _("\ diff --git a/SOURCES/gdb-upstream-man-gcore-1of2.patch b/SOURCES/gdb-upstream-man-gcore-1of2.patch new file mode 100644 index 0000000..c0255f3 --- /dev/null +++ b/SOURCES/gdb-upstream-man-gcore-1of2.patch @@ -0,0 +1,690 @@ +http://sourceware.org/ml/gdb-cvs/2013-04/msg00109.html + +### src/gdb/ChangeLog 2013/04/11 13:14:04 1.15397 +### src/gdb/ChangeLog 2013/04/11 14:13:42 1.15398 +## -1,4 +1,28 @@ + 2013-04-11 Jan Kratochvil ++ Pedro Alves ++ ++ * Makefile.in (HAVE_NATIVE_GCORE_TARGET): New. ++ (generated_files): Add gcore. ++ (install-only, uninstall): Add gcore if HAVE_NATIVE_GCORE_TARGET or ++ HAVE_NATIVE_GCORE_HOST. ++ (gcore): New. ++ * NEWS (Changes since GDB 7.6): Mention newly installed gcore. ++ * config/alpha/alpha-osf3.mh, config/i386/fbsd.mh, ++ config/i386/fbsd64.mh, config/i386/i386gnu.mh, config/i386/i386sol2.mh, ++ config/i386/sol2-64.mh, config/mips/irix5.mh, config/mips/irix6.mh, ++ config/powerpc/fbsd.mh, config/sparc/fbsd.mh, config/sparc/sol2.mh: ++ Add HAVE_NATIVE_GCORE_HOST. ++ * configure: Regenerate. ++ * configure.ac (HAVE_NATIVE_GCORE_TARGET): New, set it, AC_SUBST it. ++ New AC_SUBST fir GDB_TRANSFORM_NAME and GCORE_TRANSFORM_NAME. New ++ AC_CONFIG_FILES for gcore. ++ * configure.tgt: Add gdb_have_gcore to the initial comment. Set ++ gdb_have_gcore. ++ * gdb_gcore.sh: Rename to ... ++ * gcore.in: ... here. Remove gcore.sh comment. Use GDB_TRANSFORM_NAME ++ and GCORE_TRANSFORM_NAME substitutions. ++ ++2013-04-11 Jan Kratochvil + + * remote.c (unpush_and_perror): Add output message final dot. + +### src/gdb/doc/ChangeLog 2013/04/10 15:11:12 1.1440 +### src/gdb/doc/ChangeLog 2013/04/11 14:13:44 1.1441 +## -1,3 +1,13 @@ ++2013-04-11 Jan Kratochvil ++ ++ * Makefile.in (MAN1S): Add gcore.1. ++ Remove "Host, target, and site specific Makefile fragments" comment. ++ (@host_makefile_frag@, HAVE_NATIVE_GCORE_TARGET): New. ++ (install-man1, uninstall-man1): Conditionalize gcore.1. ++ (gcore.1): New. ++ * gdb.texinfo (Man Pages): Add gcore man. ++ (gcore man): New node. ++ + 2013-04-10 Pedro Alves + + * gdb.texinfo (Process Record and Replay): Document that "set +Index: gdb-7.6/gdb/gcore.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6/gdb/gcore.in 2013-04-26 15:33:01.171049247 +0200 +@@ -0,0 +1,69 @@ ++#!/bin/sh ++ ++# Copyright (C) 2003-2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++# ++# Script to generate a core file of a running program. ++# It starts up gdb, attaches to the given PID and invokes the gcore command. ++# ++ ++if [ "$#" -eq "0" ] ++then ++ echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid" ++ exit 2 ++fi ++ ++# Need to check for -o option, but set default basename to "core". ++name=core ++ ++if [ "$1" = "-o" ] ++then ++ if [ "$#" -lt "3" ] ++ then ++ # Not enough arguments. ++ echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid" ++ exit 2 ++ fi ++ name=$2 ++ ++ # Shift over to start of pid list ++ shift; shift ++fi ++ ++# Initialise return code. ++rc=0 ++ ++# Loop through pids ++for pid in $* ++do ++ # `. +- +-# +-# gcore.sh +-# Script to generate a core file of a running program. +-# It starts up gdb, attaches to the given PID and invokes the gcore command. +-# +- +-if [ "$#" -eq "0" ] +-then +- echo "usage: gcore [-o filename] pid" +- exit 2 +-fi +- +-# Need to check for -o option, but set default basename to "core". +-name=core +- +-if [ "$1" = "-o" ] +-then +- if [ "$#" -lt "3" ] +- then +- # Not enough arguments. +- echo "usage: gcore [-o filename] pid" +- exit 2 +- fi +- name=$2 +- +- # Shift over to start of pid list +- shift; shift +-fi +- +-# Initialise return code. +-rc=0 +- +-# Loop through pids +-for pid in $* +-do +- # `>confdefs.h + + ++# Undo the $ec_script escaping suitable for Makefile. ++transform=`echo "$program_transform_name" | sed -e 's/\\$\\$/\\$/g'` ++GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"` ++if test "x$GDB_TRANSFORM_NAME" = x; then ++ GDB_TRANSFORM_NAME=gdb ++fi ++ ++GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"` ++if test "x$GCORE_TRANSFORM_NAME" = x; then ++ GCORE_TRANSFORM_NAME=gcore ++fi ++ ++ac_config_files="$ac_config_files gcore" ++ ++ + ac_config_files="$ac_config_files Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile" + + ac_config_commands="$ac_config_commands default" +@@ -14841,6 +14867,7 @@ do + "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;; + "jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;; + "$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;; ++ "gcore") CONFIG_FILES="$CONFIG_FILES gcore" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "gdb-gdb.gdb") CONFIG_FILES="$CONFIG_FILES gdb-gdb.gdb" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; +@@ -15462,6 +15489,7 @@ $as_echo "$as_me: executing $ac_file com + + case $ac_file$ac_mode in + "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;; ++ "gcore":F) chmod +x gcore ;; + "default":C) + case x$CONFIG_HEADERS in + xconfig.h:config.in) +Index: gdb-7.6/gdb/configure.ac +=================================================================== +--- gdb-7.6.orig/gdb/configure.ac 2013-03-12 23:25:32.000000000 +0100 ++++ gdb-7.6/gdb/configure.ac 2013-04-26 15:33:01.180049239 +0200 +@@ -203,6 +203,7 @@ fi + + TARGET_OBS= + all_targets= ++HAVE_NATIVE_GCORE_TARGET= + + for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` + do +@@ -236,6 +237,12 @@ do + if test x${want64} = xfalse; then + . ${srcdir}/../bfd/config.bfd + fi ++ ++ # Check whether this target is native and supports gcore. ++ if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \ ++ && $gdb_have_gcore; then ++ HAVE_NATIVE_GCORE_TARGET=1 ++ fi + fi + done + +@@ -264,6 +271,7 @@ if test x${all_targets} = xtrue; then + fi + + AC_SUBST(TARGET_OBS) ++AC_SUBST(HAVE_NATIVE_GCORE_TARGET) + + # For other settings, only the main target counts. + gdb_sim= +@@ -2349,6 +2357,20 @@ dnl At the moment, we just assume it's + AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8", + [Define to be a string naming the default host character set.]) + ++# Undo the $ec_script escaping suitable for Makefile. ++transform=`echo "$program_transform_name" | sed -e 's/[\\$][\\$]/\\$/g'` ++GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"` ++if test "x$GDB_TRANSFORM_NAME" = x; then ++ GDB_TRANSFORM_NAME=gdb ++fi ++AC_SUBST(GDB_TRANSFORM_NAME) ++GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"` ++if test "x$GCORE_TRANSFORM_NAME" = x; then ++ GCORE_TRANSFORM_NAME=gcore ++fi ++AC_SUBST(GCORE_TRANSFORM_NAME) ++AC_CONFIG_FILES([gcore], [chmod +x gcore]) ++ + AC_OUTPUT(Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile, + [ + case x$CONFIG_HEADERS in +Index: gdb-7.6/gdb/configure.tgt +=================================================================== +--- gdb-7.6.orig/gdb/configure.tgt 2013-03-05 14:37:10.000000000 +0100 ++++ gdb-7.6/gdb/configure.tgt 2013-04-26 15:33:01.180049239 +0200 +@@ -6,6 +6,7 @@ + # gdb_sim simulator library for target + # gdb_osabi default OS ABI to use with target + # build_gdbserver set to "yes" if gdbserver supports target ++# gdb_have_gcore set to "true"/"false" if this target can run gcore + + # NOTE: Every file added to a gdb_target_obs variable for any target here + # must also be added to either ALL_TARGET_OBS or ALL_64_TARGET_OBS +@@ -703,3 +704,14 @@ m68*-*-openbsd* | m88*-*-openbsd* | vax- + *-*-symbianelf*) + gdb_osabi=GDB_OSABI_SYMBIAN ;; + esac ++ ++# Check whether this target supports gcore. ++# Such target has to call set_gdbarch_find_memory_regions. ++case " ${gdb_target_obs} " in ++ *" linux-tdep.o "*) ++ gdb_have_gcore=true ++ ;; ++ *) ++ gdb_have_gcore=false ++ ;; ++esac +Index: gdb-7.6/gdb/config/alpha/alpha-osf3.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/alpha/alpha-osf3.mh 2012-01-10 17:30:44.000000000 +0100 ++++ gdb-7.6/gdb/config/alpha/alpha-osf3.mh 2013-04-26 15:33:01.181049238 +0200 +@@ -3,4 +3,5 @@ NAT_FILE= nm-osf3.h + NATDEPFILES= alpha-nat.o fork-child.o \ + solib-osf.o procfs.o proc-api.o proc-events.o proc-flags.o \ + proc-why.o dec-thread.o ++HAVE_NATIVE_GCORE_HOST = 1 + NAT_CLIBS= -lpthreaddebug +Index: gdb-7.6/gdb/config/i386/fbsd.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/i386/fbsd.mh 2009-10-26 19:28:13.000000000 +0100 ++++ gdb-7.6/gdb/config/i386/fbsd.mh 2013-04-26 15:33:01.181049238 +0200 +@@ -3,5 +3,6 @@ NATDEPFILES= fork-child.o inf-ptrace.o \ + fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \ + bsd-kvm.o + NAT_FILE= nm-fbsd.h ++HAVE_NATIVE_GCORE_HOST = 1 + + LOADLIBES= -lkvm +Index: gdb-7.6/gdb/config/i386/fbsd64.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/i386/fbsd64.mh 2012-02-09 17:06:44.000000000 +0100 ++++ gdb-7.6/gdb/config/i386/fbsd64.mh 2013-04-26 15:33:01.181049238 +0200 +@@ -2,5 +2,6 @@ + NATDEPFILES= fork-child.o inf-ptrace.o \ + fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \ + bsd-kvm.o i386-nat.o ++HAVE_NATIVE_GCORE_HOST = 1 + + LOADLIBES= -lkvm +Index: gdb-7.6/gdb/config/i386/i386gnu.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/i386/i386gnu.mh 2012-01-10 17:30:44.000000000 +0100 ++++ gdb-7.6/gdb/config/i386/i386gnu.mh 2013-04-26 15:33:01.181049238 +0200 +@@ -2,6 +2,7 @@ + NATDEPFILES= i386gnu-nat.o gnu-nat.o core-regset.o fork-child.o \ + notify_S.o process_reply_S.o msg_reply_S.o \ + msg_U.o exc_request_U.o exc_request_S.o ++HAVE_NATIVE_GCORE_HOST = 1 + + NAT_FILE= nm-i386gnu.h + MH_CFLAGS = -D_GNU_SOURCE +Index: gdb-7.6/gdb/config/i386/i386sol2.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/i386/i386sol2.mh 2010-04-26 15:53:56.000000000 +0200 ++++ gdb-7.6/gdb/config/i386/i386sol2.mh 2013-04-26 15:33:01.181049238 +0200 +@@ -1,3 +1,4 @@ + # Host: Solaris x86 + NATDEPFILES= fork-child.o i386v4-nat.o i386-sol2-nat.o \ + procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o ++HAVE_NATIVE_GCORE_HOST = 1 +Index: gdb-7.6/gdb/config/i386/sol2-64.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/i386/sol2-64.mh 2010-04-26 15:53:57.000000000 +0200 ++++ gdb-7.6/gdb/config/i386/sol2-64.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -1,3 +1,4 @@ + # Host: Solaris x86_64 + NATDEPFILES= fork-child.o amd64-nat.o i386v4-nat.o i386-sol2-nat.o \ + procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o ++HAVE_NATIVE_GCORE_HOST = 1 +Index: gdb-7.6/gdb/config/mips/irix5.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/mips/irix5.mh 2012-01-10 17:30:45.000000000 +0100 ++++ gdb-7.6/gdb/config/mips/irix5.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -1,3 +1,4 @@ + # Host: SGI Iris running irix 5.x + NATDEPFILES= fork-child.o irix5-nat.o procfs.o \ + proc-api.o proc-events.o proc-flags.o proc-why.o ++HAVE_NATIVE_GCORE_HOST = 1 +Index: gdb-7.6/gdb/config/mips/irix6.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/mips/irix6.mh 2012-01-10 17:30:45.000000000 +0100 ++++ gdb-7.6/gdb/config/mips/irix6.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -1,3 +1,4 @@ + # Host: SGI Iris running irix 6.x + NATDEPFILES= fork-child.o irix5-nat.o procfs.o \ + proc-api.o proc-events.o proc-flags.o proc-why.o ++HAVE_NATIVE_GCORE_HOST = 1 +Index: gdb-7.6/gdb/config/powerpc/fbsd.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/powerpc/fbsd.mh 2013-02-04 21:48:53.000000000 +0100 ++++ gdb-7.6/gdb/config/powerpc/fbsd.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -18,6 +18,7 @@ + # along with this program. If not, see . */ + + NATDEPFILES= fbsd-nat.o fork-child.o inf-ptrace.o ppcfbsd-nat.o bsd-kvm.o ++HAVE_NATIVE_GCORE_HOST = 1 + + LOADLIBES= -lkvm + +Index: gdb-7.6/gdb/config/sparc/fbsd.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/sparc/fbsd.mh 2009-10-26 19:28:15.000000000 +0100 ++++ gdb-7.6/gdb/config/sparc/fbsd.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -2,5 +2,6 @@ + NATDEPFILES= fork-child.o inf-ptrace.o \ + fbsd-nat.o sparc-nat.o sparc64-nat.o sparc64fbsd-nat.o \ + bsd-kvm.o ++HAVE_NATIVE_GCORE_HOST = 1 + + LOADLIBES= -lkvm +Index: gdb-7.6/gdb/config/sparc/sol2.mh +=================================================================== +--- gdb-7.6.orig/gdb/config/sparc/sol2.mh 2012-01-10 17:30:49.000000000 +0100 ++++ gdb-7.6/gdb/config/sparc/sol2.mh 2013-04-26 15:33:01.182049237 +0200 +@@ -3,3 +3,4 @@ NAT_FILE= nm-sol2.h + NATDEPFILES= sparc-sol2-nat.o \ + core-regset.o fork-child.o \ + procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o ++HAVE_NATIVE_GCORE_HOST = 1 +Index: gdb-7.6/gdb/doc/Makefile.in +=================================================================== +--- gdb-7.6.orig/gdb/doc/Makefile.in 2013-04-26 15:32:58.000000000 +0200 ++++ gdb-7.6/gdb/doc/Makefile.in 2013-04-26 15:33:01.183049235 +0200 +@@ -177,11 +177,15 @@ POD2MAN5 = pod2man --center="GNU Develop + --release="gdb-`sed q $(srcdir)/../version.in`" --section=5 + + # List of man pages generated from gdb.texi +-MAN1S = gdb.1 gdbserver.1 ++MAN1S = gdb.1 gdbserver.1 gcore.1 + MAN5S = gdbinit.5 + MANS = $(MAN1S) $(MAN5S) + +-#### Host, target, and site specific Makefile fragments come in here. ++# Host-dependent makefile fragment comes in here. ++@host_makefile_frag@ ++# End of host-dependent makefile fragment ++HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@ ++ + ### + + all: +@@ -269,6 +273,10 @@ install-man: install-man1 install-man5 + install-man1: $(MAN1S) + test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)" + @list='$(MAN1S)'; for p in $$list; do \ ++ if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \ ++ -a "$$p" = gcore.1; then \ ++ continue; \ ++ fi; \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=`echo $$p | sed -e 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \ +@@ -288,7 +296,13 @@ uninstall-man: uninstall-man1 uninstall- + + uninstall-man1: + @test -n "$(man1dir)" || exit 0; \ +- files=`{ l2='$(MAN1S)'; for i in $$l2; do echo "$$i"; done | \ ++ files=`{ l2='$(MAN1S)'; for i in $$l2; do \ ++ if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \ ++ -a "$$i" = gcore.1; then \ ++ continue; \ ++ fi; \ ++ echo "$$i"; \ ++ done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ +@@ -605,6 +619,13 @@ gdbserver.1: $(GDB_DOC_FILES) + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gdbserver.pod + ++gcore.1: $(GDB_DOC_FILES) ++ touch $@ ++ -$(TEXI2POD) $(MANCONF) -Dgcore < $(srcdir)/gdb.texinfo > gcore.pod ++ -($(POD2MAN1) gcore.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ ++ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) ++ rm -f gcore.pod ++ + gdbinit.5: $(GDB_DOC_FILES) + touch $@ + -$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod +Index: gdb-7.6/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.6.orig/gdb/doc/gdb.texinfo 2013-04-26 15:32:58.000000000 +0200 ++++ gdb-7.6/gdb/doc/gdb.texinfo 2013-04-26 15:33:01.191049229 +0200 +@@ -41709,6 +41709,7 @@ switch (die->tag) + @menu + * gdb man:: The GNU Debugger man page + * gdbserver man:: Remote Server for the GNU Debugger man page ++* gcore man:: Generate a core file of a running program + * gdbinit man:: gdbinit scripts + @end menu + +@@ -42230,6 +42231,53 @@ info gdb + should give you access to the complete manual. + + @cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++Richard M. Stallman and Roland H. Pesch, July 1991. ++@end ifset ++@c man end ++ ++@node gcore man ++@heading gcore ++ ++@c man title gcore Generate a core file of a running program ++ ++@format ++@c man begin SYNOPSIS gcore ++gcore [-o @var{filename}] @var{pid} ++@c man end ++@end format ++ ++@c man begin DESCRIPTION gcore ++Generate a core dump of a running program with process ID @var{pid}. ++Produced file is equivalent to a kernel produced core file as if the process ++crashed (and if @kbd{ulimit -c} were used to set up an appropriate core dump ++limit). Unlike after a crash, after @command{gcore} the program remains ++running without any change. ++@c man end ++ ++@c man begin OPTIONS gcore ++@table @env ++@item -o @var{filename} ++The optional argument ++@var{filename} specifies the file name where to put the core dump. ++If not specified, the file name defaults to @file{core.@var{pid}}, ++where @var{pid} is the running program process ID. ++@end table ++@c man end ++ ++@c man begin SEEALSO gcore ++@ifset man ++The full documentation for @value{GDBN} is maintained as a Texinfo manual. ++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo ++documentation are properly installed at your site, the command ++ ++@smallexample ++info gdb ++@end smallexample ++ ++@noindent ++should give you access to the complete manual. ++ ++@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, + Richard M. Stallman and Roland H. Pesch, July 1991. + @end ifset + @c man end diff --git a/SOURCES/gdb-upstream-man-gcore-2of2.patch b/SOURCES/gdb-upstream-man-gcore-2of2.patch new file mode 100644 index 0000000..e8b6ce1 --- /dev/null +++ b/SOURCES/gdb-upstream-man-gcore-2of2.patch @@ -0,0 +1,33 @@ +http://sourceware.org/ml/gdb-cvs/2013-04/msg00110.html + +### src/gdb/ChangeLog 2013/04/11 14:13:42 1.15398 +### src/gdb/ChangeLog 2013/04/11 16:53:01 1.15399 +## -22,6 +22,9 @@ + * gcore.in: ... here. Remove gcore.sh comment. Use GDB_TRANSFORM_NAME + and GCORE_TRANSFORM_NAME substitutions. + ++ Fix parsing tabs in ${gdb_target_obs}. ++ * configure.tgt (gdb_have_gcore): Replace case with for and if. ++ + 2013-04-11 Jan Kratochvil + + * remote.c (unpush_and_perror): Add output message final dot. +--- src/gdb/configure.tgt 2013/04/11 14:13:43 1.273 ++++ src/gdb/configure.tgt 2013/04/11 16:53:01 1.274 +@@ -707,11 +707,9 @@ + + # Check whether this target supports gcore. + # Such target has to call set_gdbarch_find_memory_regions. +-case " ${gdb_target_obs} " in +- *" linux-tdep.o "*) ++gdb_have_gcore=false ++for t in x ${gdb_target_obs}; do ++ if test "$t" = linux-tdep.o; then + gdb_have_gcore=true +- ;; +- *) +- gdb_have_gcore=false +- ;; +-esac ++ fi ++done diff --git a/SOURCES/gdb-upstream.patch b/SOURCES/gdb-upstream.patch new file mode 100644 index 0000000..848b198 --- /dev/null +++ b/SOURCES/gdb-upstream.patch @@ -0,0 +1,1329 @@ +http://sourceware.org/ml/gdb-cvs/2013-04/msg00056.html + +### src/gdb/ChangeLog 2013/04/05 19:17:15 1.15370 +### src/gdb/ChangeLog 2013/04/05 20:01:32 1.15371 +## -1,5 +1,12 @@ + 2013-04-05 Jan Kratochvil + ++ Convert man pages to texinfo, new gdbinit.5 texinfo page. ++ * Makefile.in (gdb.z): Remove. ++ (install-only): Remove $(man1dir) and gdb.1 installation. ++ * gdb.1: Remove. ++ ++2013-04-05 Jan Kratochvil ++ + Fix compatibility with Linux kernel 3.8.3. + * linux-tdep.c (linux_find_memory_regions_full): Move variable number + to more inner block. Remove parsing of NUMBER from outer block. +--- src/gdb/Makefile.in 2013/04/05 13:24:24 1.1246 ++++ src/gdb/Makefile.in 2013/04/05 20:01:33 1.1247 +@@ -1019,11 +1019,6 @@ + info install-info clean-info dvi pdf install-pdf html install-html: force + @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do + +-gdb.z:gdb.1 +- nroff -man $(srcdir)/gdb.1 | col -b > gdb.t +- pack gdb.t ; rm -f gdb.t +- mv gdb.t.z gdb.z +- + # Traditionally "install" depends on "all". But it may be useful + # not to; for example, if the user has made some trivial change to a + # source file and doesn't care about rebuilding or just wants to save the +@@ -1043,10 +1038,6 @@ + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ + $(INSTALL_PROGRAM) gdb$(EXEEXT) \ + $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ +- $(SHELL) $(srcdir)/../mkinstalldirs \ +- $(DESTDIR)$(man1dir) ; \ +- $(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 + @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do +### src/gdb/doc/ChangeLog 2013/04/02 17:52:08 1.1432 +### src/gdb/doc/ChangeLog 2013/04/05 20:01:33 1.1433 +## -1,3 +1,22 @@ ++2013-04-05 Jan Kratochvil ++ ++ Convert man pages to texinfo, new gdbinit.5 texinfo page. ++ * Makefile.in (mandir, man1dir, man5dir, SYSTEM_GDBINIT, MANCONF, ++ (TEXI2POD, POD2MAN1, POD2MAN5, MAN1S, MAN5S, MANS, man): New. ++ (diststuff): Add man. ++ (install-man, install-man1, install-man5, uninstall-man, uninstall-man1) ++ (uninstall-man5): New. ++ (STAGESTUFF): Add *.1 and *.5. ++ (GDBvn.texi): Add SYSTEM_GDBINIT. ++ (gdb.1, gdbserver.1, gdbinit.5): New. ++ (maintainer-clean realclean): Add $(MANS). ++ (install): Add install-man. ++ (uninstall): Add uninstall-man. ++ * gdb.texinfo (@include gdb-cfg.texi): Wrap it by @c man begin INCLUDE. ++ (@copying): Wrap it by @c man begin COPYRIGHT. ++ (Top): Add Man Pages. ++ (Man Pages, gdb man, gdbserver man, gdbinit man): New. ++ + 2013-04-02 Pedro Alves + + * gdb.texinfo (Debugging Output): Document "set/show debug +--- src/gdb/doc/Makefile.in 2013/01/01 06:32:56 1.57 ++++ src/gdb/doc/Makefile.in 2013/04/05 20:01:33 1.58 +@@ -26,6 +26,9 @@ + docdir = @docdir@ + pdfdir = @pdfdir@ + htmldir = @htmldir@ ++mandir = @mandir@ ++man1dir = $(mandir)/man1 ++man5dir = $(mandir)/man5 + + SHELL = @SHELL@ + +@@ -35,6 +38,8 @@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + ++SYSTEM_GDBINIT = @SYSTEM_GDBINIT@ ++ + mkinstalldirs = $(SHELL) $(srcdir)/../../mkinstalldirs + + # main GDB source directory +@@ -160,6 +165,22 @@ + $(ANNOTATE_DOC_SOURCE_INCLUDES) \ + $(ANNOTATE_DOC_BUILD_INCLUDES) + ++# Options to extract the man page from gdb.texinfo ++MANCONF = -Dman ++ ++TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl \ ++ $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) ++ ++POD2MAN1 = pod2man --center="GNU Development Tools" \ ++ --release="gdb-$(VERSION)" --section=1 ++POD2MAN5 = pod2man --center="GNU Development Tools" \ ++ --release="gdb-$(VERSION)" --section=5 ++ ++# List of man pages generated from gdb.texi ++MAN1S = gdb.1 gdbserver.1 ++MAN5S = gdbinit.5 ++MANS = $(MAN1S) $(MAN5S) ++ + #### Host, target, and site specific Makefile fragments come in here. + ### + +@@ -170,8 +191,9 @@ + ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps + html: $(HTMLFILES) + pdf: $(PDFFILES) ++man: $(MANS) + all-doc: info dvi ps # pdf +-diststuff: info ++diststuff: info man + rm -f gdb-cfg.texi GDBvn.texi + + install-info: $(INFO_DEPS) +@@ -242,7 +264,49 @@ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +-STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf ++install-man: install-man1 install-man5 ++ ++install-man1: $(MAN1S) ++ test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)" ++ @list='$(MANS)'; for p in $$list; do \ ++ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ++ f=`echo $$p | sed -e 's|^.*/||'`; \ ++ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \ ++ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(man1dir)/$$f"; \ ++ done ++ ++install-man5: $(MAN5S) ++ test -z "$(man5dir)" || $(mkinstalldirs) "$(DESTDIR)$(man5dir)" ++ @list='$(MANS)'; for p in $$list; do \ ++ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ++ f=`echo $$p | sed -e 's|^.*/||'`; \ ++ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man5dir)/$$f'"; \ ++ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(man5dir)/$$f"; \ ++ done ++ ++uninstall-man: uninstall-man1 uninstall-man5 ++ ++uninstall-man1: ++ @test -n "$(man1dir)" || exit 0; \ ++ files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \ ++ sed -n '/\.1[a-z]*$$/p'; \ ++ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ ++ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ ++ test -z "$$files" || { \ ++ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ ++ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } ++ ++uninstall-man5: ++ @test -n "$(man5dir)" || exit 0; \ ++ files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \ ++ sed -n '/\.5[a-z]*$$/p'; \ ++ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ ++ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ ++ test -z "$$files" || { \ ++ echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \ ++ cd "$(DESTDIR)$(man5dir)" && rm -f $$files; } ++ ++STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf *.1 *.5 + + # Copy the object files from a particular stage into a subdirectory. + stage1: force +@@ -313,6 +377,9 @@ + if test -z "$(READLINE_TEXI_INCFLAG)"; then \ + echo "@set SYSTEM_READLINE" >> ./GDBvn.new; \ + fi ++ if [ -n "$(SYSTEM_GDBINIT)" ]; then \ ++ echo "@set SYSTEM_GDBINIT $(SYSTEM_GDBINIT)" >> ./GDBvn.new; \ ++ fi + mv GDBvn.new GDBvn.texi + + # Updated atomically +@@ -523,6 +590,28 @@ + annotate/index.html: $(ANNOTATE_DOC_FILES) + $(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/annotate.texinfo + ++# Man pages ++gdb.1: $(GDB_DOC_FILES) ++ touch $@ ++ -$(TEXI2POD) $(MANCONF) -Dgdb < gdb.texinfo > gdb.pod ++ -($(POD2MAN1) gdb.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ ++ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) ++ rm -f gdb.pod ++ ++gdbserver.1: $(GDB_DOC_FILES) ++ touch $@ ++ -$(TEXI2POD) $(MANCONF) -Dgdbserver < gdb.texinfo > gdbserver.pod ++ -($(POD2MAN1) gdbserver.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ ++ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) ++ rm -f gdbserver.pod ++ ++gdbinit.5: $(GDB_DOC_FILES) ++ touch $@ ++ -$(TEXI2POD) $(MANCONF) -Dgdbinit < gdb.texinfo > gdbinit.pod ++ -($(POD2MAN5) gdbinit.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ ++ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) ++ rm -f gdbinit.pod ++ + force: + + Makefile: Makefile.in $(host_makefile_frag) ../config.status +@@ -551,8 +640,8 @@ + # "clean" or "distclean". Use maintainer-clean to remove them. + + maintainer-clean realclean: distclean +- rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf ++ rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf $(MANS) + +-install: install-info ++install: install-info install-man + +-uninstall: uninstall-info ++uninstall: uninstall-info uninstall-man +--- src/gdb/doc/gdb.texinfo 2013/04/02 17:52:08 1.1069 ++++ src/gdb/doc/gdb.texinfo 2013/04/05 20:01:33 1.1070 +@@ -6,7 +6,9 @@ + @c of @set vars. However, you can override filename with makeinfo -o. + @setfilename gdb.info + @c ++@c man begin INCLUDE + @include gdb-cfg.texi ++@c man end + @c + @settitle Debugging with @value{GDBN} + @setchapternewpage odd +@@ -46,6 +48,7 @@ + @end direntry + + @copying ++@c man begin COPYRIGHT + Copyright @copyright{} 1988-2013 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +@@ -58,6 +61,7 @@ + (a) The FSF's Back-Cover Text is: ``You are free to copy and modify + this GNU Manual. Buying copies from GNU Press supports the FSF in + developing GNU and promoting software freedom.'' ++@c man end + @end copying + + @ifnottex +@@ -179,6 +183,7 @@ + the operating system + * Trace File Format:: GDB trace file format + * Index Section Format:: .gdb_index section format ++* Man Pages:: Manual pages + * Copying:: GNU General Public License says + how you can copy and share GDB + * GNU Free Documentation License:: The license for this documentation +@@ -41597,6 +41602,497 @@ + @} + @end smallexample + ++@node Man Pages ++@appendix Manual pages ++@cindex Man pages ++ ++@menu ++* gdb man:: The GNU Debugger man page ++* gdbserver man:: Remote Server for the GNU Debugger man page ++* gdbinit man:: gdbinit scripts ++@end menu ++ ++@node gdb man ++@heading gdb man ++ ++@c man title gdb The GNU Debugger ++ ++@c man begin SYNOPSIS gdb ++gdb [@option{-help}] [@option{-nh}] [@option{-nx}] [@option{-q}] ++[@option{-batch}] [@option{-cd=}@var{dir}] [@option{-f}] ++[@option{-b}@w{ }@var{bps}] ++ [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}] ++[@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}] ++[@option{-c}@w{ }@var{core}] [@option{-x}@w{ }@var{cmds}] ++ [@option{-d}@w{ }@var{dir}] [@var{prog}|@var{core}|@var{procID}] ++@c man end ++ ++@c man begin DESCRIPTION gdb ++The purpose of a debugger such as @value{GDBN} is to allow you to see what is ++going on ``inside'' another program while it executes -- or what another ++program was doing at the moment it crashed. ++ ++@value{GDBN} can do four main kinds of things (plus other things in support of ++these) to help you catch bugs in the act: ++ ++@itemize @bullet ++@item ++Start your program, specifying anything that might affect its behavior. ++ ++@item ++Make your program stop on specified conditions. ++ ++@item ++Examine what has happened, when your program has stopped. ++ ++@item ++Change things in your program, so you can experiment with correcting the ++effects of one bug and go on to learn about another. ++@end itemize ++ ++You can use @value{GDBN} to debug programs written in C, C@t{++}, and Modula-2. ++Fortran support will be added when a GNU Fortran compiler is ready. ++ ++@value{GDBN} is invoked with the shell command @code{gdb}. Once started, it reads ++commands from the terminal until you tell it to exit with the @value{GDBN} ++command @code{quit}. You can get online help from @value{GDBN} itself ++by using the command @code{help}. ++ ++You can run @code{gdb} with no arguments or options; but the most ++usual way to start @value{GDBN} is with one argument or two, specifying an ++executable program as the argument: ++ ++@smallexample ++gdb program ++@end smallexample ++ ++You can also start with both an executable program and a core file specified: ++ ++@smallexample ++gdb program core ++@end smallexample ++ ++You can, instead, specify a process ID as a second argument, if you want ++to debug a running process: ++ ++@smallexample ++gdb program 1234 ++@end smallexample ++ ++@noindent ++would attach @value{GDBN} to process @code{1234} (unless you also have a file ++named @file{1234}; @value{GDBN} does check for a core file first). ++ ++Here are some of the most frequently needed @value{GDBN} commands: ++ ++@c pod2man highlights the right hand side of the @item lines. ++@table @env ++@item break [@var{file}:]@var{functiop} ++Set a breakpoint at @var{function} (in @var{file}). ++ ++@item run [@var{arglist}] ++Start your program (with @var{arglist}, if specified). ++ ++@item bt ++Backtrace: display the program stack. ++ ++@item print @var{expr} ++Display the value of an expression. ++ ++@item c ++Continue running your program (after stopping, e.g. at a breakpoint). ++ ++@item next ++Execute next program line (after stopping); step @emph{over} any ++function calls in the line. ++ ++@item edit [@var{file}:]@var{function} ++look at the program line where it is presently stopped. ++ ++@item list [@var{file}:]@var{function} ++type the text of the program in the vicinity of where it is presently stopped. ++ ++@item step ++Execute next program line (after stopping); step @emph{into} any ++function calls in the line. ++ ++@item help [@var{name}] ++Show information about @value{GDBN} command @var{name}, or general information ++about using @value{GDBN}. ++ ++@item quit ++Exit from @value{GDBN}. ++@end table ++ ++@ifset man ++For full details on @value{GDBN}, ++see @cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++by Richard M. Stallman and Roland H. Pesch. The same text is available online ++as the @code{gdb} entry in the @code{info} program. ++@end ifset ++@c man end ++ ++@c man begin OPTIONS gdb ++Any arguments other than options specify an executable ++file and core file (or process ID); that is, the first argument ++encountered with no ++associated option flag is equivalent to a @option{-se} option, and the second, ++if any, is equivalent to a @option{-c} option if it's the name of a file. ++Many options have ++both long and short forms; both are shown here. The long forms are also ++recognized if you truncate them, so long as enough of the option is ++present to be unambiguous. (If you prefer, you can flag option ++arguments with @option{+} rather than @option{-}, though we illustrate the ++more usual convention.) ++ ++All the options and command line arguments you give are processed ++in sequential order. The order makes a difference when the @option{-x} ++option is used. ++ ++@table @env ++@item -help ++@itemx -h ++List all options, with brief explanations. ++ ++@item -symbols=@var{file} ++@itemx -s @var{file} ++Read symbol table from file @var{file}. ++ ++@item -write ++Enable writing into executable and core files. ++ ++@item -exec=@var{file} ++@itemx -e @var{file} ++Use file @var{file} as the executable file to execute when ++appropriate, and for examining pure data in conjunction with a core ++dump. ++ ++@item -se=@var{file} ++Read symbol table from file @var{file} and use it as the executable ++file. ++ ++@item -core=@var{file} ++@itemx -c @var{file} ++Use file @var{file} as a core dump to examine. ++ ++@item -command=@var{file} ++@itemx -x @var{file} ++Execute @value{GDBN} commands from file @var{file}. ++ ++@item -ex @var{command} ++Execute given @value{GDBN} @var{command}. ++ ++@item -directory=@var{directory} ++@itemx -d @var{directory} ++Add @var{directory} to the path to search for source files. ++ ++@item -nh ++Do not execute commands from @file{~/.gdbinit}. ++ ++@item -nx ++@itemx -n ++Do not execute commands from any @file{.gdbinit} initialization files. ++ ++@item -quiet ++@itemx -q ++``Quiet''. Do not print the introductory and copyright messages. These ++messages are also suppressed in batch mode. ++ ++@item -batch ++Run in batch mode. Exit with status @code{0} after processing all the command ++files specified with @option{-x} (and @file{.gdbinit}, if not inhibited). ++Exit with nonzero status if an error occurs in executing the @value{GDBN} ++commands in the command files. ++ ++Batch mode may be useful for running @value{GDBN} as a filter, for example to ++download and run a program on another computer; in order to make this ++more useful, the message ++ ++@smallexample ++Program exited normally. ++@end smallexample ++ ++@noindent ++(which is ordinarily issued whenever a program running under @value{GDBN} control ++terminates) is not issued when running in batch mode. ++ ++@item -cd=@var{directory} ++Run @value{GDBN} using @var{directory} as its working directory, ++instead of the current directory. ++ ++@item -fullname ++@itemx -f ++Emacs sets this option when it runs @value{GDBN} as a subprocess. It tells ++@value{GDBN} to output the full file name and line number in a standard, ++recognizable fashion each time a stack frame is displayed (which ++includes each time the program stops). This recognizable format looks ++like two @samp{\032} characters, followed by the file name, line number ++and character position separated by colons, and a newline. The ++Emacs-to-@value{GDBN} interface program uses the two @samp{\032} ++characters as a signal to display the source code for the frame. ++ ++@item -b @var{bps} ++Set the line speed (baud rate or bits per second) of any serial ++interface used by @value{GDBN} for remote debugging. ++ ++@item -tty=@var{device} ++Run using @var{device} for your program's standard input and output. ++@end table ++@c man end ++ ++@c man begin SEEALSO gdb ++@ifset man ++The full documentation for @value{GDBN} is maintained as a Texinfo manual. ++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo ++documentation are properly installed at your site, the command ++ ++@smallexample ++info gdb ++@end smallexample ++ ++@noindent ++should give you access to the complete manual. ++ ++@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++Richard M. Stallman and Roland H. Pesch, July 1991. ++@end ifset ++@c man end ++ ++@node gdbserver man ++@heading gdbserver man ++ ++@c man title gdbserver Remote Server for the GNU Debugger ++@format ++@c man begin SYNOPSIS gdbserver ++gdbserver @var{tty} @var{prog} [@var{args}@dots{}] ++ ++gdbserver @var{tty} --attach @var{PID} ++@c man end ++@end format ++ ++@c man begin DESCRIPTION gdbserver ++@command{gdbserver} is a program that allows you to run @value{GDBN} on a different machine ++than the one which is running the program being debugged. ++ ++@ifclear man ++@subheading Usage (server (target) side) ++@end ifclear ++@ifset man ++Usage (server (target) side): ++@end ifset ++ ++First, you need to have a copy of the program you want to debug put onto ++the target system. The program can be stripped to save space if needed, as ++@command{gdbserver} doesn't care about symbols. All symbol handling is taken care of by ++the @value{GDBN} running on the host system. ++ ++To use the server, you log on to the target system, and run the @command{gdbserver} ++program. You must tell it (a) how to communicate with @value{GDBN}, (b) the name of ++your program, and (c) its arguments. The general syntax is: ++ ++@smallexample ++target> gdbserver @var{comm} @var{program} [@var{args} ...] ++@end smallexample ++ ++For example, using a serial port, you might say: ++ ++@smallexample ++@ifset man ++@c @file would wrap it as F. ++target> gdbserver /dev/com1 emacs foo.txt ++@end ifset ++@ifclear man ++target> gdbserver @file{/dev/com1} emacs foo.txt ++@end ifclear ++@end smallexample ++ ++This tells @command{gdbserver} to debug emacs with an argument of foo.txt, and ++to communicate with @value{GDBN} via @file{/dev/com1}. @command{gdbserver} now ++waits patiently for the host @value{GDBN} to communicate with it. ++ ++To use a TCP connection, you could say: ++ ++@smallexample ++target> gdbserver host:2345 emacs foo.txt ++@end smallexample ++ ++This says pretty much the same thing as the last example, except that we are ++going to communicate with the @code{host} @value{GDBN} via TCP. The @code{host:2345} argument means ++that we are expecting to see a TCP connection from @code{host} to local TCP port ++2345. (Currently, the @code{host} part is ignored.) You can choose any number you ++want for the port number as long as it does not conflict with any existing TCP ++ports on the target system. This same port number must be used in the host ++@value{GDBN}s @code{target remote} command, which will be described shortly. Note that if ++you chose a port number that conflicts with another service, @command{gdbserver} will ++print an error message and exit. ++ ++On some targets, @command{gdbserver} can also attach to running programs. ++This is accomplished via the @option{--attach} argument. The syntax is: ++ ++@smallexample ++target> gdbserver @var{comm} --attach @var{pid} ++@end smallexample ++ ++@var{pid} is the process ID of a currently running process. It isn't ++necessary to point @command{gdbserver} at a binary for the running process. ++ ++@ifclear man ++@subheading Usage (host side) ++@end ifclear ++@ifset man ++Usage (host side): ++@end ifset ++ ++You need an unstripped copy of the target program on your host system, since ++@value{GDBN} needs to examine it's symbol tables and such. Start up @value{GDBN} as you normally ++would, with the target program as the first argument. (You may need to use the ++@option{--baud} option if the serial line is running at anything except 9600 baud.) ++That is @code{gdb TARGET-PROG}, or @code{gdb --baud BAUD TARGET-PROG}. After that, the only ++new command you need to know about is @code{target remote}. It's argument is either ++a device name (usually a serial device, like @file{/dev/ttyb}), or a @code{HOST:PORT} ++descriptor. For example: ++ ++@smallexample ++@ifset man ++@c @file would wrap it as F. ++(gdb) target remote /dev/ttyb ++@end ifset ++@ifclear man ++(gdb) target remote @file{/dev/ttyb} ++@end ifclear ++@end smallexample ++ ++@noindent ++communicates with the server via serial line @file{/dev/ttyb}, and: ++ ++@smallexample ++(gdb) target remote the-target:2345 ++@end smallexample ++ ++@noindent ++communicates via a TCP connection to port 2345 on host `the-target', where ++you previously started up @command{gdbserver} with the same port number. Note that for ++TCP connections, you must start up @command{gdbserver} prior to using the `target remote' ++command, otherwise you may get an error that looks something like ++`Connection refused'. ++@c man end ++ ++@c man begin OPTIONS gdbserver ++You have to supply the name of the program to debug ++and the tty to communicate on; the remote @value{GDBN} will do everything else. ++Any remaining arguments will be passed to the program verbatim. ++@c man end ++ ++@c man begin SEEALSO gdbserver ++@ifset man ++The full documentation for @value{GDBN} is maintained as a Texinfo manual. ++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo ++documentation are properly installed at your site, the command ++ ++@smallexample ++info gdb ++@end smallexample ++ ++should give you access to the complete manual. ++ ++@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++Richard M. Stallman and Roland H. Pesch, July 1991. ++@end ifset ++@c man end ++ ++@node gdbinit man ++@heading gdbinit ++ ++@c man title gdbinit GDB initialization scripts ++ ++@format ++@c man begin SYNOPSIS gdbinit ++@ifset SYSTEM_GDBINIT ++@value{SYSTEM_GDBINIT} ++@end ifset ++ ++~/.gdbinit ++ ++./.gdbinit ++@c man end ++@end format ++ ++@c man begin DESCRIPTION gdbinit ++These files contain @value{GDBN} commands to automatically execute during ++@value{GDBN} startup. The lines of contents are canned sequences of commands, ++described in ++@ifset man ++the @value{GDBN} manual in node @code{Sequences} ++-- shell command @code{info -f gdb -n Sequences}. ++@end ifset ++@ifclear man ++@ref{Sequences}. ++@end ifclear ++ ++Please read more in ++@ifset man ++the @value{GDBN} manual in node @code{Startup} ++-- shell command @code{info -f gdb -n Startup}. ++@end ifset ++@ifclear man ++@ref{Startup}. ++@end ifclear ++ ++@table @env ++@ifset SYSTEM_GDBINIT ++@item @value{SYSTEM_GDBINIT} ++@end ifset ++@ifclear SYSTEM_GDBINIT ++@item (not enabled with @code{--with-system-gdbinit} during compilation) ++@end ifclear ++System-wide initialization file. It is executed unless user specified ++@value{GDBN} option @code{-nx} or @code{-n}. ++See more in ++@ifset man ++the @value{GDBN} manual in node @code{System-wide configuration} ++-- shell command @code{info -f gdb -n 'System-wide configuration'}. ++@end ifset ++@ifclear man ++@ref{System-wide configuration}. ++@end ifclear ++ ++@item ~/.gdbinit ++User initialization file. It is executed unless user specified ++@value{GDBN} options @code{-nx}, @code{-n} or @code{-nh}. ++ ++@item ./.gdbinit ++Initialization file for current directory. It may need to be enabled with ++@value{GDBN} security command @code{set auto-load local-gdbinit}. ++See more in ++@ifset man ++the @value{GDBN} manual in node @code{Init File in the Current Directory} ++-- shell command @code{info -f gdb -n 'Init File in the Current Directory'}. ++@end ifset ++@ifclear man ++@ref{Init File in the Current Directory}. ++@end ifclear ++@end table ++@c man end ++ ++@c man begin SEEALSO gdbinit ++@ifset man ++gdb(1), @code{info -f gdb -n Startup} ++ ++The full documentation for @value{GDBN} is maintained as a Texinfo manual. ++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo ++documentation are properly installed at your site, the command ++ ++@smallexample ++info gdb ++@end smallexample ++ ++should give you access to the complete manual. ++ ++@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, ++Richard M. Stallman and Roland H. Pesch, July 1991. ++@end ifset ++@c man end ++ + @include gpl.texi + + @node GNU Free Documentation License +### src/gdb/gdbserver/ChangeLog 2013/03/22 14:52:26 1.702 +### src/gdb/gdbserver/ChangeLog 2013/04/05 20:01:33 1.703 +## -1,3 +1,10 @@ ++2013-04-05 Jan Kratochvil ++ ++ Convert man pages to texinfo, new gdbinit.5 texinfo page. ++ * Makefile.in (install-only): Remove $(man1dir) and gdbserver.1 ++ installation. ++ * gdbserver.1: Remove. ++ + 2013-03-22 Pedro Alves + + * linux-low.c (handle_extended_wait): Don't call +--- src/gdb/gdbserver/Makefile.in 2013/03/15 17:30:27 1.145 ++++ src/gdb/gdbserver/Makefile.in 2013/04/05 20:01:33 1.146 +@@ -252,8 +252,6 @@ + fi; \ + $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \ + $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \ +- $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(man1dir); \ +- $(INSTALL_DATA) $(srcdir)/gdbserver.1 $(DESTDIR)$(man1dir)/$$n.1 + @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do + + uninstall: force + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00057.html + +### src/gdb/doc/ChangeLog 2013/04/05 20:01:33 1.1433 +### src/gdb/doc/ChangeLog 2013/04/05 20:02:58 1.1434 +## -1,5 +1,10 @@ + 2013-04-05 Jan Kratochvil + ++ * gdb.texinfo (gdb man): Mention option -p. Include Fortran to ++ the list of supported languages. ++ ++2013-04-05 Jan Kratochvil ++ + Convert man pages to texinfo, new gdbinit.5 texinfo page. + * Makefile.in (mandir, man1dir, man5dir, SYSTEM_GDBINIT, MANCONF, + (TEXI2POD, POD2MAN1, POD2MAN5, MAN1S, MAN5S, MANS, man): New. +--- src/gdb/doc/gdb.texinfo 2013/04/05 20:01:33 1.1070 ++++ src/gdb/doc/gdb.texinfo 2013/04/05 20:02:58 1.1071 +@@ -41623,8 +41623,9 @@ + [@option{-b}@w{ }@var{bps}] + [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}] + [@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}] +-[@option{-c}@w{ }@var{core}] [@option{-x}@w{ }@var{cmds}] +- [@option{-d}@w{ }@var{dir}] [@var{prog}|@var{core}|@var{procID}] ++[@option{-c}@w{ }@var{core}] [@option{-p}@w{ }@var{procID}] ++ [@option{-x}@w{ }@var{cmds}] [@option{-d}@w{ }@var{dir}] ++[@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}] + @c man end + + @c man begin DESCRIPTION gdb +@@ -41650,8 +41651,8 @@ + effects of one bug and go on to learn about another. + @end itemize + +-You can use @value{GDBN} to debug programs written in C, C@t{++}, and Modula-2. +-Fortran support will be added when a GNU Fortran compiler is ready. ++You can use @value{GDBN} to debug programs written in C, C@t{++}, Fortran and ++Modula-2. + + @value{GDBN} is invoked with the shell command @code{gdb}. Once started, it reads + commands from the terminal until you tell it to exit with the @value{GDBN} +@@ -41677,11 +41678,13 @@ + + @smallexample + gdb program 1234 ++gdb -p 1234 + @end smallexample + + @noindent + would attach @value{GDBN} to process @code{1234} (unless you also have a file + named @file{1234}; @value{GDBN} does check for a core file first). ++With option @option{-p} you can omit the @var{program} filename. + + Here are some of the most frequently needed @value{GDBN} commands: + + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00064.html + +### src/gdb/doc/ChangeLog 2013/04/05 20:02:58 1.1434 +### src/gdb/doc/ChangeLog 2013/04/06 08:58:53 1.1435 +## -1,3 +1,11 @@ ++2013-04-06 Jan Kratochvil ++ Eli Zaretskii ++ ++ * gdb.texinfo (gdbserver man): Rename tty to comm. Swap --attach ++ parameters order. Remove "On some targets" for --attach. Document the ++ --multi parameter and extended-remote command. Document all the ++ options. ++ + 2013-04-05 Jan Kratochvil + + * gdb.texinfo (gdb man): Mention option -p. Include Fortran to +--- src/gdb/doc/gdb.texinfo 2013/04/05 20:02:58 1.1071 ++++ src/gdb/doc/gdb.texinfo 2013/04/06 08:58:53 1.1072 +@@ -41867,9 +41867,11 @@ + @c man title gdbserver Remote Server for the GNU Debugger + @format + @c man begin SYNOPSIS gdbserver +-gdbserver @var{tty} @var{prog} [@var{args}@dots{}] ++gdbserver @var{comm} @var{prog} [@var{args}@dots{}] + +-gdbserver @var{tty} --attach @var{PID} ++gdbserver --attach @var{comm} @var{pid} ++ ++gdbserver --multi @var{comm} + @c man end + @end format + +@@ -41929,16 +41931,25 @@ + you chose a port number that conflicts with another service, @command{gdbserver} will + print an error message and exit. + +-On some targets, @command{gdbserver} can also attach to running programs. ++@command{gdbserver} can also attach to running programs. + This is accomplished via the @option{--attach} argument. The syntax is: + + @smallexample +-target> gdbserver @var{comm} --attach @var{pid} ++target> gdbserver --attach @var{comm} @var{pid} + @end smallexample + + @var{pid} is the process ID of a currently running process. It isn't + necessary to point @command{gdbserver} at a binary for the running process. + ++To start @code{gdbserver} without supplying an initial command to run ++or process ID to attach, use the @option{--multi} command line option. ++In such case you should connect using @kbd{target extended-remote} to start ++the program you want to debug. ++ ++@smallexample ++target> gdbserver --multi @var{comm} ++@end smallexample ++ + @ifclear man + @subheading Usage (host side) + @end ifclear +@@ -41951,7 +41962,8 @@ + would, with the target program as the first argument. (You may need to use the + @option{--baud} option if the serial line is running at anything except 9600 baud.) + That is @code{gdb TARGET-PROG}, or @code{gdb --baud BAUD TARGET-PROG}. After that, the only +-new command you need to know about is @code{target remote}. It's argument is either ++new command you need to know about is @code{target remote} ++(or @code{target extended-remote}). Its argument is either + a device name (usually a serial device, like @file{/dev/ttyb}), or a @code{HOST:PORT} + descriptor. For example: + +@@ -41978,12 +41990,131 @@ + TCP connections, you must start up @command{gdbserver} prior to using the `target remote' + command, otherwise you may get an error that looks something like + `Connection refused'. ++ ++@command{gdbserver} can also debug multiple inferiors at once, ++described in ++@ifset man ++the @value{GDBN} manual in node @code{Inferiors and Programs} ++-- shell command @code{info -f gdb -n 'Inferiors and Programs'}. ++@end ifset ++@ifclear man ++@ref{Inferiors and Programs}. ++@end ifclear ++In such case use the @code{extended-remote} @value{GDBN} command variant: ++ ++@smallexample ++(gdb) target extended-remote the-target:2345 ++@end smallexample ++ ++The @command{gdbserver} option @option{--multi} may or may not be used in such ++case. + @c man end + + @c man begin OPTIONS gdbserver +-You have to supply the name of the program to debug +-and the tty to communicate on; the remote @value{GDBN} will do everything else. +-Any remaining arguments will be passed to the program verbatim. ++There are three different modes for invoking @command{gdbserver}: ++ ++@itemize @bullet ++ ++@item ++Debug a specific program specified by its program name: ++ ++@smallexample ++gdbserver @var{comm} @var{prog} [@var{args}@dots{}] ++@end smallexample ++ ++The @var{comm} parameter specifies how should the server communicate ++with @value{GDBN}; it is either a device name (to use a serial line), ++a TCP port number (@code{:1234}), or @code{-} or @code{stdio} to use ++stdin/stdout of @code{gdbserver}. Specify the name of the program to ++debug in @var{prog}. Any remaining arguments will be passed to the ++program verbatim. When the program exits, @value{GDBN} will close the ++connection, and @code{gdbserver} will exit. ++ ++@item ++Debug a specific program by specifying the process ID of a running ++program: ++ ++@smallexample ++gdbserver --attach @var{comm} @var{pid} ++@end smallexample ++ ++The @var{comm} parameter is as described above. Supply the process ID ++of a running program in @var{pid}; @value{GDBN} will do everything ++else. Like with the previous mode, when the process @var{pid} exits, ++@value{GDBN} will close the connection, and @code{gdbserver} will exit. ++ ++@item ++Multi-process mode -- debug more than one program/process: ++ ++@smallexample ++gdbserver --multi @var{comm} ++@end smallexample ++ ++In this mode, @value{GDBN} can instruct @command{gdbserver} which ++command(s) to run. Unlike the other 2 modes, @value{GDBN} will not ++close the connection when a process being debugged exits, so you can ++debug several processes in the same session. ++@end itemize ++ ++In each of the modes you may specify these options: ++ ++@table @env ++ ++@item --help ++List all options, with brief explanations. ++ ++@item --version ++This option causes @command{gdbserver} to print its version number and exit. ++ ++@item --attach ++@command{gdbserver} will attach to a running program. The syntax is: ++ ++@smallexample ++target> gdbserver --attach @var{comm} @var{pid} ++@end smallexample ++ ++@var{pid} is the process ID of a currently running process. It isn't ++necessary to point @command{gdbserver} at a binary for the running process. ++ ++@item --multi ++To start @code{gdbserver} without supplying an initial command to run ++or process ID to attach, use this command line option. ++Then you can connect using @kbd{target extended-remote} and start ++the program you want to debug. The syntax is: ++ ++@smallexample ++target> gdbserver --multi @var{comm} ++@end smallexample ++ ++@item --debug ++Instruct @code{gdbserver} to display extra status information about the debugging ++process. ++This option is intended for @code{gdbserver} development and for bug reports to ++the developers. ++ ++@item --remote-debug ++Instruct @code{gdbserver} to display remote protocol debug output. ++This option is intended for @code{gdbserver} development and for bug reports to ++the developers. ++ ++@item --wrapper ++Specify a wrapper to launch programs ++for debugging. The option should be followed by the name of the ++wrapper, then any command-line arguments to pass to the wrapper, then ++@kbd{--} indicating the end of the wrapper arguments. ++ ++@item --once ++By default, @command{gdbserver} keeps the listening TCP port open, so that ++additional connections are possible. However, if you start @code{gdbserver} ++with the @option{--once} option, it will stop listening for any further ++connection attempts after connecting to the first @value{GDBN} session. ++ ++@c --disable-packet is not documented for users. ++ ++@c --disable-randomization and --no-disable-randomization are superseded by ++@c QDisableRandomization. ++ ++@end table + @c man end + + @c man begin SEEALSO gdbserver + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00065.html + +### src/gdb/doc/ChangeLog 2013/04/06 08:58:53 1.1435 +### src/gdb/doc/ChangeLog 2013/04/06 15:52:06 1.1436 +## -1,4 +1,8 @@ + 2013-04-06 Jan Kratochvil ++ ++ * Makefile.in (POD2MAN1, POD2MAN5): Replace $(VERSION) by ../version.in. ++ ++2013-04-06 Jan Kratochvil + Eli Zaretskii + + * gdb.texinfo (gdbserver man): Rename tty to comm. Swap --attach +--- src/gdb/doc/Makefile.in 2013/04/05 20:01:33 1.58 ++++ src/gdb/doc/Makefile.in 2013/04/06 15:52:06 1.59 +@@ -172,9 +172,9 @@ + $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) + + POD2MAN1 = pod2man --center="GNU Development Tools" \ +- --release="gdb-$(VERSION)" --section=1 ++ --release="gdb-`sed q $(srcdir)/../version.in`" --section=1 + POD2MAN5 = pod2man --center="GNU Development Tools" \ +- --release="gdb-$(VERSION)" --section=5 ++ --release="gdb-`sed q $(srcdir)/../version.in`" --section=5 + + # List of man pages generated from gdb.texi + MAN1S = gdb.1 gdbserver.1 + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00068.html + +### src/gdb/gdbserver/ChangeLog 2013/04/05 20:01:33 1.703 +### src/gdb/gdbserver/ChangeLog 2013/04/07 05:53:21 1.704 +## -1,3 +1,7 @@ ++2013-04-07 Jan Kratochvil ++ ++ * Makefile.in (install-only): Fix make install regression. ++ + 2013-04-05 Jan Kratochvil + + Convert man pages to texinfo, new gdbinit.5 texinfo page. +--- src/gdb/gdbserver/Makefile.in 2013/04/05 20:01:33 1.146 ++++ src/gdb/gdbserver/Makefile.in 2013/04/07 05:53:22 1.147 +@@ -251,7 +251,7 @@ + $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \ + fi; \ + $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \ +- $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \ ++ $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) + @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do + + uninstall: force + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00069.html + +### src/gdb/doc/ChangeLog 2013/04/06 15:52:06 1.1436 +### src/gdb/doc/ChangeLog 2013/04/07 06:04:58 1.1437 +## -2,6 +2,9 @@ + + * Makefile.in (POD2MAN1, POD2MAN5): Replace $(VERSION) by ../version.in. + ++ * Makefile.in (install-man1, install-man5, uninstall-man1) ++ (uninstall-man5): Replace $(MANS) by $(MAN1S) and $(MAN5S) respectively. ++ + 2013-04-06 Jan Kratochvil + Eli Zaretskii + +--- src/gdb/doc/Makefile.in 2013/04/06 15:52:06 1.59 ++++ src/gdb/doc/Makefile.in 2013/04/07 06:04:58 1.60 +@@ -268,7 +268,7 @@ + + install-man1: $(MAN1S) + test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)" +- @list='$(MANS)'; for p in $$list; do \ ++ @list='$(MAN1S)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=`echo $$p | sed -e 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \ +@@ -277,7 +277,7 @@ + + install-man5: $(MAN5S) + test -z "$(man5dir)" || $(mkinstalldirs) "$(DESTDIR)$(man5dir)" +- @list='$(MANS)'; for p in $$list; do \ ++ @list='$(MAN5S)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=`echo $$p | sed -e 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man5dir)/$$f'"; \ +@@ -288,7 +288,7 @@ + + uninstall-man1: + @test -n "$(man1dir)" || exit 0; \ +- files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \ ++ files=`{ l2='$(MAN1S)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ +@@ -298,7 +298,7 @@ + + uninstall-man5: + @test -n "$(man5dir)" || exit 0; \ +- files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \ ++ files=`{ l2='$(MAN5S)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.5[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + + + +http://sourceware.org/ml/gdb-cvs/2013-04/msg00070.html + +### src/gdb/doc/ChangeLog 2013/04/07 06:04:58 1.1437 +### src/gdb/doc/ChangeLog 2013/04/07 06:20:19 1.1438 +## -5,6 +5,8 @@ + * Makefile.in (install-man1, install-man5, uninstall-man1) + (uninstall-man5): Replace $(MANS) by $(MAN1S) and $(MAN5S) respectively. + ++ * Makefile.in (gdb.1, gdbserver.1, gdbinit.5): Use $(srcdir). ++ + 2013-04-06 Jan Kratochvil + Eli Zaretskii + +--- src/gdb/doc/Makefile.in 2013/04/07 06:04:58 1.60 ++++ src/gdb/doc/Makefile.in 2013/04/07 06:20:19 1.61 +@@ -593,21 +593,21 @@ + # Man pages + gdb.1: $(GDB_DOC_FILES) + touch $@ +- -$(TEXI2POD) $(MANCONF) -Dgdb < gdb.texinfo > gdb.pod ++ -$(TEXI2POD) $(MANCONF) -Dgdb < $(srcdir)/gdb.texinfo > gdb.pod + -($(POD2MAN1) gdb.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gdb.pod + + gdbserver.1: $(GDB_DOC_FILES) + touch $@ +- -$(TEXI2POD) $(MANCONF) -Dgdbserver < gdb.texinfo > gdbserver.pod ++ -$(TEXI2POD) $(MANCONF) -Dgdbserver < $(srcdir)/gdb.texinfo > gdbserver.pod + -($(POD2MAN1) gdbserver.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gdbserver.pod + + gdbinit.5: $(GDB_DOC_FILES) + touch $@ +- -$(TEXI2POD) $(MANCONF) -Dgdbinit < gdb.texinfo > gdbinit.pod ++ -$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod + -($(POD2MAN5) gdbinit.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gdbinit.pod + + + +https://bugzilla.redhat.com/show_bug.cgi?id=967915 +http://sourceware.org/ml/gdb-cvs/2013-05/msg00146.html + +### src/gdb/ChangeLog 2013/05/17 18:09:05 1.15569 +### src/gdb/ChangeLog 2013/05/17 23:05:00 1.15570 +## -1,3 +1,9 @@ ++2013-05-17 Edjunior Machado ++ ++ * ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Check if the ++ region is ok for a hardware watchpoint using the new ptrace interface ++ on Power servers. ++ + 2013-05-17 Doug Evans + + * NEWS: Mention new maintenance commands check-symtabs, and +--- src/gdb/ppc-linux-nat.c 2013/05/07 07:43:33 1.119 ++++ src/gdb/ppc-linux-nat.c 2013/05/17 23:05:00 1.120 +@@ -1503,16 +1503,19 @@ + to determine the hardcoded watchable region for watchpoints. */ + if (have_ptrace_booke_interface ()) + { +- /* DAC-based processors (i.e., embedded processors), like the PowerPC 440 +- have ranged watchpoints and can watch any access within an arbitrary +- memory region. This is useful to watch arrays and structs, for +- instance. It takes two hardware watchpoints though. */ ++ /* Embedded DAC-based processors, like the PowerPC 440 have ranged ++ watchpoints and can watch any access within an arbitrary memory ++ region. This is useful to watch arrays and structs, for instance. It ++ takes two hardware watchpoints though. */ + if (len > 1 +- && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE) ++ && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE ++ && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) + return 2; +- else if (booke_debug_info.data_bp_alignment +- && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) +- + booke_debug_info.data_bp_alignment)) ++ /* Server processors provide one hardware watchpoint and addr+len should ++ fall in the watchable region provided by the ptrace interface. */ ++ if (booke_debug_info.data_bp_alignment ++ && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) ++ + booke_debug_info.data_bp_alignment)) + return 0; + } + /* addr+len must fall in the 8 byte watchable region for DABR-based + + + +commit 1aa4cd774ca674ee6061e2068a410bb67c8bc812 +Author: Andrew Pinski +Date: Thu Sep 12 07:14:37 2013 +0000 + + 2013-09-12 Andrew Pinski + + * aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Zero out regs. + +diff --git a/gdb/ChangeLog b/gdb/ChangeLog +index fa3de16..903dcba 100644 +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,7 @@ ++2013-09-12 Andrew Pinski ++ ++ * aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Zero out regs. ++ + 2013-09-10 Andreas Arnez + + * config/s390/s390.mh (NATDEPFILES): Add linux-waitpid.o. +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index 846f156..f685619 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -312,6 +312,7 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state, + const CORE_ADDR *addr; + const unsigned int *ctrl; + ++ memset (®s, 0, sizeof (regs)); + iov.iov_base = ®s; + iov.iov_len = sizeof (regs); + count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs; + + + +commit 05feb1933f80f2d55e132adc657d3152947af3d1 +Author: Will Newton +Date: Thu Oct 10 10:40:42 2013 +0000 + + gdb/aarch64-linux-tdep.c: Call linux_init_abi. + + If we are running on a Linux platform we should call linux_init_abi + in order to get all the useful hooks it enables. + + gdb/ChangeLog: + + 2013-10-10 Will Newton + + * aarch64-linux-tdep.c (aarch64_linux_init_abi): Call + linux_init_abi. + +diff --git a/gdb/ChangeLog b/gdb/ChangeLog +index 4372579..7a41967 100644 +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,8 @@ ++2013-10-10 Will Newton ++ ++ * aarch64-linux-tdep.c (aarch64_linux_init_abi): Call ++ linux_init_abi. ++ + 2013-10-10 Joel Brobecker + + * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index 8e66425..bcfcce2 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -270,6 +270,8 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + + tdep->lowest_pc = 0x8000; + ++ linux_init_abi (info, gdbarch); ++ + set_solib_svr4_fetch_link_map_offsets (gdbarch, + svr4_lp64_fetch_link_map_offsets); + diff --git a/SOURCES/gdb-vdso-gcore.patch b/SOURCES/gdb-vdso-gcore.patch new file mode 100644 index 0000000..4fdbc81 --- /dev/null +++ b/SOURCES/gdb-vdso-gcore.patch @@ -0,0 +1,56 @@ +http://sourceware.org/ml/gdb-patches/2013-05/msg00042.html +Subject: [patch] Fix gcore for vDSO (on ppc64) + +Hi, + +on ppc64 GNU/Linux one gets in live process or kernel-generated core file: + +#0 0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6 +#1 0x000000001000080c in handle_alrm (signo=14) at small.c:16 +#2 +#3 0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6 +#4 0x0000000010000914 in main (argc=2, argv=0x3fffcd00dec8) at small.c:32 + +while with gcore generated core file one gets: + +#0 0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6 +#1 0x000000001000080c in handle_alrm (signo=14) at small.c:16 +#2 0x00003fff9ea70448 in ?? () +#3 0x0000000010000914 in main (argc=2, argv=0x3fffcd00dec8) at small.c:32 + +This is because on ppc64 GNU/Linux the signal handler frame is in vDSO (and +not in libc as on x86_64 GNU/Linux). And if one has kernel-debuginfo +installed GDB gcore thinks it can omit the vDSO page from core file. + +As vDSO cannot be reliably found from link_map it should be rather fully +present in the core file. Which also gcore_create_callback tries to do but it +gets mistaken by the separate debug info. + +It seems pretty obvious patch to me. + + +Thanks, +Jan + + +gdb/ +2013-05-03 Jan Kratochvil + + * gcore.c (gcore_create_callback): Ignore sections with + separate_debug_objfile_backlink != NULL. + +--- gdb-7.6-orig/gdb/gcore.c 2013-01-01 07:32:42.000000000 +0100 ++++ gdb-7.6/gdb/gcore.c 2013-05-03 03:31:34.795312996 +0200 +@@ -428,8 +428,9 @@ gcore_create_callback (CORE_ADDR vaddr, + + This BFD was synthesized from reading target memory, + we don't want to omit that. */ +- if (((vaddr >= start && vaddr + size <= end) +- || (start >= vaddr && end <= vaddr + size)) ++ if (objfile->separate_debug_objfile_backlink == NULL ++ && ((vaddr >= start && vaddr + size <= end) ++ || (start >= vaddr && end <= vaddr + size)) + && !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY)) + { + flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS); + diff --git a/SOURCES/gdb-x86_64-i386-syscall-restart.patch b/SOURCES/gdb-x86_64-i386-syscall-restart.patch new file mode 100644 index 0000000..af3cccd --- /dev/null +++ b/SOURCES/gdb-x86_64-i386-syscall-restart.patch @@ -0,0 +1,121 @@ +http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html +Subject: [patch] Fix syscall restarts for amd64->i386 biarch + +Hi, + +tested only on recent Linux kernels, it should apply also on vanilla ones. +There were various changes of the kernels behavior in the past. + +FSF GDB HEAD state: +kernel debugger inferior state +x86_64 x86_64 x86_64 PASS +x86_64 x86_64 i386 FAIL without this patch, PASS with this patch +x86_64 i386 i386 PASS on recent kernels + (FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12) + (PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64) +i386 i386 i386 PASS + + +Currently gdb.base/interrupt.exp fails on amd64 host running under +--target_board unix/-m32 with: + continue + Continuing. + Unknown error 512 + +: +/* + * 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_bfd_arch_info (gdbarch)->bits_per_word == 32) ++ { ++ /* Sign-extend %eax as during return from a syscall it is being checked ++ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by ++ 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/SOURCES/gdbinit b/SOURCES/gdbinit new file mode 100644 index 0000000..b59fb0d --- /dev/null +++ b/SOURCES/gdbinit @@ -0,0 +1,9 @@ +# System-wide GDB initialization file. +python +import glob +# glob.iglob is not available in python-2.4 (RHEL-5). +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.gdb'): + gdb.execute('source %s' % f) +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.py'): + gdb.execute('source %s' % f) +end diff --git a/SOURCES/gdbtui b/SOURCES/gdbtui new file mode 100755 index 0000000..88f9d55 --- /dev/null +++ b/SOURCES/gdbtui @@ -0,0 +1,2 @@ +#! /bin/sh +exec gdb -tui "$@" diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec new file mode 100644 index 0000000..e6f4920 --- /dev/null +++ b/SPECS/gdb.spec @@ -0,0 +1,4790 @@ +# rpmbuild parameters: +# --with testsuite: Run the testsuite (biarch if possible). Default is without. +# --without python: No python support. +# --with profile: gcc -fprofile-generate / -fprofile-use: Before better +# workload gets run it decreases the general performance now. +# --define 'scl somepkgname': Independent packages by scl-utils-build. + +# RHEL-5 was the last not providing `/etc/rpm/macros.dist'. +%if 0%{!?dist:1} +%global rhel 5 +%global dist .el5 +%global el5 1 +%endif +# RHEL-5 Brew does not set %{el5}, BZ 1002198 tps-srpmtest does not set %{rhel}. +%if "%{?dist}" == ".el5" +%global rhel 5 +%global el5 1 +%endif + +%{?scl:%scl_package gdb} +%{!?scl: + %global pkg_name %{name} + %global _root_prefix %{_prefix} + %global _root_datadir %{_datadir} + %global _root_bindir %{_bindir} +} + +Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages +Name: %{?scl_prefix}gdb + +#global snap 20130423 +# Freeze it when GDB gets branched +%global snapsrc 20130312 +# See timestamp of source gnulib installed into gdb/gnulib/ . +%global snapgnulib 20121213 +Version: 7.6.1 + +# The release always contains a leading reserved number, start it at 1. +# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. +Release: 45%{?dist} + +License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain +Group: Development/Debuggers +# Do not provide URL for snapshots as the file lasts there only for 2 days. +# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 +Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 +Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +URL: http://gnu.org/software/gdb/ + +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name} +%endif + +# For our convenience +%global gdb_src %{pkg_name}-%{version} +%global gdb_build build-%{_target_platform} +%global gdb_docdir %{_docdir}/%{name}-doc-%{version} + +# Make sure we get rid of the old package gdb64, now that we have unified +# support for 32-64 bits in one single 64-bit gdb. +%ifarch ppc64 +Obsoletes: gdb64 < 5.3.91 +%endif + +%global have_inproctrace 0 +%ifarch %{ix86} x86_64 +# RHEL-5.i386: [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);] +# undefined reference to `__sync_val_compare_and_swap_4' +%if 0%{!?el5:1} +%global have_inproctrace 1 +%endif # 0%{!?el5:1} +%endif # %{ix86} x86_64 + +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# eu-strip: -g recognizes .gdb_index as a debugging section. (#631997) +Conflicts: elfutils < 0.149 +%endif + +# https://fedorahosted.org/fpc/ticket/43 https://fedorahosted.org/fpc/ticket/109 +Provides: bundled(libiberty) = %{snapsrc} +Provides: bundled(gnulib) = %{snapgnulib} +Provides: bundled(binutils) = %{snapsrc} +# https://fedorahosted.org/fpc/ticket/130 +Provides: bundled(md5-gcc) = %{snapsrc} + +# GDB patches have the format `gdb--bz-.patch'. +# They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb). + +#= +#push=Should be pushed upstream. +#maybepush=Should be pushed upstream unless it got obsoleted there. +#fedora=Should stay as a Fedora patch. +#ia64=Drop after RHEL-5 rebases and rebuilds are no longer meaningful. +#fedoratest=Keep it in Fedora only as a regression test safety. +#+ppc=Specific for ppc32/ppc64/ppc* +#+work=Requires some nontrivial work. + +# Cleanup any leftover testsuite processes as it may stuck mock(1) builds. +#=push +Source2: gdb-orphanripper.c + +# Man page for gstack(1). +#=push +Source3: gdb-gstack.man + +# /etc/gdbinit (from Debian but with Fedora compliant location). +#=fedora +Source4: gdbinit + +# libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental). +%global libstdcxxpython gdb-libstdc++-v3-python-r155978 +Source5: %{libstdcxxpython}.tar.bz2 + +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +Source6: gdbtui + +# Work around out-of-date dejagnu that does not have KFAIL +#=drop: That dejagnu is too old to be supported. +Patch1: gdb-6.3-rh-dummykfail-20041202.patch + +# Match the Fedora's version info. +#=fedora +Patch2: gdb-6.3-rh-testversion-20041202.patch + +# Check that libunwind works - new test then fix +#=ia64 +Patch3: gdb-6.3-rh-testlibunwind-20041202.patch + +# Better parse 64-bit PPC system call prologues. +#=maybepush+ppc: Write new testcase. +Patch105: gdb-6.3-ppc64syscall-20040622.patch + +# Include the pc's section when doing a symbol lookup so that the +# correct symbol is found. +#=maybepush: Write new testcase. +Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch + +# Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs. +#=push+work: It is a bit difficult patch, a part is ppc specific. +Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +# Make upstream `set scheduler-locking step' as default. +#=push+work: How much is scheduler-locking relevant after non-stop? +Patch260: gdb-6.6-scheduler_locking-step-is-default.patch + +# Add a wrapper script to GDB that implements pstack using the +# --readnever option. +#=push+work: with gdbindex maybe --readnever should no longer be used. +Patch118: gdb-6.3-gstack-20050411.patch + +# VSYSCALL and PIE +#=fedoratest +Patch122: gdb-6.3-test-pie-20050107.patch +#=push: May get obsoleted by Tom's unrelocated objfiles patch. +Patch389: gdb-archer-pie-addons.patch +#=push+work: Breakpoints disabling matching should not be based on address. +Patch394: gdb-archer-pie-addons-keep-disabled.patch + +# Get selftest working with sep-debug-info +#=fedoratest +Patch125: gdb-6.3-test-self-20050110.patch + +# Test support of multiple destructors just like multiple constructors +#=fedoratest +Patch133: gdb-6.3-test-dtorfix-20050121.patch + +# Fix to support executable moving +#=fedoratest +Patch136: gdb-6.3-test-movedir-20050125.patch + +# Fix gcore for threads +#=ia64 +Patch140: gdb-6.3-gcore-thread-20050204.patch + +# Test sibling threads to set threaded watchpoints for x86 and x86-64 +#=fedoratest +Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch + +# Do not issue warning message about first page of storage for ia64 gcore +#=ia64 +Patch153: gdb-6.3-ia64-gcore-page0-20050421.patch + +# IA64 sigtramp prev register patch +#=ia64 +Patch158: gdb-6.3-ia64-sigtramp-frame-20050708.patch + +# IA64 gcore speed-up patch +#=ia64 +Patch160: gdb-6.3-ia64-gcore-speedup-20050714.patch + +# Notify observers that the inferior has been created +#=fedoratest +Patch161: gdb-6.3-inferior-notification-20050721.patch + +# Fix ia64 info frame bug +#=ia64 +Patch162: gdb-6.3-ia64-info-frame-fix-20050725.patch + +# Verify printing of inherited members test +#=fedoratest +Patch163: gdb-6.3-inheritancetest-20050726.patch + +# Add readnever option +#=push +Patch164: gdb-6.3-readnever-20050907.patch + +# Fix ia64 gdb problem with user-specified SIGILL handling +#=ia64 +Patch169: gdb-6.3-ia64-sigill-20051115.patch + +# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661). +#=push+work: There was some mail thread about it, this patch may be a hack. +Patch188: gdb-6.5-bz203661-emit-relocs.patch + +# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). +#=push+work: It should be replaced by existing uncommitted Roland's glibc patch for TLS without libpthreads. +Patch194: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + +# Fix TLS symbols resolving for shared libraries with a relative pathname. +# The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. +#=fedoratest+work: One should recheck if it is really fixed upstream. +Patch196: gdb-6.5-sharedlibrary-path.patch + +# Suggest fixing your target architecture for gdbserver(1) (BZ 190810). +# FIXME: It could be autodetected. +#=push+work: There are more such error cases that can happen. +Patch199: gdb-6.5-bz190810-gdbserver-arch-advice.patch + +# Testcase for deadlocking on last address space byte; for corrupted backtraces. +#=fedoratest +Patch211: gdb-6.5-last-address-space-byte-test.patch + +# Improved testsuite results by the testsuite provided by the courtesy of BEA. +#=fedoratest+work: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful. +Patch208: gdb-6.5-BEA-testsuite.patch + +# Fix readline segfault on excessively long hand-typed lines. +#=fedoratest +Patch213: gdb-6.5-readline-long-line-crash-test.patch + +# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711). +#=fedora +Patch214: gdb-6.5-bz216711-clone-is-outermost.patch + +# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379). +#=fedoratest +Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch + +# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). +#=fedora +Patch217: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch + +# Find symbols properly at their original (included) file (BZ 109921). +#=fedoratest +Patch225: gdb-6.5-bz109921-DW_AT_decl_file-test.patch + +# Update PPC unwinding patches to their upstream variants (BZ 140532). +#=fedoratest+ppc +Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch + +# Testcase for exec() from threaded program (BZ 202689). +#=fedoratest +Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch + +# Backported fixups post the source tarball. +#Xdrop: Just backports. +Patch232: gdb-upstream.patch +Patch828: gdb-upstream-man-gcore-1of2.patch +Patch829: gdb-upstream-man-gcore-2of2.patch +# Backported Python frame filters (Phil Muldoon). +Patch836: gdb-upstream-framefilters-1of2.patch +Patch837: gdb-upstream-framefilters-2of2.patch + +# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). +#=fedoratest+ppc +Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch + +# Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) +#=push+work: Upstream should have backward compat. API: libc-alpha: <20070127104539.GA9444@.*> +Patch235: gdb-6.3-bz231832-obstack-2gb.patch + +# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). +#=fedoratest +Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch + +# Notify user of a child forked process being detached (BZ 235197). +#=push: This is more about discussion if/what should be printed. +Patch247: gdb-6.6-bz235197-fork-detach-info.patch + +# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". +#=fedoratest +Patch254: gdb-6.6-testsuite-timeouts.patch + +# Support for stepping over PPC atomic instruction sequences (BZ 237572). +#=fedoratest +Patch258: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch + +# Test kernel VDSO decoding while attaching to an i386 process. +#=fedoratest +Patch263: gdb-6.3-attach-see-vdso-test.patch + +# Test leftover zombie process (BZ 243845). +#=fedoratest +Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch + +# New locating of the matching binaries from the pure core file (build-id). +#=push +Patch274: gdb-6.6-buildid-locate.patch +# Fix loading of core files without build-ids but with build-ids in executables. +#=push +Patch659: gdb-6.6-buildid-locate-solib-missing-ids.patch +#=push +Patch353: gdb-6.6-buildid-locate-rpm.patch +#=push +Patch415: gdb-6.6-buildid-locate-core-as-arg.patch +# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). +#=push +Patch519: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). +Patch833: gdb-6.6-buildid-locate-rpm-scl.patch + +# Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875). +#=push +Patch276: gdb-6.6-bfd-vdso8k.patch + +# Fix displaying of numeric char arrays as strings (BZ 224128). +#=fedoratest: But it is failing anyway, one should check the behavior more. +Patch282: gdb-6.7-charsign-test.patch + +# Test PPC hiding of call-volatile parameter register. +#=fedoratest+ppc +Patch284: gdb-6.7-ppc-clobbered-registers-O2-test.patch + +# Testsuite fixes for more stable/comparable results. +#=fedoratest +Patch287: gdb-6.7-testsuite-stable-results.patch + +# Test ia64 memory leaks of the code using libunwind. +#=fedoratest +Patch289: gdb-6.5-ia64-libunwind-leak-test.patch + +# Test hiding unexpected breakpoints on intentional step commands. +#=fedoratest +Patch290: gdb-6.5-missed-trap-on-step-test.patch + +# Support DW_TAG_interface_type the same way as DW_TAG_class_type (BZ 426600). +#=fedoratest +Patch294: gdb-6.7-bz426600-DW_TAG_interface_type-test.patch + +# Test gcore memory and time requirements for large inferiors. +#=fedoratest +Patch296: gdb-6.5-gcore-buffer-limit-test.patch + +# Test debugging statically linked threaded inferiors (BZ 239652). +# - It requires recent glibc to work in this case properly. +#=fedoratest +Patch298: gdb-6.6-threads-static-test.patch + +# Test GCORE for shmid 0 shared memory mappings. +#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible. +Patch309: gdb-6.3-mapping-zero-inode-test.patch + +# Test a crash on `focus cmd', `focus prev' commands. +#=fedoratest +Patch311: gdb-6.3-focus-cmd-prev-test.patch + +# Test various forms of threads tracking across exec() (BZ 442765). +#=fedoratest +Patch315: gdb-6.8-bz442765-threaded-exec-test.patch + +# Silence memcpy check which returns false positive (sparc64) +#=push: But it is just a GCC workaround, look up the existing GCC PR for it. +Patch317: gdb-6.8-sparc64-silence-memcpy-check.patch + +# Test a crash on libraries missing the .text section. +#=fedoratest +Patch320: gdb-6.5-section-num-fixup-test.patch + +# Fix register assignments with no GDB stack frames (BZ 436037). +#=push+work: This fix is incorrect. +Patch330: gdb-6.8-bz436037-reg-no-longer-active.patch + +# Make the GDB quit processing non-abortable to cleanup everything properly. +#=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch . +Patch331: gdb-6.8-quit-never-aborts.patch + +# [RHEL5] Workaround kernel for detaching SIGSTOPped processes (BZ 809382). +#=fedora +Patch335: gdb-rhel5-compat.patch + +# [RHEL5,RHEL6] Fix attaching to stopped processes. +#=fedora +Patch337: gdb-6.8-attach-signalled-detach-stopped.patch + +# Test the watchpoints conditionals works. +#=fedoratest +Patch343: gdb-6.8-watchpoint-conditionals-test.patch + +# Fix resolving of variables at locations lists in prelinked libs (BZ 466901). +#=fedoratest +Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch + +# The merged branch `archer-jankratochvil-fedora15' of: +# http://sourceware.org/gdb/wiki/ProjectArcher +#=push+work +Patch349: gdb-archer.patch + +# Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). +# - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. +#=fedoratest +Patch360: gdb-6.8-bz457187-largefile-test.patch + +# New test for step-resume breakpoint placed in multiple threads at once. +#=fedoratest +Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch + +# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. +# Fix regression of undisplayed missing shared libraries caused by a fix for. +#=push+work: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*> +Patch382: gdb-core-open-vdso-warning.patch + +# Fix syscall restarts for amd64->i386 biarch. +#=push +Patch391: gdb-x86_64-i386-syscall-restart.patch + +# Fix stepping with OMP parallel Fortran sections (BZ 533176). +#=push+work: It requires some better DWARF annotations. +Patch392: gdb-bz533176-fortran-omp-step.patch + +# Use gfortran44 when running the testsuite on RHEL-5. +#=fedoratest +Patch393: gdb-rhel5-gcc44.patch + +# Fix regression by python on ia64 due to stale current frame. +#=push +Patch397: gdb-follow-child-stale-parent.patch + +# Workaround ccache making lineno non-zero for command-line definitions. +#=fedoratest: ccache is rarely used and it is even fixed now. +Patch403: gdb-ccache-workaround.patch + +# Testcase for "Do not make up line information" fix by Daniel Jacobowitz. +#=fedoratest +Patch407: gdb-lineno-makeup-test.patch + +# Test power7 ppc disassembly. +#=fedoratest+ppc +Patch408: gdb-ppc-power7-test.patch + +# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866). +# Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866). +#=push+work: It should be fixed properly instead. +Patch417: gdb-bz541866-rwatch-before-run.patch + +# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). +#=push+work: Currently it is still not fully safe. +Patch459: gdb-moribund-utrace-workaround.patch + +# Fix follow-exec for C++ programs (bugreported by Martin Stransky). +#=fedoratest +Patch470: gdb-archer-next-over-throw-cxx-exec.patch + +# Backport DWARF-4 support (BZ 601887, Tom Tromey). +#=fedoratest +Patch475: gdb-bz601887-dwarf4-rh-test.patch + +# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +#=fedoratest +Patch490: gdb-test-bt-cfi-without-die.patch + +# Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey). +#=fedora: Re-check against the upstream version. +Patch491: gdb-gdb-add-index-script.patch + +# Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248). +#=drop+work: Inferior objects should be read in parts, then this patch gets obsoleted. +Patch496: gdb-bz568248-oom-is-error.patch + +# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108). +#=fedoratest +Patch526: gdb-bz634108-solib_address.patch + +# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). +#=fedoratest +Patch542: gdb-test-pid0-core.patch + +# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +#=fedoratest +Patch547: gdb-test-dw2-aranges.patch + +# [archer-keiths-expr-cumulative+upstream] Import C++ testcases. +#=fedoratest +Patch548: gdb-test-expr-cumulative-archer.patch + +# Toolchain on sparc is slightly broken and debuginfo files are generated +# with non 64bit aligned tables/offsets. +# See for example readelf -S ../Xvnc.debug. +# +# As a consenquence calculation of sectp->filepos as used in +# dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer +# that cannot be used directly as done with MMAP. +# Usage will result in a BusError. +# +# While we figure out what's wrong in the toolchain and do a full archive +# rebuild to fix it, we need to be able to use gdb :) +#=push+work +Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch + +# Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). +# Fix crash regression from the dlopen of libpthread.so fix (BZ 911712). +# Fix performance regression when inferior opens many libraries (Gary Benson). +#=drop +Patch718: gdb-dlopen-stap-probe-1of9.patch +Patch719: gdb-dlopen-stap-probe-2of9.patch +Patch720: gdb-dlopen-stap-probe-3of9.patch +Patch721: gdb-dlopen-stap-probe-4of9.patch +Patch722: gdb-dlopen-stap-probe-5of9.patch +Patch723: gdb-dlopen-stap-probe-6of9.patch +Patch822: gdb-dlopen-stap-probe-7of9.patch +Patch827: gdb-dlopen-stap-probe-8of9.patch +Patch619: gdb-dlopen-stap-probe-9of9.patch + +# Work around PR libc/13097 "linux-vdso.so.1" warning message. +#=push +Patch627: gdb-glibc-vdso-workaround.patch + +# Hack for proper PIE run of the testsuite. +#=fedoratest +Patch634: gdb-runtest-pie-override.patch + +# Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131). +#=fedora +Patch642: gdb-readline62-ask-more-rh.patch + +# Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). +#=push +Patch653: gdb-attach-fail-reasons-5of5.patch +#=fedora +Patch657: gdb-attach-fail-reasons-5of5configure.patch + +# Workaround crashes from stale frame_info pointer (BZ 804256). +#=fedora +Patch661: gdb-stale-frame_info.patch + +# Workaround PR libc/14166 for inferior calls of strstr. +#=fedora: Compatibility with RHELs (unchecked which ones). +Patch690: gdb-glibc-strstr-workaround.patch + +# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). +#=fedoratest +#+ppc +Patch698: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch + +# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). +#=fedoratest +Patch703: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch + +# Fix `GDB cannot access struct member whose offset is larger than 256MB' +# (RH BZ 795424). +#=push+work +Patch811: gdb-rhbz795424-bitpos-20of25.patch +Patch812: gdb-rhbz795424-bitpos-21of25.patch +Patch813: gdb-rhbz795424-bitpos-22of25.patch +Patch814: gdb-rhbz795424-bitpos-23of25.patch +Patch816: gdb-rhbz795424-bitpos-25of25.patch +Patch817: gdb-rhbz795424-bitpos-25of25-test.patch +Patch818: gdb-rhbz795424-bitpos-lazyvalue.patch + +# Import regression test for `gdb/findvar.c:417: internal-error: +# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5. +#=fedoratest +Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch + +# Fix gcore for vDSO (on ppc64). +#=drop +Patch834: gdb-vdso-gcore.patch + +# Fix needless expansion of non-gdbindex symtabs (Doug Evans). +#=drop +Patch835: gdb-psymtab-expand.patch + +# [ppc] Support Power8 CPU (IBM, BZ 731875). +#=drop +Patch840: gdb-power8-1of2.patch +Patch841: gdb-power8-2of2.patch + +# Fix crash on 'enable count' (Simon Marchi, BZ 993118). +Patch843: gdb-enable-count-crash.patch + +# Fix the case when GDB leaks memory because value_struct_elt +# does not call check_typedef. (Doug Evans, BZ 15695, filed as +# RH BZ 1013453). +Patch844: gdb-rhbz1013453-value-struct-elt-memory-leak.patch + +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# RL_STATE_FEDORA_GDB would not be found for: +# Patch642: gdb-readline62-ask-more-rh.patch +# --with-system-readline +BuildRequires: readline-devel%{?_isa} >= 6.2-4 +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 + +BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison +BuildRequires: expat-devel%{?_isa} +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: xz-devel%{?_isa} +%endif +%if 0%{!?el5:1} +# dlopen() no longer makes rpm-libs%{?_isa} (it's .so) a mandatory dependency. +BuildRequires: rpm-devel%{?_isa} +%endif # 0%{!?el5:1} +BuildRequires: zlib-devel%{?_isa} libselinux-devel%{?_isa} +%if 0%{!?_without_python:1} +%if 0%{?el5:1} +# This RHEL-5.6 python version got split out python-libs for ppc64. +# RHEL-5 rpm does not support .%{_arch} dependencies. +Requires: python-libs-%{_arch} >= 2.4.3-32.el5 +%endif +BuildRequires: python-devel%{?_isa} +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +# Temporarily before python files get moved to libstdc++.rpm +# libstdc++%{bits_other} is not present in Koji, the .spec script generating +# gdb/python/libstdcxx/ also does not depend on the %{bits_other} files. +BuildRequires: libstdc++%{?_isa} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 +%endif # 0%{!?_without_python:1} +# gdb-doc in PDF: +BuildRequires: texinfo-tex +# Permit rebuilding *.[0-9] files even if they are distributed in gdb-*.tar: +BuildRequires: /usr/bin/pod2man +# PDF doc workaround, see: # https://bugzilla.redhat.com/show_bug.cgi?id=919891 +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: texlive-ec texlive-cm-super +%endif + +# BuildArch would break RHEL-5 by overriding arch and not building noarch. +%if 0%{?el5:1} +ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x +%endif # 0%{?el5:1} + +%if 0%{?_with_testsuite:1} + +# Ensure the devel libraries are installed for both multilib arches. +%global bits_local %{?_isa} +%global bits_other %{?_isa} +%if 0%{!?el5:1} +%ifarch s390x +%global bits_other (%{__isa_name}-32) +%else #!s390x +%ifarch ppc +%global bits_other (%{__isa_name}-64) +%else #!ppc +%ifarch sparc64 ppc64 s390x x86_64 +%global bits_other (%{__isa_name}-32) +%endif #sparc64 ppc64 s390x x86_64 +%endif #!ppc +%endif #!s390x +%endif #!el5 + +BuildRequires: sharutils dejagnu +# gcc-objc++ is not covered by the GDB testsuite. +BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: gcc-go +%endif +# archer-sergiodj-stap-patch-split +BuildRequires: systemtap-sdt-devel +# Copied from prelink-0.4.2-3.fc13. +%ifarch %{ix86} alpha sparc sparcv9 sparc64 s390 s390x x86_64 ppc ppc64 +# Prelink is broken on sparcv9/sparc64. +%ifnarch sparc sparcv9 sparc64 +BuildRequires: prelink +%endif +%endif +%if 0%{!?rhel:1} +# Fedora arm does not yet have fpc built. +%ifnarch %{arm} +BuildRequires: fpc +%endif +%endif +%if 0%{?el5:1} +BuildRequires: gcc44 gcc44-gfortran +%endif +# Copied from gcc-4.1.2-32. +%ifarch %{ix86} x86_64 ia64 ppc alpha +BuildRequires: gcc-gnat +BuildRequires: libgnat%{bits_local} libgnat%{bits_other} +%endif +BuildRequires: glibc-devel%{bits_local} glibc-devel%{bits_other} +BuildRequires: libgcc%{bits_local} libgcc%{bits_other} +# libstdc++-devel of matching bits is required only for g++ -static. +BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other} +BuildRequires: libgcj%{bits_local} libgcj%{bits_other} +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other} +%endif +%if 0%{!?el5:1} +BuildRequires: glibc-static%{bits_local} +%endif +# multilib glibc-static is open Bug 488472: +#BuildRequires: glibc-static%{bits_other} +# for gcc-java linkage: +BuildRequires: zlib-devel%{bits_local} zlib-devel%{bits_other} +# Copied from valgrind-3.5.0-1. +%ifarch %{ix86} x86_64 ppc ppc64 +BuildRequires: valgrind%{bits_local} valgrind%{bits_other} +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: xz +%endif + +%endif # 0%{?_with_testsuite:1} + +%ifarch ia64 +%if 0%{!?el5:1} +BuildRequires: libunwind-devel >= 0.99-0.1.frysk20070405cvs +Requires: libunwind >= 0.99-0.1.frysk20070405cvs +%else +BuildRequires: libunwind >= 0.96-3 +Requires: libunwind >= 0.96-3 +%endif +%endif + +%{?scl:Requires:%scl_runtime} + +%description +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%ifnarch noarch + +%package gdbserver +Summary: A standalone server for GDB (the GNU source-level debugger) +Group: Development/Debuggers + +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name}-gdbserver +%endif + +%description gdbserver +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides a program that allows you to run GDB on a different +machine than the one which is running the program being debugged. + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%endif # !noarch +%if 0%{!?el5:1} || "%{_target_cpu}" == "noarch" + +%package doc +Summary: Documentation for GDB (the GNU source-level debugger) +License: GFDL +Group: Documentation +# It would break RHEL-5 by overriding arch and not building noarch separately. +%if 0%{!?el5:1} +BuildArch: noarch +%endif # 0%{!?el5:1} + +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name}-doc +%endif + +%description doc +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides INFO, HTML and PDF user manual for GDB. + +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info + +%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch" + +%prep +%setup -q -n %{gdb_src} + +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +# libstdc++ pretty printers. +tar xjf %{SOURCE5} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 + +# Files have `# ' statements breaking VPATH / find-debuginfo.sh . +rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c +rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c + +# *.info* is needlessly split in the distro tar; also it would not get used as +# we build in %{gdb_build}, just to be sure. +find -name "*.info*"|xargs rm -f + +# Apply patches defined above. + +# Match the Fedora's version info. +%patch2 -p1 + +%patch349 -p1 +%patch232 -p1 +%patch828 -p1 +%patch829 -p1 +%patch1 -p1 +%patch3 -p1 + +%patch105 -p1 +%patch111 -p1 +%patch112 -p1 +%patch118 -p1 +%patch122 -p1 +%patch125 -p1 +%patch133 -p1 +%patch136 -p1 +%patch140 -p1 +%patch145 -p1 +%patch153 -p1 +%patch158 -p1 +%patch160 -p1 +%patch161 -p1 +%patch162 -p1 +%patch163 -p1 +%patch164 -p1 +%patch169 -p1 +%patch188 -p1 +%patch194 -p1 +%patch196 -p1 +%patch199 -p1 +%patch208 -p1 +%patch211 -p1 +%patch213 -p1 +%patch214 -p1 +%patch216 -p1 +%patch217 -p1 +%patch225 -p1 +%patch229 -p1 +%patch231 -p1 +%patch234 -p1 +%patch235 -p1 +%patch245 -p1 +%patch247 -p1 +%patch254 -p1 +%patch258 -p1 +%patch260 -p1 +%patch263 -p1 +%patch271 -p1 +%patch274 -p1 +%patch659 -p1 +%patch353 -p1 +%patch276 -p1 +%patch282 -p1 +%patch284 -p1 +%patch287 -p1 +%patch289 -p1 +%patch290 -p1 +%patch294 -p1 +%patch296 -p1 +%patch298 -p1 +%patch309 -p1 +%patch311 -p1 +%patch315 -p1 +%patch317 -p1 +%patch320 -p1 +%patch330 -p1 +%patch343 -p1 +%patch348 -p1 +%patch360 -p1 +%patch381 -p1 +%patch382 -p1 +%patch391 -p1 +%patch392 -p1 +%patch397 -p1 +%patch403 -p1 +%patch389 -p1 +%patch394 -p1 +%patch407 -p1 +%patch408 -p1 +%patch417 -p1 +%patch459 -p1 +%patch470 -p1 +%patch475 -p1 +%patch415 -p1 +%patch519 -p1 +%patch490 -p1 +%patch491 -p1 +%patch496 -p1 +%patch526 -p1 +%patch542 -p1 +%patch547 -p1 +%patch548 -p1 +%patch579 -p1 +%patch718 -p1 +%patch719 -p1 +%patch720 -p1 +%patch721 -p1 +%patch722 -p1 +%patch723 -p1 +%patch822 -p1 +%patch827 -p1 +%patch619 -p1 +%patch627 -p1 +%patch634 -p1 +%patch653 -p1 +%patch657 -p1 +%patch661 -p1 +%patch690 -p1 +%patch698 -p1 +%patch703 -p1 +%patch811 -p1 +%patch812 -p1 +%patch813 -p1 +%patch814 -p1 +%patch816 -p1 +%patch817 -p1 +%patch818 -p1 +%patch832 -p1 +%patch834 -p1 +%patch835 -p1 +%patch840 -p1 +%patch841 -p1 +%patch843 -p1 +%patch844 -p1 + +%patch836 -p1 +%patch837 -p1 +%if 0%{?scl:1} +%patch836 -p1 -R +%patch837 -p1 -R +%endif +%patch393 -p1 +%if 0%{!?el5:1} || 0%{?scl:1} +%patch393 -p1 -R +%endif +%patch833 -p1 +%if 0%{!?el6:1} || 0%{!?scl:1} +%patch833 -p1 -R +%endif +%patch642 -p1 +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +%patch642 -p1 -R +%endif +%patch337 -p1 +%patch331 -p1 +%patch335 -p1 +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +%patch335 -p1 -R +%patch331 -p1 -R +%patch337 -p1 -R +%endif + +find -name "*.orig" | xargs rm -f +! find -name "*.rej" # Should not happen. + +# Change the version that gets printed at GDB startup, so it is RH specific. +cat > gdb/version.in << _FOO +%if 0%{!?rhel:1} +Fedora %{version}-%{release} +%else # !0%{!?rhel:1} +Red Hat Enterprise Linux %{version}-%{release} +%endif # !0%{!?rhel:1} +_FOO + +# Remove the info and other generated files added by the FSF release +# process. +rm -f libdecnumber/gstdint.h +rm -f bfd/doc/*.info +rm -f bfd/doc/*.info-* +rm -f gdb/doc/*.info +rm -f gdb/doc/*.info-* + +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# RL_STATE_FEDORA_GDB would not be found for: +# Patch642: gdb-readline62-ask-more-rh.patch +# --with-system-readline +mv -f readline/doc readline-doc +rm -rf readline/* +mv -f readline-doc readline/doc +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 + +%build +rm -rf %{buildroot} + +# Identify the build directory with the version of gdb as well as the +# architecture, to allow for mutliple versions to be installed and +# built. +# Initially we're in the %{gdb_src} directory. + +for fprofile in %{?_with_profile:-fprofile} "" +do + +mkdir %{gdb_build}$fprofile +cd %{gdb_build}$fprofile + +export CFLAGS="$RPM_OPT_FLAGS" +export LDFLAGS="%{?__global_ldflags}" + +../configure \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --sysconfdir=%{_sysconfdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --htmldir=%{gdb_docdir} \ + --pdfdir=%{gdb_docdir} \ + --with-system-gdbinit=%{_sysconfdir}/gdbinit \ + --with-gdb-datadir=%{_datadir}/gdb \ + --enable-gdb-build-warnings=,-Wno-unused \ +%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparc sparcv9 sparc64 + --disable-werror \ +%else + --enable-werror \ +%endif + --with-separate-debug-dir=/usr/lib/debug \ + --disable-sim \ + --disable-rpath \ +%if 0%{!?rhel:1} || 0%{?rhel} > 6 + --with-system-readline \ +%else + --without-system-readline \ +%endif + --with-expat \ +$(: ppc64 host build crashes on ppc variant of libexpat.so ) \ + --without-libexpat-prefix \ + --enable-tui \ +%if 0%{!?_without_python:1} + --with-python \ +%else + --without-python \ +%endif +$(: Workaround rpm.org#76, BZ 508193 on recent OSes. ) \ +$(: RHEL-5 librpm has incompatible API. ) \ +%if 0%{?el5:1} + --without-rpm \ +%else +%if 0%{?el6:1} + --with-rpm=librpm.so.1 \ +%else + --with-rpm=librpm.so.3 \ +%endif +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 6 + --with-lzma \ +%else + --without-lzma \ +%endif +%ifarch ia64 + --with-libunwind \ +%else + --without-libunwind \ +%endif +%ifarch sparc sparcv9 sparc64 + --without-mmap \ +%endif + --enable-64-bit-bfd \ +%if %{have_inproctrace} + --enable-inprocess-agent \ +%else + --disable-inprocess-agent \ +%endif +$(: %{_bindir}/mono-gdb.py is workaround for mono BZ 815501. ) \ + --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ + --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}:%{_root_bindir}/mono-gdb.py' \ +%ifarch sparc sparcv9 + sparc-%{_vendor}-%{_target_os}%{?_gnu} +%else +$(: It breaks RHEL-5 by %{_target_platform} being noarch-redhat-linux-gnu ) \ +%ifarch noarch + $(:) +%else + %{_target_platform} +%endif +%endif + +if [ -z "%{!?_with_profile:no}" ] +then + # Run all the configure tests being incompatible with $FPROFILE_CFLAGS. + make %{?_smp_mflags} configure-host configure-target + make %{?_smp_mflags} clean + + # Workaround -fprofile-use: + # linux-x86-low.c:2225: Error: symbol `start_i386_goto' is already defined + make %{?_smp_mflags} -C gdb/gdbserver linux-x86-low.o +fi + +# Global CFLAGS would fail on: +# conftest.c:1:1: error: coverage mismatch for function 'main' while reading counter 'arcs' +if [ "$fprofile" = "-fprofile" ] +then + FPROFILE_CFLAGS='-fprofile-generate' +elif [ -z "%{!?_with_profile:no}" ] +then + FPROFILE_CFLAGS='-fprofile-use' + # We cannot use -fprofile-dir as the bare filenames clash. + (cd ../%{gdb_build}-fprofile; + # It was 333 on x86_64. + test $(find -name "*.gcda"|wc -l) -gt 300 + find -name "*.gcda" | while read -r i + do + ln $i ../%{gdb_build}/$i + done + ) +else + FPROFILE_CFLAGS="" +fi + +# Prepare gdb/config.h first. +make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" maybe-configure-gdb +perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status + +make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" + +! grep '_RELOCATABLE.*1' gdb/config.h +grep '^#define HAVE_LIBSELINUX 1$' gdb/config.h +grep '^#define HAVE_SELINUX_SELINUX_H 1$' gdb/config.h + +if [ "$fprofile" = "-fprofile" ] +then + cd gdb + cp -p gdb gdb-withindex + PATH="$PWD:$PATH" sh ../../gdb/gdb-add-index $PWD/gdb-withindex + ./gdb -nx -ex q ./gdb-withindex + ./gdb -nx -readnow -ex q ./gdb-withindex + cd .. +fi + +cd .. + +done # fprofile + +cd %{gdb_build} + +make \ +$(: There was a race on RHEL-5: ) \ +$(: fmtutil: format directory '/builddir/.texmf-var/web2c' does not exist. ) \ +%if 0%{?el5:1} + -j1 \ +%else + %{?_smp_mflags} \ +%endif + -C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split + +grep '#define HAVE_ZLIB_H 1' gdb/config.h + +# Copy the /gdb/NEWS file to the directory above it. +cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src} + +%check +# Initially we're in the %{gdb_src} directory. +cd %{gdb_build} + +%if 0%{!?_with_testsuite:1} +echo ====================TESTSUITE DISABLED========================= +%else +echo ====================TESTING========================= +cd gdb +gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 +# Need to use a single --ignore option, second use overrides first. +# No `%{?_smp_mflags}' here as it may race. +# WARNING: can't generate a core file - core tests suppressed - check ulimit +# "readline-overflow.exp" - Testcase is broken, functionality is OK. +( + # ULIMIT required for `gdb.base/auxv.exp'. + ulimit -H -c + ulimit -c unlimited || : + + # Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize. + # Never use two different bitsizes as it fails on ppc64. + echo 'int main (void) { return 0; }' >biarch.c + CHECK="" + for BI in -m64 -m32 -m31 "" + do + # Do not use size-less options if any of the sizes works. + # On ia64 there is no -m64 flag while we must not leave a bare `check' here + # as it would switch over some testing scripts to the backward compatibility + # mode: when `make check' was executed from inside the testsuite/ directory. + if [ -z "$BI" -a -n "$CHECK" ];then + continue + fi + # Do not use $RPM_OPT_FLAGS as the other non-size options will not be used + # in the real run of the testsuite. + if ! gcc $BI -o biarch biarch.c + then + continue + fi + CHECK="$CHECK check//unix/$BI" + done + # Do not try -m64 inferiors for -m32 GDB as it cannot handle inferiors larger + # than itself. + # s390 -m31 still uses the standard ELF32 binary format. + gcc $RPM_OPT_FLAGS -o biarch biarch.c + RPM_SIZE="$(file ./biarch|sed -n 's/^.*: ELF \(32\|64\)-bit .*$/\1/p')" + if [ "$RPM_SIZE" != "64" ] + then + CHECK="$(echo " $CHECK "|sed 's# check//unix/-m64 # #')" + fi + + # Disable some problematic testcases. + # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the + # `check//...' target spawn and too much escaping there would be dense. + for test in \ + gdb.base/readline-overflow.exp \ + gdb.base/bigcore.exp \ + ; do + mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || : + done + + # Run all the scheduled testsuite runs also in the PIE mode. + # See also: gdb-runtest-pie-override.exp + CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')" + + ./orphanripper make %{?_smp_mflags} -k $CHECK || : +) +for t in sum log +do + for file in testsuite*/gdb.$t + do + suffix="${file#testsuite.unix.}" + suffix="${suffix%/gdb.$t}" + ln $file gdb-%{_target_platform}$suffix.$t || : + done +done +# `tar | bzip2 | uuencode' may have some piping problems in Brew. +tar cjf gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}*.{sum,log} +uuencode gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}.tar.bz2 +cd ../.. +echo ====================TESTING END===================== +%endif + +%install +# Initially we're in the %{gdb_src} directory. +cd %{gdb_build} +rm -rf $RPM_BUILD_ROOT + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%ifnarch noarch + +make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT + +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +test ! -e $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui +install -m 755 %{SOURCE6} $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui +ln -sf gdb.1 $RPM_BUILD_ROOT%{_mandir}/man1/gdbtui.1 +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE4} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit + +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"` +do + # Files could be also patched getting the current time. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i +done + +%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} +mkdir -p $RPM_BUILD_ROOT/usr/lib/debug%{_bindir} +cp -p $RPM_BUILD_DIR/%{gdb_src}/gdb/gdb-gdb.py $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}/ +for pyo in "" "-O";do + # RHEL-5: AttributeError: 'module' object has no attribute 'compile_file' + python $pyo -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT/usr/lib/debug%{_bindir}"'", 1, "'"/usr/lib/debug%{_bindir}"'"))' +done +%endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} + +mkdir $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load +%if 0%{!?_without_python:1} +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +# Temporarily now: +for LIB in lib lib64;do + LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_root_prefix}/$LIB" + mkdir -p $LIBPATH + # basename is being run only for the native (non-biarch) file. + sed -e 's,@pythondir@,%{_datadir}/gdb/python,' \ + -e 's,@toolexeclibdir@,%{_root_prefix}/'"$LIB," \ + < $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in \ + > $LIBPATH/$(basename %{_root_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py + # Test the filename 'libstdc++.so.6.*' has matched. + test -f $LIBPATH/libstdc++.so.6.[0-9]*-gdb.py +done +test ! -e $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \ + $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python -name "*.py"` \ + `find $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix} -name "*.py"` \ +; do + # Files come from gdb-archer.patch and can be also further patched. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i +done +%else # 0%{!?rhel:1} || 0%{?rhel} > 6 +# BZ 999645: /usr/share/gdb/auto-load/ needs filesystem symlinks +mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load +for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do + ln -s $(echo %{_root_prefix}|sed 's#^/*##')/$i \ + $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/$i +done +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 +%endif # 0%{!?_without_python:1} + +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +rm -f $RPM_BUILD_ROOT%{_bindir}/gdb-add-index +%endif + +# Remove the files that are part of a gdb build but that are owned and +# provided by other packages. +# These are part of binutils + +rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ +rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* +rm -f $RPM_BUILD_ROOT%{_infodir}/standard* +rm -f $RPM_BUILD_ROOT%{_infodir}/configure* +rm -rf $RPM_BUILD_ROOT%{_includedir} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*} + +# pstack obsoletion + +cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1 +ln -s gstack.1 $RPM_BUILD_ROOT%{_mandir}/man1/pstack.1 +ln -s gstack $RPM_BUILD_ROOT%{_bindir}/pstack + +# Packaged GDB is not a cross-target one. +(cd $RPM_BUILD_ROOT%{_datadir}/gdb/syscalls + rm -f mips*.xml +%ifnarch sparc sparcv9 sparc64 + rm -f sparc*.xml +%endif +%ifnarch x86_64 + rm -f amd64-linux.xml +%endif +%ifnarch %{ix86} x86_64 + rm -f i386-linux.xml +%endif +%ifnarch ppc ppc64 + rm -f ppc{,64}-linux.xml +%endif +) + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%if 0%{?el5:1} +rm -f $RPM_BUILD_ROOT%{_infodir}/annotate.info* +rm -f $RPM_BUILD_ROOT%{_infodir}/gdb.info* +%endif # 0%{?el5:1} +%else # noarch +# -j1: There is some race resulting in: +# /usr/bin/texi2dvi: texinfo.tex appears to be broken, quitting. +make -j1 -C gdb/doc install DESTDIR=$RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT%{_mandir} +%endif # noarch + +# Documentation only for development; keep 'rm's here after "noarch" above. +rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint* +rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* + +# Delete this too because the dir file will be updated at rpm install time. +# We don't want a gdb specific one overwriting the system wide one. + +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +%clean +rm -rf $RPM_BUILD_ROOT + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%ifnarch noarch + +%files +%defattr(-,root,root) +%doc COPYING3 COPYING COPYING.LIB README NEWS +%{_bindir}/gcore +%{_bindir}/gdb +%config(noreplace) %{_sysconfdir}/gdbinit +%{_sysconfdir}/gdbinit.d +%{_mandir}/*/gdbinit.5* +%{_mandir}/*/gdb.1* +%{_mandir}/*/gcore.1* +%{_mandir}/*/gdb-add-index.1* +%{_bindir}/gstack +%{_mandir}/*/gstack.1* +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +%{_bindir}/gdbtui +%{_mandir}/*/gdbtui.1* +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +%{_bindir}/gdb-add-index +%endif +%{_bindir}/pstack +%{_mandir}/*/pstack.1* +%{_datadir}/gdb + +# don't include the files in include, they are part of binutils + +%ifnarch sparc sparcv9 +%files gdbserver +%defattr(-,root,root) +%{_bindir}/gdbserver +%{_mandir}/*/gdbserver.1* +%if %{have_inproctrace} +%{_libdir}/libinproctrace.so +%endif # %{have_inproctrace} +%endif + +%pre +for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do + src="%{_datadir}/gdb/auto-load/$i" + dst="%{_datadir}/gdb/auto-load/%{_root_prefix}/$i" + if test -d $src -a ! -L $src;then + if ! rmdir 2>/dev/null $src;then + mv -n $src/* $dst/ + rmdir $src + fi + fi +done + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%endif # !noarch +%if 0%{!?el5:1} || "%{_target_cpu}" == "noarch" + +%files doc +%doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf} +%defattr(-,root,root) +%{_infodir}/annotate.info* +%{_infodir}/gdb.info* + +%post doc +# This step is part of the installation of the RPM. Not to be confused +# with the 'make install ' of the build (rpmbuild) process. + +# For --excludedocs: +if [ -e %{_infodir}/gdb.info.gz ] +then + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : +fi + +%preun doc +if [ $1 = 0 ] +then + # For --excludedocs: + if [ -e %{_infodir}/gdb.info.gz ] + then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : + fi +fi + +%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch" + +%changelog +* Tue Nov 5 2013 Jan Kratochvil - 7.6.1-45.fc19 +- [aarch64] Backport two fixes (BZ 1026484). + +* Sun Nov 3 2013 Jan Kratochvil - 7.6.1-44.fc19 +- Fix %{_bindir}gdb-add-index to also use -iex 'set auto-load no'. + +* Wed Oct 30 2013 Jan Kratochvil - 7.6.1-43.fc19 +- [rhel5] Fix /etc/gdbinit compatibility with python-2.4. + +* Mon Sep 30 2013 Sergio Durigan Junior - 7.6.1-42.fc19 +- Fix the case when GDB leaks memory because value_struct_elt does not call + check_typedef. (Doug Evans, BZ 15695, filed as RH BZ 1013453). + +* Mon Sep 9 2013 Jan Kratochvil - 7.6.1-41.fc19 +- Fix the version string to be GNU standards compliant (BZ 1004949). + +* Sat Aug 31 2013 Jan Kratochvil - 7.6.1-40.fc19 +- Remove --disablerepo='*' from BZ 554152 as it conflicts with BZ 981154. +- [ppc] Support Power8 CPU (IBM, BZ 731875). +- [rhel5] tps-srpmtest does not set %%{rhel} (BZ 1002198, Miroslav Franc). + +* Fri Aug 30 2013 Jan Kratochvil - 7.6.1-39.fc19 +- Load /etc/gdbinit.d/*.{gdb,py} files automatically (BZ 981520). + +* Fri Aug 30 2013 Jan Kratochvil - 7.6.1-38.fc19 +- Rebase to FSF GDB 7.6.1. + +* Fri Aug 30 2013 Jan Kratochvil - 7.6-37.fc19 +- Fix false warnings of new %%pre during future upgrades (BZ 999645). + +* Fri Aug 30 2013 Jan Kratochvil - 7.6-36.fc19 +- New %%pre to fix failed upgrade of the previous commit (BZ 999645). + +* Wed Aug 28 2013 Jan Kratochvil - 7.6-35.fc19 +- Fix /usr/share/gdb/auto-load/ need of filesystem symlinks (BZ 999645). + It needs: yum remove gdb-heap; yum reinstall gdb; yum install gdb-heap + +* Tue Aug 6 2013 Jan Kratochvil - 7.6-34.fc19 +- Make the previous commit rpm buildable. + +* Tue Aug 6 2013 Jan Kratochvil - 7.6-33.fc19 +- Fix yum install command when the binary RPM is missing (BZ 981154). +- Fix crash on 'enable count' (Simon Marchi, BZ 993118). +- Fix the changlog entry formatting for 6.3.0.0-0.1. + +* Mon Jun 10 2013 Jan Kratochvil - 7.6-32.fc19 +- [scl] Disable Python frame filters on scl. +- Update libraries opening performance fix from upstream. +- Fix C++ lookups performance regression (Doug Evans, BZ 972677). + +* Tue May 28 2013 Jan Kratochvil - 7.6-31.fc19 +- [ppc] Backport hardware watchpoints fix (Edjunior Machado, BZ 967915). + +* Tue May 21 2013 Jan Kratochvil - 7.6-30.fc19 +- Backported Python frame filters (Phil Muldoon). +- Backported breakpoint conditions crash fix (Sergio Durigan Junior). + +* Sun May 19 2013 Jan Kratochvil - 7.6-29.fc19 +- Fix performance regression opening many libraries (Gary Benson, BZ 965106). + +* Thu May 9 2013 Jan Kratochvil - 7.6-28.fc19 +- Fix needless expansion of non-gdbindex symtabs (Doug Evans). + +* Mon May 6 2013 Jan Kratochvil - 7.6-27.fc19 +- [testsuite] [RHEL-5] Fix gdb-orphanripper.c runtime error. + +* Fri May 3 2013 Jan Kratochvil - 7.6-26.fc19 +- Fix gcore for vDSO (on ppc64). + +* Sat Apr 27 2013 Jan Kratochvil - 7.6-25.fc19 +- Fix false "Unknown error 512" on x32 (H.J. Lu, BZ 956883). + +* Fri Apr 26 2013 Jan Kratochvil - 7.6-24.fc19 +- Rebase to FSF GDB 7.6. + +* Wed Apr 24 2013 Jan Kratochvil - 7.5.91.20130423-23.fc19 +- Fix man page BuildRequires (for BZ 881892). + +* Tue Apr 23 2013 Jan Kratochvil - 7.5.91.20130423-22.fc19 +- [spec] Fix virtual bundles after GDB has been branched. + +* Tue Apr 23 2013 Jan Kratochvil - 7.5.91.20130423-21.fc19 +- Rebase to FSF GDB 7.5.91.20130423 (pre-7.6 snapshot). + +* Mon Apr 22 2013 Jan Kratochvil - 7.5.91.20130407-20.fc19 +- [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). + +* Mon Apr 22 2013 Sergio Durigan Junior - 7.5.91.20130407-19.fc19 +- [RHEL-6] Regression test for RH BZ 947564. + +* Thu Apr 11 2013 Jan Kratochvil - 7.5.91.20130407-18.fc19 +- Provide man page for gcore.1 and gdb-add-index.1 (BZ 881892). + +* Sun Apr 7 2013 Jan Kratochvil - 7.5.91.20130407-17.fc19 +- [RHEL-5] Fix noarch doc build. + +* Sun Apr 7 2013 Jan Kratochvil - 7.5.91.20130407-16.fc19 +- Rebase to FSF GDB 7.5.91.20130407 (pre-7.6 snapshot). +- [SCL] Remove BuildRequires of gcc-go on SCL (Miroslav Franc, BZ 948982). +- Provide man page for gdbinit.5 (BZ 881892), document gdb -p in man (BZ 659000). + +* Tue Apr 2 2013 Jan Kratochvil - 7.5.91.20130402-15.fc19 +- Rebase to FSF GDB 7.5.91.20130402 (pre-7.6 snapshot). + +* Sat Mar 23 2013 Jan Kratochvil - 7.5.91.20130323-14.fc19 +- Rebase to FSF GDB 7.5.91.20130310 (pre-7.6 snapshot). +- Fix crash regression from the dlopen of libpthread.so fix (BZ 911712). + +* Mon Mar 11 2013 Jan Kratochvil - 7.5.50.20130310-13.fc19 +- [RHEL-5] Import build regression fix. + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-12.fc19 +- Add workaround of PDF gdb-doc build (filed as RH BZ 919891). + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-11.fc19 +- Re-enable (again) PDF in gdb-doc after texinfo RH BZ 876710 has been fixed. + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-10.fc19 +- Rebase to FSF GDB 7.5.50.20130310 (pre-7.6 snapshot). +- Fix various entry-values sub-optimal results. + +* Mon Feb 25 2013 Jan Kratochvil - 7.5.50.20130215-9.fc19 +- testsuite: Fix gdb.arch/powerpc-power6.exp testcase (IBM, RH BZ 890900). + +* Tue Feb 19 2013 Jan Kratochvil - 7.5.50.20130215-8.fc19 +- Temporarily disable PDF in gdb-doc for still unavailable texinfo RH BZ 876710. + +* Mon Feb 18 2013 Jan Kratochvil - 7.5.50.20130215-7.fc19 +- Rebase to FSF GDB 7.5.50.20130215 (pre-7.6 snapshot). + +* Fri Feb 8 2013 Jan Kratochvil - 7.5.50.20130118-6.fc19 +- Re-enable PDF in gdb-doc after texinfo RH BZ 876710 has been fixed. + +* Mon Feb 4 2013 Jan Kratochvil - 7.5.50.20130118-5.fc19 +- Release bump only. + +* Fri Feb 1 2013 Jan Kratochvil - 7.5.50.20130118-4.fc19 +- Fix assert crashes with minidebuginfo (BZ 903522). + +* Fri Jan 25 2013 Jan Kratochvil - 7.5.50.20130118-3.fc19 +- Release bump only. + +* Mon Jan 21 2013 Jan Kratochvil - 7.5.50.20130118-2.fc19 +- [RHEL] Reintroduce gdb-6.8-quit-never-aborts.patch. + +* Sat Jan 19 2013 Jan Kratochvil - 7.5.50.20130118-1.fc19 +- Rebase to FSF GDB 7.5.50.20130118 (pre-7.6 snapshot). + +* Sun Jan 13 2013 Jan Kratochvil - 7.5.1-35.fc18 +- [testsuite] Fix gdb-orphanripper.c lockup on F-17 (/dev/pts/* glibc chown). + +* Tue Jan 8 2013 Jan Kratochvil - 7.5.1-34.fc18 +- Update dlopen to support map_failed probe of glibc (Gary Benson, BZ 886516). + +* Thu Jan 3 2013 Jan Kratochvil - 7.5.1-33.fc18 +- [ppc*] Fix PowerPC disassembly regression (Alan Modra, Edjunior Machado). + +* Thu Dec 13 2012 Jan Kratochvil - 7.5.1-32.fc18 +- 'dwz -m' parsing fix (Tom Tromey). + +* Mon Dec 3 2012 Jan Kratochvil - 7.5.1-31.fc18 +- Fix DW_OP_GNU_implicit_pointer offset bug (Tom Tromey). + +* Sun Dec 2 2012 Jan Kratochvil - 7.5.1-30.fc18 +- Temporarily disable PDF in gdb-doc before texinfo RH BZ 876710 gets fixed. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-29.fc18 +- Provide Source URL when it is a release. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-28.fc18 +- Fix (unsplit) split info doc. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-27.fc18 +- Rebase to FSF GDB 7.5.1 (7.5 stable branch). + +* Fri Nov 9 2012 Jan Kratochvil - 7.5.0.20120926-26.fc18 +- Fix `GDB cannot access struct member whose offset is larger than 256MB' + (RH BZ 871066). + +* Fri Oct 5 2012 Jan Kratochvil - 7.5.0.20120926-25.fc18 +- entry values: Fix resolving in inlined frames. + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-24.fc18 +- Permit passing pointers as address number even for C++ methods (Keith Seitz). + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-23.fc18 +- Fix crash printing classes (BZ 849357, Tom Tromey). + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-22.fc18 +- Fix .spec 'bundled' Provides for the stable branch rebase. + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-21.fc18 +- [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696). +- Rebase to FSF GDB 7.5.0.20120926 (7.5 stable branch). + - Remove the .spec Source keyword URL as not valid now. + +* Fri Sep 14 2012 Jan Kratochvil - 7.5-20.fc18 +- [RHEL-6] Disable no longer valid workaround of man pages .gz suffix. + +* Sat Aug 18 2012 Jan Kratochvil - 7.5-19.fc18 +- Rebase to FSF GDB 7.5. +- Update dlopen to support two variants of glibc (Gary Benson, BZ 669432). + +* Fri Aug 17 2012 Jan Kratochvil - 7.4.91.20120801-18.fc18 +- Drop Source URL for snapshots. +- Separate %%{snapgnulib} from %%{snap}. +- Fix %%{libstdcxxpython} to be %%{name}-prefixed. +- Fix debug info for go-exp.y and go-exp.c. +- Include RHEL-5 compatible %%{buildroot} cleanup. +- Use %%__global_ldflags. + +* Wed Aug 1 2012 Jan Kratochvil - 7.4.91.20120801-17.fc18 +- Rebase to FSF GDB 7.4.91.20120801. +- [dwz] Rebase it from FSF GDB HEAD. + +* Thu Jul 19 2012 Fedora Release Engineering - 7.4.50.20120714-16.fc18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 16 2012 Jan Kratochvil - 7.4.50.20120714-15.fc18 +- [devtoolset] Include Obsoletes of devtoolset-1.0-* by devtoolset-1.1-*. + +* Sun Jul 15 2012 Jan Kratochvil - 7.4.50.20120714-14.fc18 +- Rebase to FSF GDB 7.4.50.20120714. + - Fix entryval feature crash on some .debug files optimized by dwz (BZ 839596). +- Fix another stale frame_info * (PR 11914, like PR 13866). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-13.fc18 +- [RHEL] Disable MiniDebugInfo F-18 feature on RHEL <= 6 (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-12.fc18 +- Fix .spec metadata for the MiniDebugInfo F-18 feature (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-11.fc18 +- [archer-tromey-dwz-multifile-rebase] Fix DWARF files reading (Tom Tromey). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-10.fc18 +- Fix build-id-core-loads internal error (BZ 837870). + +* Thu Jul 5 2012 Jan Kratochvil - 7.4.50.20120703-9.fc18 +- Implement MiniDebugInfo F-18 Feature consumer (Alexander Larsson, BZ 834068). + +* Tue Jul 3 2012 Jan Kratochvil - 7.4.50.20120703-8.fc18 +- Rebase to FSF GDB 7.4.50.20120703. +- [archer-tromey-dwz-multifile-rebase] Merge new branch (Tom Tromey). +- [arm] <--with testsuite>: Disable fpc BuildRequires as it is not yet built. +- Revert function returning pointer fix (PR 9514) regressing Fedora errno patch. + +* Thu Jun 21 2012 Sergio Durigan Junior - 7.4.50.20120603-7.fc18 +- Include testcase for BZ 818343. + +* Tue Jun 19 2012 Jan Kratochvil - 7.4.50.20120603-6.fc18 +- Fix regression of undisplayed missing shared libraries caused by a fix for: + GNU/Linux core open: Can't read pathname for load map: Input/output error. + +* Sun Jun 17 2012 Sergio Durigan Junior - 7.4.50.20120603-5.fc18 +- Include testcase for BZ 823789. + +* Thu Jun 14 2012 Jan Kratochvil - 7.4.50.20120603-4.fc18 +- Support DW_OP_GNU_parameter_ref for -O2 -g inferiors (BZ 827375). + +* Wed Jun 6 2012 Jan Kratochvil - 7.4.50.20120603-3.fc18 +- Disable -lmcheck in the development builds. +- Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans). + +* Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120603-2.fc18 +- Fix Release. +- Make yum --enablerepo compatible with at least mock-1.1.21-1.fc16 Rawhide cfg. + +* Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120602-1.fc18 +- Rebase to FSF GDB 7.4.50.20120602. +- [testsuite] BuildRequire gcc-go. +- Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763). +- Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651). +- Use librpm.so.3 for rpm-4.10.0 in Fedora 18. +- Revert recent breakage of UNIX objfiles order for symbols lookup. + +* Sat Jun 2 2012 Jan Kratochvil - 7.4.50.20120120-48.fc17 +- [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado). + +* Mon May 28 2012 Jan Kratochvil - 7.4.50.20120120-47.fc17 +- Workaround PR libc/14166 for inferior calls of strstr. + +* Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-46.fc17 +- [RHEL5] Workaround doc build race. + +* Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-45.fc17 +- Rename "set auto-load" patchset variable $ddir to $datadir. + +* Wed May 9 2012 Jan Kratochvil - 7.4.50.20120120-44.fc17 +- Fix in "set auto-load" patchset for SCL scripts inheritance (BZ 815910). + +* Wed Apr 25 2012 Jan Kratochvil - 7.4.50.20120120-43.fc17 +- [RHEL5] Workaround kernel for detaching SIGSTOPped processes (BZ 809382). + +* Tue Apr 24 2012 Jan Kratochvil - 7.4.50.20120120-42.fc17 +- Update "set auto-load" patchset and the --with-auto-load-safe-path setting. +- [RHEL] Disable gdb-add-index even on RHEL-6 as RHEL-6.0 had too old elfutils. + +* Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-41.fc17 +- [RHEL] Fix --with-auto-load-safe-path systems prior to /usr move. + +* Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-40.fc17 +- Security fix for loading untrusted inferiors, see "set auto-load" (BZ 756117). + +* Fri Apr 13 2012 Jan Kratochvil - 7.4.50.20120120-39.fc17 +- [RHEL7] Fix/remove readline-devel BuildRequires redundant distro suffic .fc17. + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-38.fc17 +- Workaround crashes from stale frame_info pointer (BZ 804256). + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-37.fc17 +- testsuite: Fix break-interp.exp expections for updated glibc (BZ 752834). + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-36.fc17 +- [RHEL5,RHEL6] Reintroduce fix attaching to stopped processes. + +* Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-35.fc17 +- Fix performance regressions with .gdb_index (Tom Tromey, BZ 805274). + +* Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-34.fc17 +- Fixup %{_datadir}/gdb timestamps for multilib conflicts on RHELs. + +* Mon Mar 26 2012 Jan Kratochvil - 7.4.50.20120120-33.fc17 +- [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920). + +* Sat Mar 17 2012 Jan Kratochvil - 7.4.50.20120120-32.fc17 +- Fix loading of core files without build-ids but with build-ids in executables. + +* Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-31.fc17 +- Fix an implied regression by the inferior calls fix below (BZ 799531). + +* Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-30.fc17 +- Fix SELinux deny_ptrace .spec build rules (BZ 786878). + +* Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-29.fc17 +- Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531). +- Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me). + +* Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-28.fc17 +- Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-27.fc17 +- [rhel5] Fix up the previous commit (BZ 799318). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-26.fc17 +- [rhel5] Fix up the previous commit (BZ 799318). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-25.fc17 +- [rhel5] Workaround rpmbuild to make the doc subpkg noarch again (BZ 799318). + +* Fri Mar 2 2012 Jan Kratochvil - 7.4.50.20120120-24.fc17 +- [vla] Fix crash for dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64. +- Reintroduce RHEL-5 glibc workaround for bt-clone-stop.exp. +- testsuite: Update/fix rh634108-solib_address.exp for the upstreamed API. + +* Wed Feb 29 2012 Jan Kratochvil - 7.4.50.20120120-23.fc17 +- Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875). +- Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889). +- Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892). + +* Tue Feb 28 2012 Jan Kratochvil - 7.4.50.20120120-22.fc17 +- testsuite: Fix gdb.base/macscp.exp ccache workaround in SCL mode. +- Adjust the RHEL/F version string automatically (BZ 797651, BZ 797646). +- Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). + +* Fri Feb 24 2012 Jan Kratochvil - 7.4.50.20120120-21.fc17 +- testsuite: Do not use gcc44/gfortran44 on RHEL-5 if in SCL mode. + +* Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-20.fc17 +- Fix libinproctrace.so build on RHEL-5 i386 (disable it on RHEL-5). + +* Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-19.fc17 +- Implement SCL (scl-utils-build) macros. + +* Tue Feb 21 2012 Jan Kratochvil - 7.4.50.20120120-18.fc17 +- Fix debuginfo gdb-gdb.py build without redhat-rpm-config and on RHEL-5. +- Provide precompiled variants of gdb-gdb.py. + +* Mon Feb 13 2012 Jan Kratochvil - 7.4.50.20120120-17.fc17 +- gstack: Turn off --readnever (suggested by Oliver Henshaw). + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-16.fc17 +- [RHELs] Drop simulation of legacy behavior - new GDB should behave as new GDB. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-15.fc17 +- Simplify %%setup .spec rule. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-14.fc17 +- Drop --with upstream .spec rules. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-13.fc17 +- Drop --with debug .spec rules. + +* Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-12.fc17 +- Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487). +- Install also gdb-gdb.py pretty printers. + +* Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-11.fc17 +- Fix possible NULL crash in find_charset_names (Tom Tromey, BZ 786091). +- [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504). + +* Sat Jan 21 2012 Jan Kratochvil - 7.4.50.20120120-10.fc17 +- Rebase to FSF GDB 7.4.50.20120120. +- Drop the g77 .spec provisioning as it has been fixed in FSF GDB. + +* Thu Jan 19 2012 Jan Kratochvil - 7.4.50.20120103-9.fc17 +- Enable smaller %{_bindir}/gdb in future by no longer using -rdynamic. +- Make --enablerepo to use '*-debug*' for RHEL compatibility (BZ 781571). +- On older RHELs make readline bundled again (BZ 701131). +- Fix build compatibility with RHEL-5 due to false noarch build. + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-8.fc17 +- Disable unexpected GDB directories relocatability. + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-7.fc17 +- Fix BuildRequires for RHEL compatibility (BZ 701131). + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-6.fc17 +- Provide %%snap timestamp for: Provides: bundled(librarypackage) +- Replace %%define by %%global. +- Replace Java in Summary with Fortran (only GCC-compiled Java is supported). +- Unbundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). +- Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131). + +* Sat Jan 7 2012 Jan Kratochvil - 7.4.50.20120103-5.fc17 +- Mark %{_sysconfdir}/gdbinit as %%config(noreplace). +- Add appropriate: Provides: bundled(librarypackage). +- Remove excessive explicit Requires: librarypackage. + +* Thu Jan 5 2012 Jan Kratochvil - 7.4.50.20120103-4.fc17 +- Fix linking on non-x86* (such as s390*) after libgdb.a removal. + +* Wed Jan 4 2012 Jan Kratochvil - 7.4.50.20120103-3.fc17 +- Reinclude gdb-dlopen-stap-probe.patch (missing in Fedora glibc - BZ 752476). + +* Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-2.fc17 +- Fix SystemTap support regression on i686 (Sergio Durigan Junior). + +* Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-1.fc17 +- Rebase to FSF GDB 7.4.50.20120103. + +* Mon Nov 28 2011 Jan Kratochvil - 7.3.50.20110722-11.fc17 +- No longer build bundled libstdc++ pretty printers on RHELs >= 7. + +* Sat Nov 5 2011 Sergio Durigan Junior - 7.3.50.20110722-10.fc16 +- Backport fix for crash in cp_scan_for_anonymous_namespace + (Aleksandar Ristovski, BZ 750341). + +* Fri Oct 14 2011 Jan Kratochvil - 7.3.50.20110722-9.fc16 +- Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294). + +* Tue Oct 11 2011 Jan Kratochvil - 7.3.50.20110722-8.fc16 +- Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE. + +* Mon Sep 26 2011 Jan Kratochvil - 7.3.50.20110722-7.fc16 +- [vla] Fix VLA arrays displayed in `bt full' (BZ 738482). +- Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. +- Fix internal error on some optimized-out values. + +* Tue Aug 16 2011 Jan Kratochvil - 7.3.50.20110722-6.fc16 +- Python command/function auto-loading (Phil Muldoon, BZ 730976). +- Work around PR libc/13097 "linux-vdso.so.1" warning message. +- [TUI] Fix stepi on stripped code. +- Add BuildRequires: systemtap-sdt-devel for archer-sergiodj-stap-patch-split. + +* Wed Aug 10 2011 Jan Kratochvil - 7.3.50.20110722-5.fc16 +- Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). + +* Tue Aug 9 2011 Jan Kratochvil - 7.3.50.20110722-4.fc16 +- Improve GDB performance on inferior dlopen calls (Gary Benson, BZ 698001). +- [python] Fix crash when pretty printer fails (Phil Muldoon, BZ 712715). +- Fix crash on invalid C++ mangled names (BZ 729283). + +* Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-3.fc16 +- Fix regression from VLA merge affecting -O0 -g watchpoints. + +* Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-2.fc16 +- Include gcc -g3 .debug_macro implementation by Tom Tromey. + +* Sat Jul 23 2011 Jan Kratochvil - 7.3.50.20110722-1.fc16 +- Rebase to FSF GDB 7.3.50.20110722. +- Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471). + +* Sun Jul 3 2011 Jan Kratochvil - 7.2.90.20110703-40.fc15 +- Rebase to FSF GDB 7.2.90.20110703 (which is a 7.3 pre-release). + - Adjust the `print errno' patch due to the DW_AT_linkage_name following again. + +* Fri Jun 24 2011 Jan Kratochvil - 7.2.90.20110525-39.fc15 +- Fix install-info for the gdb-doc subpackage (BZ 715228). + +* Wed May 25 2011 Jan Kratochvil - 7.2.90.20110525-38.fc15 +- Rebase to FSF GDB 7.2.90.20110525 (which is a 7.3 pre-release). +- [stap] Fix double free (Sergio Durigan Junior). + +* Tue May 3 2011 Jan Kratochvil - 7.2.90.20110429-37.fc15 +- Search also for . files in /usr/lib/debug/.build-id (BZ 641377). + +* Mon May 2 2011 Jan Kratochvil - 7.2.90.20110429-36.fc15 +- Bundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). + - Use --without-system-readline, disable Requires and BuildRequires of readline. + - Drop gdb-6.5-readline-long-line-crash.patch and gdb-readline-6.0-signal.patch. + +* Fri Apr 29 2011 Jan Kratochvil - 7.2.90.20110429-35.fc15 +- Rebase to FSF GDB 7.2.90.20110429 (which is a 7.3 pre-release). +- Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253). +- Fix case insensitive symbols for Fortran by iFort (BZ 645773). +- Fix physname-related CU expansion issue for C++ (PR 12708). +- Fix Python access to inlined frames (BZ 694824). + +* Mon Apr 11 2011 Jan Kratochvil - 7.2.90.20110411-34.fc15 +- Rebase to FSF GDB 7.2.90.20110411 (which is a 7.3 pre-release). +- Include the proper fix for anonymous struct typedefs (Tom Tromey, BZ 672230). + +* Wed Mar 30 2011 Fabio M. Di Nitto - 7.2.50.20110328-33.fc15 +- Cleanup spec file to add sparc|sparcv9|sparc64. +- Add sparc specific workarounds to toolchain badness: + - disable mmap in bdf/ via --without-mmap configure option. + - add patch to not build mmap support on sparc for gdb/. + - gdb code is NOT at fault, but we need a working gdb while we sort out + the toolchain and rebuild all packages. this workaround is NOT for upstream. + +* Tue Mar 29 2011 Jan Kratochvil - 7.2.50.20110328-32.fc15 +- Fix occasional crash on `print errno' with no -pthread and no -g3 (BZ 690908). + +* Mon Mar 28 2011 Jan Kratochvil - 7.2.50.20110328-31.fc15 +- Rebase to FSF GDB 7.2.50.20110328 (which is a 7.3 pre-release). +- Bundle %%{libstdcxxpython}.tar.bz2 unconditionally - for rebulds on RHELs. + +* Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-30.fc15 +- Fix threading internal error on corrupted memory (BZ 677654). +- Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866). + +* Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-29.fc15 +- Rebase to FSF GDB 7.2.50.20110320 (which is a 7.3 pre-release). +- Merge archer-sergiodj-stap, the SystemTap probes breakpoints feature. + - [stap] Fix -O2 warnings. +- Fix Ada support crash on uninitialized gdbarch. + +* Sat Mar 5 2011 Jan Kratochvil - 7.2.50.20110305-28.fc15 +- Rebase to FSF GDB 7.2.50.20110305 (which is a 7.3 pre-release). + +* Fri Feb 25 2011 Jan Kratochvil - 7.2.50.20110222-27.fc15 +- Include doc also in the PDF form; new BuildRequires: texinfo-tex. + +* Wed Feb 23 2011 Jan Kratochvil - 7.2.50.20110222-26.fc15 +- Rebase to FSF GDB 7.2.50.20110222 (which is a 7.3 pre-release). +- Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman). + +* Mon Feb 21 2011 Jan Kratochvil - 7.2.50.20110218-25.fc15 +- Drop %%{_datadir}/gdb/syscalls/* for unsupported arches. + +* Fri Feb 18 2011 Jan Kratochvil - 7.2.50.20110218-24.fc15 +- Rebase to FSF GDB 7.2.50.20110218 (which is a 7.3 pre-release). +- [vla] Fox Fortran vector slices for allocated arrays (for BZ 609782). + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-23.fc15 +- Move the GFDL License to gdb-doc. + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-22.fc15 +- Fix gdb-doc Group to be Documentation, also provide it as noarch. + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-21.fc15 +- Drop non-user (gdbint) and obsolete (stabs) documentation. +- Install also HTML files besides the INFO file. +- Create new subpackage gdb-doc for both INFO and HTML files. + +* Sun Feb 13 2011 Jan Kratochvil - 7.2.50.20110213-20.fc15 +- Rebase to FSF GDB 7.2.50.20110213 (which is a 7.3 pre-release). +- Fix occasionall unfound source lines (affecting at least glibc debugging). +- Fix const/volatile qualifiers of C++ types (PR c++/12328). +- Be backward compatible for --rebuild with <=fc14 librpm.so.1. + +* Tue Feb 08 2011 Fedora Release Engineering - 7.2.50.20110206-19.fc15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-18.fc15 +- Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). + +* Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-17.fc15 +- Rebase to FSF GDB 7.2.50.20110206 (which is a 7.3 pre-release). + +* Thu Jan 27 2011 Jan Kratochvil - 7.2.50.20110125-16.fc15 +- Fix Python new-backtrace command (BZ 672235, Phil Muldoon). + +* Wed Jan 26 2011 Jan Kratochvil - 7.2.50.20110125-15.fc15 +- Temporary fix of F15 gcc-4.6 child DIEs of DW_TAG_typedef (BZ 672230). +- Workaround gcc-4.6 stdarg false prologue end (GDB PR 12435 + GCC PR 47471). + +* Tue Jan 25 2011 Jan Kratochvil - 7.2.50.20110125-14.fc15 +- Rebase to FSF GDB 7.2.50.20110125 (which is a 7.3 pre-release). +- Fix discontiguous address ranges in .gdb_index - v3->v4 (BZ 672281). +- Fix DWARF-3+ DW_AT_accessibility default assumption for F15 gcc-4.6. + +* Thu Jan 20 2011 Jan Kratochvil - 7.2.50.20110117-13.fc15 +- Use librpm.so.2 for rpm-4.9.0 in Fedora 15. + +* Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-12.fc15 +- Use %%{?dist} for sanity checking tools compliance (suggested by Petr Muller). + +* Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-11.fc15 +- Rebase to FSF GDB 7.2.50.20110117 (which is a 7.3 pre-release). +- Fix callback-mode readline-6.0 regression for CTRL-C (for RHEL-6.0). + - Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516). + +* Sat Jan 15 2011 Jan Kratochvil - 7.2.50.20110107-10.fc15 +- [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +- [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +- [archer-keiths-expr-cumulative+upstream] Import C++ testcases. + - testsuite: Fix gdb-test-expr-cumulative-archer.patch compatibility. + +* Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-9.fc15 +- Remove --with-pythondir as no longer valid. +- Provide %{_bindir}gdb-add-index even on RHEL-5. +- Provide again libstdc++ pretty printers for any RHEL. + +* Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-8.fc15 +- Rebase to FSF GDB 7.2.50.20110107 (which is a 7.3 pre-release). +- Import archer-tromey-python (BZ 666177, branch update by Phil Muldoon). + +* Tue Jan 4 2011 Jan Kratochvil - 7.2.50.20110104-7.fc15 +- Rebase to FSF GDB 7.2.50.20110104 (which is a 7.3 pre-release). +- New testcase py-prettyprint.exp:print hint_error (for BZ 611569, BZ 629236). +- New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). + +* Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-6.fc15 +- Fix --with-system-readline doc build upstream regression. + +* Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-5.fc15 +- Rebase to FSF GDB 7.2.50.20101231 (which is a 7.3 pre-release). +- Remove gdb-6.3-bt-past-zero-20051201.patch, gdb-archer-ada.patch and + gdb-6.3-framepczero-20040927.patch already removed from .spec before. +- Remove gdb-6.5-dwarf-stack-overflow.patch, upstreamed (Tom Tromey). +- Remove gdb-6.6-bz225783-gdb-debuginfo-paths.patch, upstreamed (Tom Tromey). +- Remove gdb-6.6-readline-system.patch, reimplemented upstream (Tom Tromey). +- Remove gdb-bz642879-elfread-sigint-stale.patch, upstreamed (Jan Kratochvil). +- Remove gdb-next-over-throw.patch, upstreamed (Tom Tromey). + +* Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-4.fc15 +- Provide stub %%{_sysconfdir}/gdbinit (BZ 651232). + +* Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-3.fc15 +- Fix ppc* compilation of PRPSINFO in the core files (BZ 662995, for BZ 254229). +- Fix (disable) non-x86* compilation of libinproctrace.so (for BZ 662995). + +* Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-2.fc15 +- Drop gdb-6.8-glibc-headers-compat.patch: GNU/Linux irrelevant (Tom Tromey). +- Drop gdb-6.3-terminal-fix-20050214.patch: The bug is not reproducible. +- Drop gdb-6.7-kernel-headers-compat.patch: kernel-headers seem to be fixed. +- Drop gdb-archer-ada.patch: No longer needed for Ada (Keith Seitz). +- New PR backtrace/12237, drop gdb-6.3-framepczero-20040927.patch + gdb-6.3-bt-past-zero-20051201.patch as they already had no effect. +- Drop gdb-6.8-gcc35998-ada-memory-trash.patch as a different fix is upstream. +- Drop gdb-6.3-inheritance-20050324.patch: the call is redundent (Tom Tromey). +- Drop gdb-6.3-large-core-20051206.patch: obsoleted by MAX_COPY_BYTES. + +* Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-1.fc15 +- Rebase to FSF GDB 7.2.50.20101117 (which is a 7.3 pre-release). + +* Sun Nov 7 2010 Jan Kratochvil - 7.2-25.fc14 +- iFort compat. - case insensitive DWARF not in lowercase (BZ 645773). + +* Thu Oct 14 2010 Jan Kratochvil - 7.2-24.fc14 +- Add gdb.spec comments on the *.patch files upstream merge status. + +* Thu Oct 14 2010 Jan Kratochvil - 7.2-23.fc14 +- Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). +- Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-22.fc14 +- testsuite: Provide missing lib/gdb-python.exp (for BZ 639089). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-21.fc14 +- Fix python stale error state, also fix its save/restore (BZ 639089). +- Fix inferior exec of new PIE x86_64 (BZ 638979). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-20.fc14 +- Fixup Release for 20.fc14. + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-19.fc14 +- Use .gdb_index v3 to fix excessive resources rqmnts (BZ 640634, Tom Tromey). + +* Wed Oct 6 2010 Jan Kratochvil - 7.2-18.fc14 +- Fix false warning: non-absolute filename: (BZ 640648). + +* Thu Sep 30 2010 Jan Kratochvil - 7.2-17.fc14 +- New Conflicts: elfutils < 0.149 due to the .gdb_index .debug support. + +* Wed Sep 29 2010 Jan Kratochvil - 7.2-16.fc14 +- [ifunc] Fix crash on deleting watchpoint of an autovariable (BZ 637770). + +* Mon Sep 27 2010 Jan Kratochvil - 7.2-15.fc14 +- Revert the -O0 switch formerly to workaround GCC BZ 634757 (cmove bug). +- Remove no longer used BuildRequires: libstdc++. +- Remove commented out python libstdc++ .spec code. + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-14.fc14 +- Fixup %{_datadir}/gdb/python/gdb timestamps for multilib conflicts. + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-13.fc14 +- Fix .gdb_index for big-endian hosts (Tom Tromey). + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-12.fc14 +- Fix lost siginfo_t in linux-nat (BZ 592031). + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-11.fc14 +- Fix infinite loop crash on self-referencing class (BZ 627432). + +* Thu Sep 23 2010 Jan Kratochvil - 7.2-10.fc14 +- gcore/-Wl,-z,relro: Always write out all the pages until kernel gets a fix. + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-9.fc14 +- Fix gcore writer for -Wl,-z,relro (PR corefiles/11804). + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-8.fc14 +- Enable python by default even in Brew and on all the arches (BZ 609157). + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-7.fc14 +- python: load *-gdb.py for shlibs during attach (BZ 634660). +- Fix double free crash during overload resolution (PR 12028, Sami Wagiaalla). + +* Sat Sep 18 2010 Jan Kratochvil - 7.2-6.fc14 +- Fix python gdb.solib_address (BZ 634108, fix by Phil Muldoon). +- Temporarily build with -O0 to workaround GCC BZ 634757 (cmove bug). + +* Tue Sep 14 2010 Jan Kratochvil - 7.2-5.fc14 +- Fix Ada regression when any .gdb_index library is present. + +* Sat Sep 11 2010 Jan Kratochvil - 7.2-4.fc14 +- Fix symbol lookup misses methods of current class (BZ 631158, Sami Wagiaalla). +- Fix python gdb.execute-to_string redirection (BZ 627506, with Paul Bolle). + +* Wed Sep 8 2010 Jan Kratochvil - 7.2-3.fc14 +- Do not crash on broken separate debuginfo due to old elfutils (BZ 631575). + +* Sat Sep 04 2010 Dennis Gilmore - 7.2-2.fc14 +- libinproctrace doesnt exist on sparc arches + +* Fri Sep 3 2010 Jan Kratochvil - 7.2-1.fc14 +- Formal update to the final FSF GDB release. + +* Tue Aug 24 2010 Dan Horák - 7.1.90.20100806-12.fc14 +- libinproctrace doesn't exist on s390(x) + +* Thu Aug 19 2010 Jan Kratochvil - 7.1.90.20100806-11.fc14 +- Fix crash on MI variable calling inferior function (BZ 610986). + +* Tue Aug 10 2010 Jan Kratochvil - 7.1.90.20100806-10.fc14 +- Fix /usr/bin/gdb-add-index missing -nx for gdb. +- New option --with profile (disabled by default - missing workload, BZ 615603). + +* Sat Aug 7 2010 Jan Kratochvil - 7.1.90.20100806-9.fc14 +- Fix python gdb.execute to_string pagination (BZ 620930). + +* Fri Aug 6 2010 Jan Kratochvil - 7.1.90.20100806-8.fc14 +- Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248). + +* Fri Aug 6 2010 Jan Kratochvil - 7.1.90.20100806-7.fc14 +- Fix gcore from very small terminal windows (BZ 555076). +- Fix false `filesystem' debuginfo rpm request (BZ 599598). + +* Wed Jul 28 2010 Mamoru Tasaka - 7.1.90.20100721-6.fc14 +- Rebuild against python 2.7 + +* Thu Jul 22 2010 Jan Kratochvil - 7.1.90.20100721-5.fc14 +- Fix /usr/bin/gdb-add-index $d -> $dir typo. + +* Thu Jul 22 2010 Jan Kratochvil - 7.1.90.20100721-4.fc14 +- Import archer-tromey-python. +- Import archer-tromey-optional-psymtab (as present in FSF GDB post-7.2). + - Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey). + +* Thu Jul 22 2010 David Malcolm - 7.1.90.20100721-3.fc14 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Jul 21 2010 Jan Kratochvil - 7.1.90.20100721-2.fc14 +- Fix prelinked executables with sepdebug and copy relocations (BZ 614659). + +* Wed Jul 21 2010 Jan Kratochvil - 7.1.90.20100721-1.fc14 +- Rebase to FSF GDB 7.1.90.20100721 (which is 7.2 pre-release). + +* Tue Jul 13 2010 Jan Kratochvil - 7.1-29.fc14 +- Disable temporarily Python files before the new rebase is done (BZ 613710). + +* Sun Jul 11 2010 Jan Kratochvil - 7.1-28.fc14 +- Rebuild for Fedora 14. + +* Wed Jun 30 2010 Jan Kratochvil - 7.1-28.fc13 +- Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller). + +* Wed Jun 30 2010 Jan Kratochvil - 7.1-27.fc13 +- Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil). +- Improve support for typedefs in classes (BZ 602314). +- Fix `set print object on' for some non-dynamic classes (BZ 606660). + +* Wed Jun 9 2010 Jan Kratochvil - 7.1-26.fc13 +- Backport DWARF-4 support (BZ 601887, Tom Tromey). + +* Wed Jun 9 2010 Jan Kratochvil - 7.1-25.fc13 +- Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla). + +* Tue Jun 1 2010 Jan Kratochvil - 7.1-24.fc13 +- Fix crash on /proc/PID/stat race during inferior exit (BZ 596751). +- testsuite: gdb.threads/watchthreads-reorder.exp kernel-2.6.33 compat. fix. + +* Sun May 30 2010 Jan Kratochvil - 7.1-23.fc13 +- Fix and support DW_OP_*piece (Tom Tromey, BZ 589467). +- Fix follow-exec for C++ programs (bugreported by Martin Stransky). + +* Mon May 24 2010 Jan Kratochvil - 7.1-22.fc13 +- Remove core file when starting a process (BZ 594560). +- Fix lock up on loops in the solib chain (BZ 593926). +- Import fix of TUI layout internal error (BZ 595475). + +* Sun May 16 2010 Jan Kratochvil - 7.1-21.fc13 +- Make gdb-6.8-bz254229-gcore-prpsinfo.patch RHEL-5 /usr/bin/patch compatible + (bugreported by Jonas Maebe). + +* Thu May 13 2010 Jan Kratochvil - 7.1-20.fc13 +- Fix crash on VLA bound referencing an optimized-out variable (BZ 591879). +- Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch. + +* Wed May 12 2010 Jan Kratochvil - 7.1-19.fc13 +- Backport -completion bug on anonymous structure fields (BZ 590648). +- testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635). +- Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). + +* Thu Apr 29 2010 Jan Kratochvil - 7.1-18.fc13 +- Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey). + +* Tue Apr 27 2010 Jan Kratochvil - 7.1-17.fc13 +- Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey). + +* Tue Apr 27 2010 Jan Kratochvil - 7.1-16.fc13 +- Temporarily workaround the crash of BZ 575292 as there was now BZ 585445. + +* Mon Apr 26 2010 Jan Kratochvil - 7.1-15.fc13 +- Fix crash when using GNU IFUNC call from breakpoint condition. +- Avoid internal error by disabling the previous BZ 575292 fix (BZ 585445). + +* Thu Apr 22 2010 Jan Kratochvil - 7.1-14.fc13 +- Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz). +- Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil). + +* Fri Apr 16 2010 Jan Kratochvil - 7.1-13.fc13 +- archer-jankratochvil-fedora13 commit: 39998c496988faaa1509cc6ab76b5c4777659bf4 +- [vla] Fix boundaries for arrays on -O2 -g (support bound-ref->var->loclist). +- [vla] Fix copy_type_recursive for unavailable variables (Joost van der Sluis). + +* Sun Apr 11 2010 Jan Kratochvil - 7.1-12.fc13 +- Fix crash on trying to load invalid executable (BZ 581215). + +* Thu Apr 8 2010 Jan Kratochvil - 7.1-11.fc13 +- testsuite: Fix gdb.base/gstack.exp also for ppc64 inferiors (for BZ 579793). + +* Thu Apr 8 2010 Jan Kratochvil - 7.1-10.fc13 +- Fix s390 --with testsuite Buildrequiers to be (s390-32) (BZ 580347, Cai Qian). + +* Wed Apr 7 2010 Jan Kratochvil - 7.1-9.fc13 +- Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ 579793) +- Merge gdb-6.3-gstack-without-path-20060414.p* into gdb-6.3-gstack-20050411.p*, + no real code change. + +* Mon Apr 5 2010 Jan Kratochvil - 7.1-8.fc13 +- Fix breakpoint at *_start (BZ 162775, bugreport by John Reiser). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-7.fc13 +- Fix ppc build of the AVX registers support (for BZ 578250). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-6.fc13 +- Support AVX registers (BZ 578250). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-5.fc13 +- Fix dangling displays in separate debuginfo (BZ 574483). + +* Wed Mar 31 2010 Jan Kratochvil - 7.1-4.fc13 +- Remove gdb-readline-6.0-signal.patch with a bug causing crash while no longer + required with F-13 readline-6.1 (BZ 575516) + +* Mon Mar 29 2010 Jan Kratochvil - 7.1-3.fc13 +- [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla). + +* Mon Mar 29 2010 Jan Kratochvil - 7.1-2.fc13 +- Drop obsoleted `gdb-archer-pie-0315-breakpoint_address_match.patch'. +- Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742). + - PIE: Attach binary even after re-prelinked underneath. + - PIE: Attach binary even after ld.so re-prelinked underneath. + - PIE: Fix occasional error attaching i686 binary (BZ 576742). +- testsuite: Fix unstable results of gdb.base/prelink.exp. + +* Thu Mar 25 2010 Jan Kratochvil - 7.1-1.fc13 +- Update to new FSF GDB release. + +* Mon Mar 15 2010 Jan Kratochvil - 7.0.90.20100312-24.fc13 +- Drop gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch having false symbols + resolving (related to BZ 573277). + +* Fri Mar 12 2010 Jan Kratochvil - 7.0.90.20100312-23.fc13 +- Update to new FSF GDB snapshot. +- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975). + +* Wed Mar 10 2010 Jan Kratochvil - 7.0.90.20100306-22.fc13 +- Another License update. + +* Wed Mar 10 2010 Jan Kratochvil - 7.0.90.20100306-21.fc13 +- Update License for all the licenses contained in .src.rpm. + +* Mon Mar 8 2010 Jan Kratochvil - 7.0.90.20100306-20.fc13 +- Remove unapplied: gdb-6.8-inlining-addon.patch gdb-6.8-inlining-by-name.patch + +* Mon Mar 8 2010 Jan Kratochvil - 7.0.90.20100306-19.fc13 +- Include also %%doc COPYING3 (review by Petr Machata). +- Remove URL for Source (review by Matej Cepl). + +* Sun Mar 7 2010 Jan Kratochvil - 7.0.90.20100306-18.fc13 +- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd + +* Sun Feb 28 2010 Jan Kratochvil - 7.0.50.20100203-17.fc13 +- Fix false warning: section .gnu.liblist not found in ... +- Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch). + +* Fri Feb 26 2010 Jan Kratochvil - 7.0.50.20100203-16.fc13 +- Fix ia64 part of the bt-clone-stop.exp fix. +- Fix gdb.ada/* regressions (Keith Seitz). +- Remove false gdb_assert on $sp underflow. + +* Mon Feb 8 2010 Jan Kratochvil - 7.0.50.20100203-15.fc13 +- Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866). + +* Wed Feb 3 2010 Jan Kratochvil - 7.0.50.20100203-14.fc13 +- Rediff gdb-6.8-bz254229-gcore-prpsinfo.patch for older patch(1) compatibility. + +* Wed Feb 3 2010 Jan Kratochvil - 7.0.50.20100203-13.fc13 +- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd +- Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291; + David Moore, Intel). + +* Mon Feb 1 2010 Jan Kratochvil - 7.0.50.20100128-12.fc13 +- archer-jankratochvil-fedora13 commit: 5a573e8b26a2f0a6947d4c0249e43e5456610860 +- Remove ExcludeArch on ia64 as it is now fixed up. + +* Sun Jan 31 2010 Jan Kratochvil - 7.0.50.20100128-11.fc13 +- Fix failed gdb_assert due to the PIE patchset (BZ 559414). + +* Thu Jan 28 2010 Jan Kratochvil - 7.0.50.20100128-10.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100128 +- archer-jankratochvil-fedora13 commit: 39c5a8b75fad3acd7204903db5dee025055a4594 + - Fix a regression on "AAA::ALPHA" test due to a merge from FSF GDB. +- Fix a regression of previous release due to false identification as core file. +- Move ifunc .patch into the GIT-managed archer-jankratochvil-fedora13 branch. +- Update gdb.pie/corefile.exp from 2007-01-26 FSF GDB commit by Andreas Schwab. + +* Mon Jan 25 2010 Jan Kratochvil - 7.0.50.20100121-9.fc13 +- Enable loading a core file just as a single argument to /usr/bin/gdb. + +* Sun Jan 24 2010 Jan Kratochvil - 7.0.50.20100121-8.fc13 +- testsuite: Fix gdb.arch/i386-bp_permanent.exp regression + +* Sun Jan 24 2010 Jan Kratochvil - 7.0.50.20100121-7.fc13 +- Update gdb.arch/powerpc-power7.exp for current binutils HEAD. + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-6.fc13 +- Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert. +- Fix gdb.arch/powerpc-power7.exp compatibility. + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-5.fc13 +- Disable break-by-name on inlined functions due to a regression on parameters + of inlined functions falsely (BZ 556975 Comment 8). + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-4.fc13 +- Adjust BuildRequires for RHELs, add ExcludeArch on ia64. +- Disable one PIE-introduced assertion on RHELs. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-3.fc13 +- Revert FSF GDB gdbserver tracepoints as incomplete now. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-2.fc13 +- archer-jankratochvil-fedora13 commit: 21e418c04290aa5d2e75543d31fe3fe5d70d6d41 +- [expr-cumulative] Fix "break expr if (cond)" regression. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100121 +- archer-jankratochvil-fedora13 commit: ccde1530479cc966374351038057b9dda90aa251 +- [expr-cumulative] Archer branch is now included. + +* Tue Jan 19 2010 Jan Kratochvil - 7.0.50.20100118-2.fc13 +- Fix false PASS->FAIL of gdb.arch/i386-biarch-core.exp. + +* Tue Jan 19 2010 Jan Kratochvil - 7.0.50.20100118-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100118 +- Upgrade libstdc++-v3-python to r155978 (Phil Muldoon). + +* Sat Jan 16 2010 Jan Kratochvil - 7.0.50.20100116-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100116 +- archer-jankratochvil-fedora13 commit: 81810a20b2d2c3bf18e151de3cddfc96445b3c46 +- [expr-cumulative] Archer branch is missing in this release. +- Update rpm.org#76 workaround for rpm-4.8 using librpm.so.1. +- Dissect archer-jankratochvil-misc into Patch403...Patch408. +- Some regressions exist in this release. + +* Tue Jan 12 2010 Jan Kratochvil - 7.0.1-25.fc12 +- non-librpm missing debuginfo yumcommand now prints also --disablerepo='*' + to save some bandwidth by yum (Robin Green, BZ 554152). + +* Sun Jan 10 2010 Jan Kratochvil - 7.0.1-24.fc12 +- testsuite: BuildRequires also valgrind. + +* Fri Jan 8 2010 Jan Kratochvil - 7.0.1-23.fc12 +- Workaround missing libstdc++%%{bits_other} in Koji. + +* Fri Jan 8 2010 Jan Kratochvil - 7.0.1-22.fc12 +- Comply with new package review: + - Fix .spec Source as this is not a snapshot now. + - Convert all spaces to tabs. + - Fix missing %%defattr at %%files for gdbserver. + - Replace all hardcoded-library-path by variants of %%{_isa}. +- Include %%{_isa} for appropriate Requires and BuildRequires. + +* Thu Jan 7 2010 Jan Kratochvil - 7.0.1-21.fc12 +- [vla] Fix regression on fields of structs in internal vars (BZ 553338). +- archer-jankratochvil-fedora12 commit: 6e73988f653ba986e8742f208f17ec084292cbd5 + +* Thu Jan 7 2010 Jan Kratochvil - 7.0.1-20.fc12 +- Fix crash reading broken stabs (it377671). + +* Sun Jan 3 2010 Jan Kratochvil - 7.0.1-19.fc12 +- testsuite: Fixup false FAILs for gdb.cp/constructortest.exp. + +* Sat Jan 2 2010 Jan Kratochvil - 7.0.1-18.fc12 +- Fix regression of gdb-7.0 (from 6.8) crashing on typedefed bitfields. +- Fix related_breakpoint stale ref crash. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0.1-17.fc12 +- Formal upgrade to the FSF GDB release gdb-7.0.1. + - Fix regression of gdb-7.0.1 not preserving typedef of a field. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0-16.fc12 +- More RHEL-5 compatibility updates. + - Disable the build-id support by default. + - Bundle back gdbserver to the base gdb package. + - Remove bundled pstack. + - Drop the BuildRequires of rpm-devel. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0-15.fc12 +- Fix error on a sw watchpoint active at function epilogue (hit on s390x). +- testsuite: Fix false MI "unknown output after running" regression. +- testsuite: Update ia64-sigtramp.exp for recent GDB. +- Implement bt-clone-stop.exp fix also for ia64. +- testsuite: Upstream condbreak.exp results stability fix (Daniel Jacobowitz). + +* Thu Dec 24 2009 Jan Kratochvil - 7.0-14.fc12 +- testsuite: Fix constructortest.exp and expand-sals.exp for gcc-4.4.2-20.fc12. + +* Mon Dec 21 2009 Jan Kratochvil - 7.0-13.fc12 +- [pie] Fix a race in testcase gdb.base/valgrind-db-attach.exp. +- Fix regression by python on ia64 due to stale current frame. +- Disable python iff RHEL-5 && (Brew || ppc64). + +* Mon Dec 21 2009 Jan Kratochvil - 7.0-12.fc12 +- Workaround build on native ppc64 host. +- More RHEL-5 compatibility updates. + - Disable warning messages new for gdb-6.8+ for RHEL-5 backward compatibility. + - Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595). + - Serialize the testsuite output to keep the order for regression checks. + - Re-enable python for all non-ppc* arches. + - More gcc44 stack exceptions when running the testsuite on RHEL-5. +- Fix backward compatibility with G++ 4.1 namespaces "::". +- Fix regression on re-setting the single ppc watchpoint slot. +- Update snapshot of FSF gdb-7.0.x branch. + - Backport fix of dcache invalidation locking up GDB on ppc64 targets. + +* Fri Dec 18 2009 Jan Kratochvil - 7.0-11.fc12 +- [pie] Fix general ppc64 regression due to a function descriptors bug. +- [pie] Fix also keeping breakpoints disabled in PIE mode. +- Import upstream -completion crash fix. +- Drop some unused patches from the repository. +- More RHEL-5 build compatibility updates. + - Use gfortran44 when running the testsuite on RHEL-5. + - Disable python there due to insufficient ppc multilib. +- Fix orphanripper hangs and thus enable it again. + +* Mon Dec 14 2009 Jan Kratochvil - 7.0-10.fc12 +- Make gdb-6.3-rh-testversion-20041202.patch to accept both RHEL and Fedora GDB. +- Adjust BuildRequires for Fedora-12, RHEL-6 and RHEL-5 builds. +- [vla] Fix compatibility of dynamic arrays with iFort (BZ 514287). +- Fix stepping through OMP parallel Fortran sections (BZ 533176). +- New fix of bp conditionals [bp_location-accel] regression (BZ 538626). + +* Mon Dec 7 2009 Jan Kratochvil - 7.0-9.fc12 +- Replace the PIE (Position Indepdent Executable) support patch by a new one. +- Drop gdb-6.3-nonthreaded-wp-20050117.patch as fuzzy + redundant. +- Fix callback-mode readline-6.0 regression for CTRL-C. +- Fix syscall restarts for amd64->i386 biarch. +- Various testsuite results stability fixes. +- Fix crash on reading stabs on 64bit (BZ 537837). +- archer-jankratochvil-fedora12 commit: 16276c1aad1366b92e687c72cab30192280e1906 +- archer-jankratochvil-pie-fedora12 ct: 2ae60b5156d43aabfe5757940eaf7b4370fb05d2 + +* Thu Dec 3 2009 Jan Kratochvil - 7.0-8.fc12 +- Fix slowness/hang when printing some variables (Sami Wagiaalla, BZ 541093). +- archer-jankratochvil-fedora12 commit: 6817a81cd411acc9579f04dcc105e9bce72859ff + +* Wed Nov 25 2009 Jan Kratochvil - 7.0-7.fc12 +- Support GNU IFUNCs - indirect functions (BZ 539590). +- Fix bp conditionals [bp_location-accel] regression (Phil Muldoon, BZ 538626). +- Fix missed breakpoint location [bp_location-accel] regression (upstream). + +* Fri Oct 30 2009 Jan Kratochvil - 7.0-6 +- Fix missing zlib-devel BuildRequires to support compressed DWARF sections. +- Include post-7.0 FSF GDB fixes. + +* Fri Oct 23 2009 Jan Kratochvil - 7.0-5 +- Make the package buildable on RHEL-5/CentOS-5 (without librpm there). +- archer-jankratochvil-fedora12 commit: 5b73ea6a0f74e63db3b504792fc1d37f548bdf5c + +* Fri Oct 23 2009 Jan Kratochvil - 7.0-4 +- Fix rpm --excludedocs (BZ 515998). + +* Thu Oct 22 2009 Jan Kratochvil - 7.0-3 +- Support multiple directories for `set debug-file-directory' (BZ 528668). + +* Mon Oct 19 2009 Jan Kratochvil - 7.0-2 +- Sync the .spec with RHEL/CentOS without EPEL, do not BuildRequires: fpc there. + +* Wed Oct 7 2009 Jan Kratochvil - 7.0-1 +- Formal upgrade to the final FSF GDB release gdb-7.0. +- Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. +- archer-jankratochvil-fedora12 commit: ce4ead356654b951a49ca78d81ebfff95e758bf5 + +* Wed Sep 30 2009 Jan Kratochvil - 6.8.91.20090930-2 +- Bump release. + +* Wed Sep 30 2009 Jan Kratochvil - 6.8.91.20090930-1 +- Fix broken python "help()" command "modules" (BZ 526552). +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090930 +- archer-jankratochvil-fedora12 commit: 7cb860f03e2437c97239334ebe240d06f45723e0 + +* Sun Sep 27 2009 Jan Kratochvil - 6.8.91.20090925-3 +- New test for step-resume breakpoint placed in multiple threads at once. + +* Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-2 +- Fix buildid-loading libs w/matching name but different build-id (BZ 524572). + +* Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-1 +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090925 +- archer-jankratochvil-fedora12 commit: 4338ea85c798007c32594032f602db9fd230eba9 + - [python] Don't directly reference self.frame (Tom Tromey). + - [expr] Updates from branch (Keith Seitz). + +* Mon Sep 21 2009 Jan Kratochvil - 6.8.91.20090921-1 +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090921 +- archer-jankratochvil-fedora12 commit: 0d5c38dd89050c0ee1cf049656f177c170d675d4 + - [expr] Check has_stack_frames before calling find_pc_line (Sami Wagiaalla). + +* Thu Sep 17 2009 Jan Kratochvil - 6.8.91.20090917-2 +- Include bundled libstdc++ python; it will be in libstdc++-devel since gcc-4.5. + +* Thu Sep 17 2009 Jan Kratochvil - 6.8.91.20090917-1 +- Upgrade to the FSF GDB gdb-7.0 branch and snapshot: 6.8.91.20090917 +- archer-jankratochvil-fedora12 commit: 16f3f01cc2cbc15283462eaabdfcde92cf42cdc6 +- Drop the qsort_cmp workaround as resolved in FSF GDB now (BZ 515434). + +* Thu Sep 10 2009 Jan Kratochvil - 6.8.50.20090910-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090910 +- archer-jankratochvil-fedora12 commit: 941eb487a42933e442cb4d11344cda96ecb8a04d + - [next-over-throw] Fix exceptions thrown during next (Tom Tromey). + - [bp_location-accel] Do not (much) slow down on 500+ breakpoints (me). + +* Thu Sep 3 2009 Jan Kratochvil - 6.8.50.20090818-8 +- archer-jankratochvil-fedora12 commit: a081d2f12945e9468edd5f4341d3e945bd0fefe9 + - [expr] Fix too slow lookups in large C++ programs (Sami Wagiaalla). + - [python] Fix varobj changed values reporting (GDB PR 10584, Tom Tromey). + +* Tue Sep 1 2009 Jan Kratochvil - 6.8.50.20090818-7 +- archer-jankratochvil-fedora12 commit: d25596676e8811b03f8c9aba6bbd04ebaa9ff5db + - [call-frame-cfa] Fix parsing CFA-relative frames (BZ 516627, Tom Tromey). + - [vla] variable length Fortran strings for -O -g code (part of BZ 508406, me). + - [python] varobj + general fixes (Tom Tromey). + +* Fri Aug 28 2009 Jan Kratochvil - 6.8.50.20090818-6 +- Real upstream fixup of qsort_cmp (BZ 515434). +- Revert bitfields regression (BZ 520129). + +* Tue Aug 25 2009 Jan Kratochvil - 6.8.50.20090818-5 +- Temporarily disable assertion checks crashing in qsort_cmp (BZ 515434). + +* Wed Aug 19 2009 Jan Kratochvil - 6.8.50.20090818-4 +- Fixup "bad type" internal error, import from FSF GDB. +- archer-jankratochvil-fedora12 commit: 2ba2bc451eb832182ef84c3934115de7a329da7c + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-3 +- archer-jankratochvil-fedora12 commit: 850e3cb38a25cb7fdfa4cef667626ffbde51bcac +- Fix the hardware watchpoints. + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-2 +- Fix patch fuzz 0. + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090818 +- archer-jankratochvil-fedora12 commit: 5e0d1cc74f119391a2c3ae25ef5749fc28674f06 + +* Wed Aug 12 2009 Jan Kratochvil - 6.8.50.20090811-4 +- Fix minor regressions introduced by the rebase from F-11 (6.8.50.20090302). + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-3 +- archer-jankratochvil-fedora12 commit: 2888fafe63889757c6fd27ccc2f25661d43fd1a4 +- Drop archer-jankratochvil-vla VAROBJ invalidate/revalidate split to fix + regressions against FSF GDB HEAD. + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-2 +- archer-jankratochvil-fedora12 commit: 93f5e942bdcdcc376ece452c309bedabae71def9 +- Fix "can't compute CFA for this frame" (by Tom Tromey, BZ 516627). + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-1 +- Support constant DW_AT_data_member_location by GCC PR debug/40659 (BZ 515377). +- Fix .spec URL. +- archer-jankratochvil-fedora12 commit: 81de3c6abae4f7e3738aa9bcc0ab2f8725cce252 + +* Mon Aug 10 2009 Jan Kratochvil - 6.8.50.20090810-2 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090810 +- archer-jankratochvil-fedora12 commit: 93ec16e6f5000dd64d433d86674e820ed0f35b72 + +* Tue Aug 4 2009 Jan Kratochvil - 6.8.50.20090803-2 +- Drop the bundled libstdc++ python - it should be packaged on its own now. + +* Tue Aug 4 2009 Jan Kratochvil - 6.8.50.20090803-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090803 +- archer-jankratochvil-fedora12 commit: 0222cb1f4ddd1eda32965e464cb60b1e44e110b2 + +* Fri Jul 31 2009 Jan Kratochvil - 6.8.50.20090302-42 +- Release bump only. + +* Fri Jul 31 2009 Jan Kratochvil - 6.8.50.20090302-41 +- Fix compatibility of --with-system-readline and readline-6.0+. +- Temporarily disabled orphanripper on Fedora 12. + +* Fri Jul 24 2009 Fedora Release Engineering - 6.8.50.20090302-40 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 6 2009 Jan Kratochvil - 6.8.50.20090302-39 +- testsuite: Fix multiple runs in parallel on a single host. +- testsuite: Remove the rpmbuild option: --with parallel +- testsuite: Run the testsuite with default rpm _smp_mflags. + +* Mon Jul 6 2009 Jan Kratochvil - 6.8.50.20090302-38 +- Archer update to the snapshot: 17bfc0488f54aeeb7a9e20ef3caa7e31e8e985fb +- Archer backport: de9c5190034b84b0a5fb4b98b05b304cda187700 + - [vla] Fix a crash regression on constant DW_AT_data_member_location. + +* Mon Jun 29 2009 Jan Kratochvil - 6.8.50.20090302-37 +- Replace the fix of cloned-TIDs with no pthread from upstream (BZ 471819). +- Fix a parallel testsuite runs incompatibility in gdb.base/gcore-shmid0.exp. + +* Mon Jun 29 2009 Jan Kratochvil - 6.8.50.20090302-36 +- Fix GDB crash on cloned-TIDs with no associated pthread (BZ 471819). +- Workaround rpm.org#76 rpm-devel requirement for debuginfo names (BZ 508193). + +* Mon Jun 22 2009 Jan Kratochvil - 6.8.50.20090302-35 +- Accelerate sorting blocks on reading a file (found on WebKit) (BZ 507267). + +* Mon Jun 22 2009 Jan Kratochvil - 6.8.50.20090302-34 +- Fix backtraces from core files with the executable found+loaded via build-id. + - Due to F-11 GCC no longer needlessly duplicating .eh_frame as .debug_frame. + +* Tue Jun 16 2009 Jan Kratochvil - 6.8.50.20090302-33 +- Archer update to the snapshot: 05c402a02716177c4ddd272a6e312cbd2908ed68 +- Archer backport: 05c402a02716177c4ddd272a6e312cbd2908ed68 + - Remove the [archer-pmuldoon-exception-rewind-master] branch. + - Include this functionality as a FSF GDB accepted patchset. + +* Mon Jun 15 2009 Jan Kratochvil - 6.8.50.20090302-32 +- Fix crash on pending breakpoints with PIE (position-indep.-exec.) (BZ 505943). + +* Fri Jun 12 2009 Jan Kratochvil - 6.8.50.20090302-31 +- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401). + +* Fri Jun 12 2009 Jan Kratochvil - 6.8.50.20090302-30 +- Implement DW_OP_call_frame_cfa (for recent GCC). + +* Thu Jun 11 2009 Jan Kratochvil - 6.8.50.20090302-29 +- Archer update to the snapshot: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 +- Archer backport: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 + - Fix dereferencing unbound C arrays (BZ 505163). + +* Wed Jun 10 2009 Jan Kratochvil - 6.8.50.20090302-28 +- Archer update to the snapshot: 000db8b7bfef8581ef099ccca8689cfddfea1be8 +- Archer backport: b8d3bea36b137effc929e02c4dadf73716cb330b + - Ignore explicit die representing global scope '::' (gcc 4.1 bug). +- Archer backport: c2d5c4a39b10994d86d8f2f90dfed769e8f216f3 + - Fix parsing DW_AT_const_value using DW_FORM_string +- Archer backport: 8d9ab68fc0955c9de6320bec2821a21e3244600d + + db41e11ae0a3aec7120ad6ce86450d838af74dd6 + - Fix Fortran modules/namespaces parsing (but no change was visible in F11). +- Archer backport: 000db8b7bfef8581ef099ccca8689cfddfea1be8 + - Fix "some Python error when displaying some C++ objects" (BZ 504356). +- testsuite: Support new rpmbuild option: --with parallel +- testsuite: gdb-orphanripper.c: Fix uninitialized `termios.c_line'. +- Fix crashes due to (missing) varobj revalidation, for VLA (for BZ 377541). +- Archer backport: 58dcda94ac5d6398f47382505e9d3d9d866d79bf + + f3de7bbd655337fe6705aeaafcc970deff3dd5d5 + - Implement Fortran modules namespaces (BZ 466118). +- Fix crash in the charset support. + +* Thu Apr 30 2009 Jan Kratochvil - 6.8.50.20090302-27 +- Fix race in the ia64 testcase `gdb-6.3-rh-testlibunwind-20041202.patch'. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-26 +- Support a new rpmbuild option: --without python + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-25 +- The Koji build failures may have been by forgotten check-in of the Patch360. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-24 +- Another new Koji build fix attempt now by: BuildPreReq: python + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-23 +- Fix BuildRequires for new Koji. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-22 +- Fix pstack/gstack cutting very long lines (BZ 497849). + +* Sun Apr 19 2009 Jan Kratochvil - 6.8.50.20090302-21 +- New test for parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). + +* Thu Apr 16 2009 Jan Kratochvil - 6.8.50.20090302-20 +- Fix crash in the charset support. + +* Wed Apr 15 2009 Jan Kratochvil - 6.8.50.20090302-19 +- Fix crash on pretty-printer reading uninitialized std::string (BZ 495781). + +* Mon Apr 13 2009 Jan Kratochvil - 6.8.50.20090302-18 +- Archer update to the snapshot: d1fee5066408a09423621d1ebc64e6d3e248ed08 +- Archer backport: 4854339f75bdaf4b228fc35579bddbb2a1fecdc1 + - Fix Python FrameIterator. + +* Mon Apr 13 2009 Jan Kratochvil - 6.8.50.20090302-17 +- Archer update to the snapshot: 7c250ce99c90cf6097e2ec55ea0f205830979cee +- Archer backport: c14d9ab7eef43281b2052c885f89d2db96fb5f8e + - Revert a change regressing: gdb.objc/basicclass.exp +- Archer backport: ebd649b96e61a1fb481801b65d827bca998c6633 + + 1f080e897996d60ab7fde20423e2947512115667 + + 1948198702b51b31d79793fc49434b529b4e245f + + e107fb9687bb1e7f74170aa3d19c4a8f6edbb10f + + 1e012c996e121cb35053d239a46bd5dc65b0ce60 + - Update the Python API from upstream. +- Archer backport: d3c83ad5ec9f7672b87af9ad29279f459e53da11 + - Fix a Python branch crash. + +* Mon Apr 13 2009 Dennis Gilmore - 6.8.50.20090302-16 +- enable gdbserver package on sparc64 + +* Sun Apr 5 2009 Jan Kratochvil - 6.8.50.20090302-15 +- Archer update to the snapshot: 7c7c77576669d17ad5072daa47ea3a4fd954483d +- Archer backport: 7c7c77576669d17ad5072daa47ea3a4fd954483d (Peter Bergner) + - Disassemble Power7 instructions right in the default/only -Many GDB mode. + +* Sun Apr 5 2009 Jan Kratochvil - 6.8.50.20090302-14 +- Archer update to the snapshot: f6273d446ff87e50976600ba3f71b88d61043e20 +- Archer backport: f6273d446ff87e50976600ba3f71b88d61043e20 + - Use pretty-printers to print base classes inside a derived class. + +* Mon Mar 30 2009 Jan Kratochvil - 6.8.50.20090302-13 +- Archer update to the snapshot: d144a3633454046aaeae3e2c369c271834431d36 +- Archer backport: a2c49b7640ebe7ce1376902d48d5bbbee600996b + - Fixup compilation older GCCs. +- Archer backport: fe48224ce1bd22f37a7fa6d111d54c1a340392bf + - KFAIL 4 cases of: gdb.arch/powerpc-power7.exp +- Archer backport: d144a3633454046aaeae3e2c369c271834431d36 + - Fix C local extern variables (requires gcc-4.4.0-0.30). + +* Fri Mar 27 2009 Jan Kratochvil - 6.8.50.20090302-12 +- Archer update to the snapshot: 837d9879980148af05eae540d92caeb7200f1813 +- Archer backport: 8340d06295c8db80c544503458305197891e0348 + - Fixes [master] regression for Eclipse CDT testsuite. +- Archer backport: 16328456d5740917ade0a49bcecc14c4564b9a99 + - Fixes #2 [expr] compatibility with gcc-4.4 on gdb.cp/namespace-using.exp. +- Rebase [expr] on the Keith Seitz's sync with FSF GDB fixing the former merge. + +* Sun Mar 22 2009 Jan Kratochvil - 6.8.50.20090302-11 +- Archer update to the snapshot: e734ed95d296a3342d4147873c4641cea6c4d7fe +- Archer backport: 1e1d73cda98b1adda884b80e07c7b4929c175628 + - Fixes [expr] compatibility with gcc-4.4 on gdb.cp/namespace-using.exp. + +* Sun Mar 15 2009 Jan Kratochvil - 6.8.50.20090302-10 +- Archer update to the snapshot: 935f217d3367a642374bc56c6b146d376fc3edab +- Archer backport: 281278326412f9d6a3fabb8adc1d419fd7ddc7d7 + - Fix [expr] crash reading invalid DWARF C++ symbol "" (BZ 490319). + +* Thu Mar 12 2009 Jan Kratochvil - 6.8.50.20090302-9 +- Archer backport: aafe933b497eee8cfab736a10bae1a90d4bceb18 + - [python] Remove duplicate target-wide-charset parameter + +* Mon Mar 9 2009 Jan Kratochvil - 6.8.50.20090302-8 +- Archer update to the snapshot: a99e30d08ade4a2df0f943b036cd653bcd12b04d +- Fixes internal error on breaking at a multi-locations C++ caller (BZ 488572). + +* Mon Mar 9 2009 Jan Kratochvil - 6.8.50.20090302-7 +- Archer update to the snapshot: ec29855686f2a78d90ebcc63765681249bbbe808 +- Temporarily place libstdc++ pretty printers in this gdb.rpm. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-6 +- Archer update to the snapshot: 543fb2154d3bd551344b990b911be5c6cc703504 + - Fixes [delayed-symfile] excessive `(no debugging symbols found)' messages. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-5 +- Improve `gdb-6.6-buildid-locate-rpm.patch' by dlopen() (+pkg-config compat.). + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-4 +- Split `gdb-6.6-buildid-locate.patch' to `gdb-6.6-buildid-locate-rpm.patch'. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-3 +- Archer update to the snapshot: 6cf16c0711e844094ab694b3d929f7bd30b49f61 +- Fix crash on the inlined functions support. +- Fix crash from the PIE support, its varobj_refresh() was called only before + varobj_invalidate() which is sufficient. +- Fix BuildRequires for the `--with testsuite' runs. +- Use the newly introduced `--with-pythondir' option. +- Remove libstdcxx [python] pretty printers (as included in libstdc++ rpm now). + +* Fri Mar 06 2009 Jesse Keating - 6.8.50.20090302-2 +- Rebuild for new rpm libs + +* Mon Mar 2 2009 Jan Kratochvil - 6.8.50.20090302-1 +- Include the Archer Project: http://sourceware.org/gdb/wiki/ProjectArcher + snapshot: 8cc3753a9aad85bf53bef54c04334c60d16cb251 + * [python] Python scripting support: http://sourceware.org/gdb/wiki/PythonGdb + * [catch-syscall] Trap and display syscalls. + * [delayed-symfile] Improve startup performance by lazily read psymtabs. + * [exception-rewind] Fix fatal C++ exceptions in an inferior function call. + * [expr] Expressions, single-quote elimination, C++ input canonicalization. + * [using-directive] C++ namespaces. + * [vla] C variable length arrays / DW_FORM_block / Fortran dynamic arrays. + * [misc] Fix debuginfoless `return' (BZ 365111), fix command-line macros for + expected GCC (BZ 479914), new testcase for valgrind (for BZ 483262), + implement `info common' for Fortran, fix Fortran logical-kind=8 (BZ 465310), + fix static variable in C++ constructors (BZ 445912), fix power7 (BZ 485319). +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. +- Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). + - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. + +* Tue Feb 24 2009 Fedora Release Engineering - 6.8.50.20090210-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 11 2009 Jan Kratochvil - 6.8.50.20090210-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. + +* Wed Feb 11 2009 Jan Kratochvil - 6.8.50.20090209-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. + +* Mon Feb 9 2009 Jan Kratochvil - 6.8.50.20081214-2 +- Fix crash / implement `finish' into inlined functions (BZ 479781). +- Drop the gdb.threads/attach-into-signal.exp change as obsolete. + +* Sun Dec 14 2008 Jan Kratochvil - 6.8.50.20081214-1 +- Upgrade to the upstream gdb-6.8.50 snapshot. + +* Mon Dec 1 2008 Jan Kratochvil - 6.8-33 +- Make `--with testsuite' BuildRequires properly conditional. + +* Mon Dec 1 2008 Stepan Kasal - 6.8-32 +- Remove trivial BuildRequires, use rpm macros in a few remaining places. + +* Tue Nov 18 2008 Jan Kratochvil - 6.8-31 +- Enable ia64 hardware watchpoints if created before starting inferior. + +* Sun Nov 9 2008 Jan Kratochvil - 6.8-30 +- Fix a race in the testcase `gdb.threads/step-thread-exit.exp'. + +* Sun Nov 9 2008 Jan Kratochvil - 6.8-29 +- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Integrate the `bt full' protection (for BZ 466901) into the VLA patch. + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-28 +- Fix the "never terminate `bt full'" patch false GCC warning / build error. + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-27 +- Fix resolving of variables at locations lists in prelinked libs (BZ 466901), + bugreported by Michal Babej. +- Never terminate `bt full' on a problem of variable resolving (for BZ 466901). + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-26 +- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Fix the watchpoints conditionals. +- Fix on PPC spurious SIGTRAPs on active watchpoints. +- Fix occasional stepping lockup on many threads, seen on ia64. + +* Mon Nov 3 2008 Jan Kratochvil - 6.8-25 +- Fix the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Fix the debuginfo-install suggestions for missing base packages (BZ 467901), + also update the rpm/yum code to no longer require _RPM_4_4_COMPAT. + +* Tue Sep 2 2008 Jan Kratochvil - 6.8-24 +- Fix PIE patch regression for loading binaries from valgrind (BZ 460319). + +* Thu Aug 28 2008 Jan Kratochvil - 6.8-23 +- Fix attaching to stopped processes, based on the upstream version now. + - Just kernel-2.6.25 neither upstream nor utrace work with it; 2.6.9 works. +- Fix occasional crash on a removed watchpoint. +- Fix false testcase FAILs for `gdb.pie/break.exp'. +- Fix a false warning (+a testcase FAIL) on s390x watchpoints. +- Fix a false FAIL on s390x `gdb.base/dump.exp'. + +* Wed Aug 27 2008 Jan Kratochvil - 6.8-22 +- Remove `gdb-6.3-nonthreaded-wp-20050117.patch' as obsoleted + regressing now. +- Make the GDB quit processing non-abortable to cleanup everything properly. +- Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs. +- Fix crash on DW_TAG_module for Fortran in recent Fedora/RH GCCs. +- Readd resolving of bare names of constructors and destructors. +- Include various vendor testcases: + - Leftover zombie process (BZ 243845). + - Multithreaded watchpoints (`gdb.threads/watchthreads2.exp'). + - PIE testcases (`gdb.pie/*'). + - C++ contructors/destructors (`gdb.cp/constructortest.exp'). + +* Sat Aug 23 2008 Jan Kratochvil - 6.8-21 +- Fix MI debuginfo print on reloaded exec, found by Denys Vlasenko (BZ 459414). +- Extend the Fortran dynamic variables patch also for dynamic Fortran strings. + +* Wed Aug 13 2008 Jan Kratochvil - 6.8-20 +- Temporarily disable attaching to a stopped process (BZ 453688) + - To be reintroduced after a fix of the kernel BZ 454404. + +* Mon Aug 4 2008 Jan Kratochvil - 6.8-19 +- Fix `errno' printing on nonthreaded non-g3 inferiors (TLS minsym is absolute). + +* Fri Aug 1 2008 Jan Kratochvil - 6.8-18 +- Fix powerpc recent secure PLTs handling (shared library calls) (BZ 452960). +- Fix the testsuite .spec runner to run biarch also on ppc. +- Reenable testcases threadcrash.exp, chng-syms.exp, checkpoint.exp (BZ 207002). +- Fix PRPSINFO in the core files dumped by gcore (BZ 254229), reformatted patch + from Denys Vlasenko. +- Fix register assignments with no GDB stack frames, Denys Vlasenko (BZ 436037). + +* Mon Jul 14 2008 Jan Kratochvil - 6.8-17 +- Refresh the patchset with fuzz 0 (for new rpmbuild). + +* Mon Jul 14 2008 Jan Kratochvil - 6.8-16 +- Rebuild with the new rpm-4.5.90 in the buildroot. + +* Sat Jul 12 2008 Jan Kratochvil - 6.8-15 +- Temporary rpm-4.5.90 compatibility workaround by Panu Matilainen. +- Fix a regression in the constant watchpoints fix, found by Daniel Jacobowitz. +- Fix the prelink testcase for false FAILs on i386. + +* Tue Jul 8 2008 Jan Kratochvil - 6.8-14 +- Fix crash due to calling an inferior function right after a watchpoint stop. + +* Thu Jul 3 2008 Jan Kratochvil - 6.8-13 +- Support transparent debugging of inlined functions for an optimized code. + +* Fri Jun 20 2008 Jan Kratochvil - 6.8-12 +- Remove the gdb/gdbtui binaries duplicity. + +* Tue Jun 17 2008 Jan Kratochvil - 6.8-11 +- Fix the testsuite run for ia64 (where no -m64 is present). +- Test a crash on libraries missing the .text section. +- Protect development in the build tree by automatic Makefile dependencies. +- Refuse creating watchpoints of an address value, suggested by Martin Stransky. +- Disable randomization (such as by setarch -R), suggested by Jakub Jelinek. +- Fix compatibility with recent glibc headers. + +* Sun Jun 1 2008 Jan Kratochvil - 6.8-10 +- Fix crash on a watchpoint update on an inferior stop. +- Fix the s390x part of the hardware watchpoints after a fork. + +* Thu May 22 2008 Jan Kratochvil - 6.8-9 +- Fix memory trashing on binaries from GNAT/Ada (workaround GCC PR 35998). + +* Thu May 15 2008 Tom "spot" Callaway - 6.8-8 +- Silence memcpy check which returns false positive (sparc64) + +* Thu May 15 2008 Tom "spot" Callaway - 6.8-7 +- patch from DaveM for sparc/sparc64 +- touch up spec to enable sparcv9/sparc64 + +* Sat May 3 2008 Jan Kratochvil - 6.8-6 +- Fix gdb.base/gcore-shmid0.exp to be unresolved on recent kernels. +- Make the testsuite results of dfp-test.exp more stable. + +* Sun Apr 27 2008 Jan Kratochvil - 6.8-5 +- Remove the kernel VDSO workaround (`no loadable ...') (kernel BZ 312011). + +* Wed Apr 23 2008 Jan Kratochvil - 6.8-4 +- Backport fix on various forms of threads tracking across exec() (BZ 442765). +- Testsuite: Include more biarch libraries on %%{multilib_64_archs}. +- Disable the build-id warnings for the testsuite run as they cause some FAILs. +- Fix PIE support for 32bit inferiors on 64bit debugger. +- Fix trashing memory on one ada/gnat testcase. +- Make the testsuite results on ada more stable. + +* Wed Apr 16 2008 Jan Kratochvil - 6.8-3 +- Fix ia64 compilation errors (Yi Zhan, BZ 442684). +- Fix build on non-standard rpm-devel includes (Robert Scheck, BZ 442449). +- Do not run the PIE mode for the testsuite during `--with upstream'. +- Fix test of the crash on a sw watchpoint condition getting out of the scope. + +* Fri Apr 11 2008 Jan Kratochvil - 6.8-2 +- Fix a regression due to PIE of reloading a changed exec file (BZ 433410). +- Include also biarch libgcc on %%{multilib_64_archs} for the testsuite. +- Cosmetic fix of a testcase sanity breakpoint setting (part of BZ 233852). +- New test of hiding unexpected breakpoints on intentional step commands. +- New test of GCORE for shmid 0 shared memory mappings. +- New test of a crash on `focus cmd', `focus prev' commands. +- Fix a minor test race of the hardware watchpoints after the fork call. +- Test crash on a sw watchpoint condition getting out of the scope. + +* Fri Mar 28 2008 Jan Kratochvil - 6.8-1 +- Upgrade to the latest upstream final release gdb-6.8. + +* Mon Mar 10 2008 Jan Kratochvil - 6.7.50.20080227-3 +- build-id warnings integrated more with rpm and the lists of the warnings got + replaced usually by a single-line `debuginfo-install' advice. + - FIXME: Testsuite needs an update for the new pre-prompt messages. +- Fix the `--with upstream' compilation - gstack/pstack are now omitted. + +* Tue Mar 4 2008 Jan Kratochvil - 6.7.50.20080227-2 +- Drop the unused `ChangeLog.RedHat' file stubs. +- New rpm option `--with upstream' to drop the Fedora patches for testing. +- Drop some no longer valid .spec file comments. +- Include the Fortran dynamic arrays entry for changelog of 6.7.50.20080227-1. + +* Mon Mar 3 2008 Jan Kratochvil - 6.7.50.20080227-1 +- Upgrade to the upstream gdb-6.8 prerelease. +- Cleanup the leftover `.orig' files during %%prep. +- Add expat-devel check by the configure script (for the other-arch builds). +- `--with testsuite' now also BuildRequires: fpc +- Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables. +- Update the printed GDB version string to be Fedora specific. +- Fix/implement the Fortran dynamic arrays support (BZ 377541). + +* Sat Mar 1 2008 Jan Kratochvil - 6.7.1-16 +- Run the full testsuite also in the `-fPIE -pie' mode. + +* Mon Feb 25 2008 Jan Kratochvil - 6.7.1-15 +- New --with parameters `testsuite' and `debug'. + - Testsuite is now run during the build only on explicit `--with testsuite'. +- Testsuite now possibly produces two outputs for the two GDB target arches. + +* Thu Feb 21 2008 Jan Kratochvil - 6.7.1-14 +- Rename `set debug build-id' as `set build-id-verbose', former level 1 moved + to level 2, default value is now 1, use `set build-id-verbose 0' now to + disable the missing separate debug filenames messages (BZ 432164). + +* Wed Feb 20 2008 Jan Kratochvil - 6.7.1-13 +- ia64 build fixes from Doug Chapman (BZ 428882). +- gdbserver separated into an extra package (BZ 405791). +- pstack obsoleted by included gstack (BZ 197020). +- Fix #include on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64. +- Drop the PowerPC simulator as no longer being compatible with Fedora binaries. + +* Thu Feb 7 2008 Jan Kratochvil - 6.7.1-12 +- build-id debug messages print now the library names unconditionally. + +* Thu Jan 24 2008 Jan Kratochvil - 6.7.1-11 +- Improve the text UI messages for the build-id debug files locating. + - Require now the rpm libraries. +- Fix false `(no debugging symbols found)' on `-readnever' runs. +- Extend the testcase `gdb.arch/powerpc-prologue.exp' for ppc64. + +* Sat Jan 12 2008 Jan Kratochvil - 6.7.1-10 +- Compilation fixup (-9 was never released). + +* Sat Jan 12 2008 Jan Kratochvil - 6.7.1-9 +- Fix also threaded inferiors for hardware watchpoints after the fork call. +- Test debugging statically linked threaded inferiors (BZ 239652). + - It requires recent glibc to work in this case properly. +- Testcase cleanup fixup of the gcore memory and time requirements of 6.7.1-8. + +* Thu Jan 10 2008 Jan Kratochvil - 6.7.1-8 +- Fix detaching from a threaded formerly stopped process with non-primary + thread currently active (general BZ 233852). + - Enable back again the testcases named `attachstop.exp' (no such exist now). + - Rename the testcase `gdb.threads/attachstop' to `gdb.threads/attachstop-mt'. +- Test ia64 memory leaks of the code using libunwind. +- Testcase delay increase (for BZ 247354). +- Test gcore memory and time requirements for large inferiors. + +* Mon Jan 7 2008 Jan Kratochvil - 6.7.1-7 +- Backport the gcc-4.3 compatibility -Werror fixes. +- Fix documentation on hardware watchpoints wrt multiple threads. +- Rename the patch file for BZ 235197 from its former name 234468. +- Fix the vendora testcase `attach-32.exp' affecting the other tests results. +- Support DW_TAG_interface_type the same way as DW_TAG_class_type (BZ 426600). + +* Mon Dec 10 2007 Jan Kratochvil - 6.7.1-6 +- Testsuite fixes for more stable/comparable results. + +* Sat Nov 24 2007 Jan Kratochvil - 6.7.1-5 +- Reduce the excessive gcc-* packages dependencies outside of mock/koji. + +* Fri Nov 16 2007 Jan Kratochvil - 6.7.1-4 +- Fix `errno' resolving across separate debuginfo files. +- Fix segfault on no file loaded, `set debug solib 1', `info sharedlibrary'. +- Extend the testsuite run for all the languages if %%{dist} is defined. +- Support gdb.fortran/ tests by substituting the g77 compiler by gfortran. + +* Sun Nov 4 2007 Jan Kratochvil - 6.7.1-3 +- Fix `errno' resolving on recent glibc with broken DW_AT_MIPS_linkage_name. +- Imported new test for 6.7 PPC hiding of call-volatile parameter register. + +* Sat Nov 3 2007 Jan Kratochvil - 6.7.1-2 +- Backport `Breakpoints at multiple locations' patch primarily for C++. + +* Thu Nov 1 2007 Jan Kratochvil - 6.7.1-1 +- Upgrade to GDB 6.7.1. Drop redundant patches, forward-port remaining ones. + +* Thu Nov 1 2007 Jan Kratochvil - 6.7-1 +- Upgrade to GDB 6.7. Drop redundant patches, forward-port remaining ones. +- Fix rereading of the main executable on its change. + +* Fri Oct 19 2007 Jan Kratochvil - 6.6-37 +- Fix hiding unexpected breakpoints on intentional step/next commands. +- Fix s390 compilation warning/failure due to a wrongly sized type-cast. + +* Sun Oct 14 2007 Jan Kratochvil - 6.6-36 +- Fix hardware watchpoints after inferior forks-off some process. + +* Sat Oct 13 2007 Jan Kratochvil - 6.6-35 +- Fix non-threaded watchpoints CTRL-C regression on `set follow child'. + +* Fri Oct 12 2007 Jan Kratochvil - 6.6-34 +- Fix gdbserver for threaded applications and recent glibc (BZ 328021). + +* Tue Oct 9 2007 Jan Kratochvil - 6.6-33 +- Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64). + +* Mon Oct 8 2007 Jan Kratochvil - 6.6-32 +- Set the breakpoints always to all the ctors/dtors variants (BZ 301701). +- Fix a TUI visual corruption due to the build-id warnings (BZ 320061). +- Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in'). + +* Fri Oct 5 2007 Jan Kratochvil - 6.6-31 +- Fix address changes of the ctors/dtors breakpoints w/multiple PCs (BZ 301701). +- Delete an info doc file on `rpmbuild -bp' later rebuilt during `rpmbuild -bc'. + +* Tue Sep 25 2007 Jan Kratochvil - 6.6-30 +- Fix re-setting of the ctors/dtors breakpoints with multiple PCs (BZ 301701). +- Avoid one useless user question in the core files locator (build-id). + +* Sun Sep 23 2007 Jan Kratochvil - 6.6-29 +- Fixed the kernel VDSO loading (`warning: no loadable sections found in ...'). +- Fix the testcase for pending signals (from BZ 233852). + +* Sat Sep 22 2007 Jan Kratochvil - 6.6-28 +- Support also the `$allocate' and `$delete' ctor/dtor variants (BZ 301701). +- Fix the build compatibility with texinfo >= 4.10. +- Fix the testcase for pending signals (from BZ 233852). + +* Sun Sep 16 2007 Jan Kratochvil - 6.6-27 +- Fix attaching to stopped processes and/or pending signals. + +* Tue Aug 28 2007 Jan Kratochvil - 6.6-26 +- New fast verification whether the .debug file matches its peer (build-id). +- New locating of the matching binaries from the pure core file (build-id). + +* Fri Aug 17 2007 Jan Kratochvil - 6.6-25 +- Fixed excessive RPATH (related to BZ 228891). + +* Wed Aug 8 2007 Jan Kratochvil - 6.6-24 +- Fixed compatibility with the Rawhide glibc open(2) syscall sanity checking. +- Update the core_dump_elf_headers=1 compatibility code to the upstream variant. + +* Mon Aug 6 2007 Jan Kratochvil - 6.6-23 +- Update PPC unwinding patches to their upstream variants (BZ 140532). + +* Wed Jul 25 2007 Jesse Keating - 6.6-22 +- Rebuild for RH #249435 + +* Mon Jul 23 2007 Jan Kratochvil - 6.6-21 +- Fixed compatibility with Rawhide kernel fs.binfmt_elf.core_dump_elf_headers=1. +- .spec file updates to mostly pass RPMLINT - Fedora merge review (BZ 225783). +- Fixed testcase of the exit of a thread group leader (of BZ 247354). +- Cleanup any leftover testsuite processes as it may stuck mock(1) builds. + +* Sun Jul 8 2007 Jan Kratochvil - 6.6-20 +- Do not hang on exit of a thread group leader (BZ 247354). +- New test for upstream fix of VDSO decoding while attaching to an i386 process. +- Fixed BZ # 232014 -> 232015. + +* Thu Jul 5 2007 Jan Kratochvil - 6.6-19 +- Link with libreadline provided by the operating system. + +* Tue Jun 26 2007 Jan Kratochvil - 6.6-18 +- Fix PPC software watchpoints active while stepping atomic instr. (BZ 237572). + +* Thu Jun 21 2007 Jan Kratochvil - 6.6-17 +- Support for stepping over PPC atomic instruction sequences (BZ 237572). +- `set scheduler-locking step' is no longer enforced but it is now default. + +* Wed Jun 20 2007 Jan Kratochvil - 6.6-16 +- Fix attaching a stopped process on expected + upstream kernels (BZ 233852). + - Fix attaching during a pending signal being delivered. + +* Thu Jun 7 2007 Jan Kratochvil - 6.6-15 +- Testcase update to cover PPC Power6/DFP instructions disassembly (BZ 230000). +- Disable some known timeouting/failing testcases to reduce the build time. +- Fix crash on missing filenames debug info (BZ 242155). + +* Sat Apr 28 2007 Jan Kratochvil - 6.6-14 +- Fixup for the PPC Power6/DFP instructions disassembly (BZ 230000). +- New testcase for the GCORE buffer overflow (for BZ 238285, formerly 235753). + +* Wed Apr 25 2007 Jan Kratochvil - 6.6-13 +- Fix `gcore' command for 32bit PPC inferiors on 64bit PPC hosts (BZ 232015). + +* Wed Apr 25 2007 Jan Kratochvil - 6.6-12 +- Enable PowerPC to print 128-bit long double variables (BZ 237872). +- New testcase for gcore of 32bit inferiors on 64bit hosts. + +* Tue Apr 24 2007 Jan Kratochvil - 6.6-11 +- Package review, analysed by Ralf Corsepius (BZ 225783). + - Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783). + - Fix debugging GDB itself - the compiled in source files paths (BZ 225783). + - Fix harmless GCORE stack buffer overflow, by _FORTIFY_SOURCE=2 (BZ 238285). + - Fix XML support - the build was missing `expat-devel'. + - Updated the `info' files handling by the spec file. + - Building now with the standard Fedora code protections - _FORTIFY_SOURCE=2. + - Use multiple CPUs for the build (%%{?_smp_mflags}). + - Separate testsuite run to its %%check section. + - Fix (remove) non-ASCII spec file characters. + - Remove system tools versions dumping - already present in mock build logs. + +* Sun Apr 22 2007 Jan Kratochvil - 6.6-10 +- Notify user of a child forked process being detached (BZ 235197). + +* Sun Apr 22 2007 Jan Kratochvil - 6.6-9 +- Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). +- Fix testcase for watchpoints in threads (for BZ 237096). +- BuildRequires now `libunwind-devel' instead of the former `libunwind'. +- Use the runtime libunwind .so.7, it requires now >= 0.99-0.1.frysk20070405cvs. + +* Sat Mar 24 2007 Jan Kratochvil - 6.6-8 +- Use definition of an empty structure as it is not an opaque type (BZ 233716). +- Fixed the gdb.base/attachstop.exp testcase false 2 FAILs. + +* Thu Mar 15 2007 Jan Kratochvil - 6.6-7 +- Suggest SELinux permissions problem; no assertion failure anymore (BZ 232371). + +* Wed Mar 14 2007 Jan Kratochvil - 6.6-6 +- Fix occasional dwarf2_read_address: Corrupted DWARF expression (BZ 232353). + +* Mon Mar 12 2007 Jan Kratochvil - 6.6-5 +- Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) + +* Sun Feb 25 2007 Jan Kratochvil - 6.6-4 +- Backport + testcase for PPC Power6/DFP instructions disassembly (BZ 230000). + +* Mon Feb 5 2007 Jan Kratochvil - 6.6-3 +- Fix a race during attaching to dying threads; backport (BZ 209445). +- Testcase of unwinding has now marked its unsolvable cases (for BZ 140532). + +* Fri Jan 26 2007 Jan Kratochvil - 6.6-2 +- Backported post gdb-6.6 release PPC `show endian' fixup. +- Fix displaying of numeric char arrays as strings (BZ 224128). +- Simplified patches by merging upstream accepted ones into a single file. + +* Sat Jan 20 2007 Jan Kratochvil - 6.6-1 +- Upgrade to GDB 6.6. Drop redundant patches, forward-port remaining ones. +- Backported post gdb-6.6 release ia64 unwinding fixups. +- Testcase for exec() from threaded program (BZ 202689). + +* Mon Jan 15 2007 Jan Kratochvil - 6.5-27 +- Fix the testsuite results broken in 6.5-26, stop invalid testsuite runs. + +* Sat Jan 13 2007 Jan Kratochvil - 6.5-26 +- Fix unwinding of non-debug (.eh_frame) PPC code, Andreas Schwab (BZ 140532). +- Fix unwinding of debug (.debug_frame) PPC code, workaround GCC (BZ 140532). +- Fix missing testsuite .log output of testcases using get_compiler_info(). + +* Fri Jan 12 2007 Jan Kratochvil - 6.5-25 +- Fix unwinding of non-CFI (w/o debuginfo) PPC code by recent GCC (BZ 140532). + +* Thu Jan 11 2007 Jan Kratochvil - 6.5-24 +- Backport readline history for input mode commands like `command' (BZ 215816). + +* Tue Jan 9 2007 Jan Kratochvil - 6.5-23 +- Find symbols properly at their original (included) file (BZ 109921). +- Remove the stuck mock(1) builds disfunctional workaround (-> mock BZ 221351). + +* Sat Dec 30 2006 Jan Kratochvil - 6.5-22 +- Fix unwinding crash on older gcj(1) code (extended CFI support) (BZ 165025). +- Include testcase for the readline history of input mode commands (BZ 215816). + +* Sat Dec 23 2006 Jan Kratochvil - 6.5-21 +- Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379). +- Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). + +* Tue Dec 19 2006 Jan Kratochvil - 6.5-20 +- Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711). +- Testcase for readline segfault on excessively long hand-typed lines. + +* Tue Dec 12 2006 Jan Kratochvil - 6.5-19 +- Fix attachment also to a threaded stopped process (BZ 219118). +- Cleanup any leftover testsuite processes as it may stuck mock(1) builds. + +* Sat Nov 25 2006 Jan Kratochvil - 6.5-18 +- Fix readline history for input mode commands like `command' (BZ 215816). + +* Thu Nov 16 2006 Jan Kratochvil - 6.5-17 +- Bugfix testcase typo of gdb-6.5-16. + +* Thu Nov 16 2006 Jan Kratochvil - 6.5-16 +- Provide testcase for accessing the last address space byte. + +* Thu Nov 9 2006 Jan Kratochvil - 6.5-15 +- Fix readline segfault on excessively long hand-typed lines. + +* Thu Nov 2 2006 Jan Kratochvil - 6.5-14 +- Fix "??" resolving of symbols from (non-prelinked) debuginfo packages. +- Fix "??" resolving of symbols from overlapping functions (nanosleep(3)). +- Also disable testcase "checkpoint.exp" for a possible kernel Bug 207002. +- Provided (disabled during build) threading testsuite from BEA. + +* Sat Oct 14 2006 Jan Kratochvil - 6.5-13 +- Fix deadlock accessing last address space byte; for corrupted backtraces. + +* Sun Oct 8 2006 Jan Kratochvil - 6.5-12 +- Disabled IPv6 until its user visible syntax gets stable upstream. + +* Sun Oct 1 2006 Jan Kratochvil - 6.5-11 +- No longer disassemble invalid i386 opcodes of movQ/movA (BZ 172034). +- Simplify the IPv6 patch for gdbserver (BZ 198365). +- Suggest fixing your target architecture for gdbserver(1) (BZ 190810). +- Fix dereferencing registers for 32bit inferiors on 64bit hosts (BZ 181390). +- Fix `gcore' command for 32bit inferiors on 64bit hosts. + +* Wed Sep 27 2006 Jan Kratochvil - 6.5-10 +- Support IPv6 for gdbserver (BZ 198365). +- Temporarily disable testcase "chng-syms.exp" for a possible kernel Bug 207002. + +* Thu Sep 21 2006 Jan Kratochvil - 6.5-9 +- Fix crash on C++ symbol failing to be demangled (BZ 206813). +- Fix attach to stopped process, supersede `gdb-6.3-attach-stop-20051011.patch'. +- Fix TLS symbols resolving for objects with separate .debug file (-debuginfo). +- Fix TLS symbols resolving for shared libraries with a relative pathname. +- Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). + +* Mon Sep 11 2006 Jan Kratochvil - 6.5-8 +- Fix gdb printf command argument using "%%p" (BZ 205551). + +* Mon Sep 4 2006 Alexandre Oliva - 6.5-7 +- Fix bug in patch for CVE-2006-4146. (BZ 203873, BZ 203880) + +* Thu Aug 24 2006 Alexandre Oliva - 6.5-6 +- Avoid overflows and underflows in dwarf expression computation stack. +(BZ 203873) + +* Thu Aug 24 2006 Alexandre Oliva - 6.5-5 +- Backport support for i386 nop memory instructions. +- Fix debuginfo addresses resolving for --emit-relocs Linux kernels +(BZ 203661, from Jan Kratochvil, like the remaining changes). +- Bugfix segv on the source display by ^X 1 (fixes Patch130, BZ +200048). +- Do not step into the PPC solib trampolines (BZ 200533). +- Fix exec() from threaded program, partial CVS backport (BZ 182116). +- Fix occasional failure to load shared libraries (BZ 146810). +- Bugfix object names completion (fixes Patch116, BZ 193763). +- Avoid crash of 'info threads' if stale threads exist (BZ 195429). +- Handle corrupted or missing location list information (BZ 196439). + +* Thu Jul 13 2006 Alexandre Oliva - 6.5-3 +- Add missing definition of multilib_64_archs for glibc-devel buildreqs. +- Backport support for .gnu.hash sections. + +* Wed Jul 12 2006 Alexandre Oliva - 6.5-2 +- BuildReq sharutils, prelink and, on multilib systems, 32-bit glibc-devel. +- Drop obsolete attach-stop patch. +- Fix testcases in threaded-watchpoints2 and step-thread-exit patches. +- Re-enable attach-pie.exp, asm-source.exp and sigstep.exp tests. + +* Tue Jul 11 2006 Alexandre Oliva - 6.5-1 +- Upgrade to GDB 6.5. Drop redundant patches, forward-port remaining +ones. Re-enable ada and objc testsuites. + +* Thu Jun 15 2006 Alexandre Oliva - 6.3.0.0-1.132 +- Require flex and bison at build time. +- Additional patch for BZ 175083, to cope with waitpid setting status +even when returning zero. + +* Wed May 31 2006 Alexandre Oliva - 6.3.0.0-1.131 +- Require gettext at build time. (BZ193366) + +* Sat May 27 2006 Alexandre Oliva - 6.3.0.0-1.130 +- Rewrite patch for BZ 175270, BZ 175083 so as to catch the exception +earlier. +- Remove too-fragile testcases from patches for CFA value and "S" +augmentation. + +* Wed May 17 2006 Alexandre Oliva - 6.3.0.0-1.129 +- Add not-automatically-generated file to fopen64 patch (BZ 191948). + +* Fri Apr 14 2006 Alexandre Oliva - 6.3.0.0-1.128 +- Avoid race conditions caused by exceptions messing with signal masks. +(BZ 175270, BZ 175083, maybe BZ 172938). +- Hardcode /bin and /usr/bin paths into gstack (BZ 179829, BZ 190548). +- Build in a subdir of the source tree instead of in a sibling directory. +- Switch to versioning scheme that uses the same base revision number +for all OSes, and uses a suffix to tell the builds apart and ensure +upgradability. + +* Thu Apr 13 2006 Stepan Kasal - 6.3.0.0-1.127 +- Bump up release number. + +* Thu Apr 13 2006 Stepan Kasal - 6.3.0.0-1.123 +- Use fopen64 where available. Fixes BZ 178796, BZ 190547. +- Use bigger numbers than int. Fixes BZ 171783, BZ 179096. + +* Wed Mar 8 2006 Alexandre Oliva - 6.3.0.0-1.122 +- Bump up release number. + +* Wed Mar 8 2006 Alexandre Oliva - 6.3.0.0-1.119 +- Fix regression in PIE debugging (BZ 133944) (re?)introduced by the +prelink fix (BZ 175075, BZ 190545). Improve testcase for the prelink +fix. +- Revert dwarf2 frame identifier change. + +* Tue Mar 7 2006 Alexandre Oliva - 6.3.0.0-1.118 +- Bump up release number. + +* Tue Mar 7 2006 Alexandre Oliva - 6.3.0.0-1.115 +- Change dwarf2 frame identifiers to use the actual PC instead of the +function's entry point. +- Fix FSF and GDB contact addresses in new testcases. +- Do not try to compile x86_64-only CFA testcase on 32-bit x86. +- Change prelink test to issue untested instead of warning message if +system libraries are not prelinked. + +* Fri Mar 3 2006 Alexandre Oliva - 6.3.0.0-1.114 +- Bump up release number. + +* Fri Mar 3 2006 Alexandre Oliva - 6.3.0.0-1.111 +- Add support for "S" augmentation for signal stack frames. +- Add support for CFA value expressions and encodings. +- Various improvements to the prelink test. + +* Thu Feb 23 2006 Alexandre Oliva - 6.3.0.0-1.110 +- Bump up release number. + +* Thu Feb 23 2006 Alexandre Oliva - 6.3.0.0-1.107 +- Enable gdb to debug core files and executables with mismatched +prelink base addresses. Fixes BZ 175075, BZ 190545. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.106 +- Bump up release number. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.103 +- Adjust type-punning patch to include fix not needed upstream. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.102 +- Bump up release number. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.99 +- Use type-punning warning fixes as accepted upstream. + +* Fri Feb 10 2006 Jesse Keating - 6.3.0.0-1.98.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 6.3.0.0-1.98.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Mon Jan 16 2006 Alexandre Oliva - 6.3.0.0-1.98 +- Bump up release number. + +* Mon Dec 19 2005 Alexandre Oliva - 6.3.0.0-1.94 +- Fix type-punning warnings issued by GCC 4.1. + +* Fri Dec 16 2005 Jesse Keating +- rebuilt for new gcj + +* Thu Dec 01 2005 Jeff Johnston - 6.3.0.0-1.93 +- Bump up release number. + +* Thu Dec 01 2005 Jeff Johnston - 6.3.0.0-1.90 +- Add option to allow backtracing past zero pc value. +- Bugzilla 170275 + +* Tue Nov 15 2005 Jeff Johnston - 6.3.0.0-1.89 +- Bump up release number. + +* Tue Nov 15 2005 Jeff Johnston - 6.3.0.0-1.86 +- Fix ia64 user-specified SIGILL handling error. +- Bugzilla 165038. + +* Tue Oct 18 2005 Jeff Johnston - 6.3.0.0-1.85 +- Bump up release number. + +* Tue Oct 18 2005 Jeff Johnston - 6.3.0.0-1.82 +- Modify attach patch to add missing fclose. +- Bugzilla 166712 + +* Tue Oct 11 2005 Jeff Johnston - 6.3.0.0-1.81 +- Bump up release number. + +* Tue Oct 11 2005 Jeff Johnston - 6.3.0.0-1.78 +- Support gdb attaching to a stopped process. + +* Thu Sep 29 2005 Jeff Johnston - 6.3.0.0-1.77 +- Bump up release number. + +* Thu Sep 29 2005 Jeff Johnston - 6.3.0.0-1.74 +- Fix up DSO read logic when process is attached. + +* Mon Sep 26 2005 Jeff Johnston - 6.3.0.0-1.73 +- Bump up release number. + +* Mon Sep 26 2005 Jeff Johnston - 6.3.0.0-1.70 +- Fix frame pointer calculation for ia64 sigtramp frame. + +* Thu Sep 22 2005 Jeff Johnston - 6.3.0.0-1.69 +- Bump up release number. + +* Thu Sep 22 2005 Jeff Johnston - 6.3.0.0-1.66 +- Remove extraneous xfree. + +* Wed Sep 07 2005 Jeff Johnston - 6.3.0.0-1.65 +- Bump up release number. + +* Wed Sep 07 2005 Jeff Johnston - 6.3.0.0-1.62 +- Readd readnever option + +* Wed Jul 27 2005 Jeff Johnston - 6.3.0.0-1.61 +- Bump up release number. + +* Tue Jul 26 2005 Jeff Johnston - 6.3.0.0-1.57 +- Bump up release number. + +* Tue Jul 26 2005 Jeff Johnston - 6.3.0.0-1.54 +- Add testcase to verify printing of inherited members +- Bugzilla 146835 + +* Mon Jul 25 2005 Jeff Johnston - 6.3.0.0-1.53 +- Bump up release number. + +* Mon Jul 25 2005 Jeff Johnston - 6.3.0.0-1.50 +- Fix bug with info frame and cursor address on ia64. +- Add testcase to verify pseudo-registers calculated for ia64 sigtramp. +- Bugzilla 160339 + +* Fri Jul 22 2005 Jeff Johnston - 6.3.0.0-1.49 +- Bump up release number. + +* Fri Jul 22 2005 Jeff Johnston - 6.3.0.0-1.46 +- Fix attaching to 32-bit processes on 64-bit systems. +- Bugzilla 160254 + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.45 +- Bump up release number. + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.42 +- Add work-around to make ia64 gcore work faster. +- Bugzilla 147436 + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.41 +- Bump up release number. + +* Mon Jul 11 2005 Jeff Johnston - 6.3.0.0-1.38 +- Fix backtracing across sigaltstack for ia64 +- Bugzilla 151741 + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.37 +- Bump up release number. + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.35 +- Build pseudo-registers properly for sigtramp frame. +- Bugzilla 160339 + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.34 +- Bump up release number. + +* Thu Jul 07 2005 Jeff Johnston - 6.3.0.0-1.31 +- Modify security errata to include additional bfd robustness updates +- Bugzilla 158680 + +* Fri Jun 10 2005 Jeff Johnston - 6.3.0.0-1.30 +- Bump up release number. + +* Fri Jun 10 2005 Jeff Johnston - 6.3.0.0-1.28 +- Security errata for bfd and .gdbinit file usage +- Bugzilla 158680 + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.24 +- Bump up release number. + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.23 +- Bump up release number. + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.22 +- Specify SA_RESTART for linux-nat.c handlers and use my_waitpid + which handles EINTR. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.21 +- Bump up release number. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.20 +- Bump up release number. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.19 +- Fix for partial die in cache error +- Bugzilla 137904 + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.18 +- Bump up release number. + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.17 +- Bump up release number. + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.16 +- Update ia64 sigtramp support to use libunwind and fix top-level + rse register reads to also use libunwind. +- Bugzilla 151741 + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.15 +- Bump up release number. + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.14 +- Bump up release number. + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.13 +- Do not issue warning message for gcore under ia64 +- Bugzilla 146416 + +* Mon Apr 11 2005 Andrew Cagney - 6.3.0.0-1.12 +- Update gstack patch, handle systems that lack /proc//tasks. + +* Fri Apr 8 2005 Andrew Cagney - 6.3.0.0-1.11 +- Replace patch warning about DW_OP_piece with a patch that implements + the DW_OP_piece read path. + +* Sat Apr 2 2005 Andrew Cagney - 6.3.0.0-1.10 +- Print a warning when the separate debug info's CRC doen't match; + test. + +* Wed Mar 30 2005 Jeff Johnston - 6.3.0.0-1.9 +- Bump up release number. + +* Wed Mar 30 2005 Jeff Johnston - 6.3.0.0-1.7 +- Add proper vsyscall page support for ia64. + +* Thu Mar 24 2005 Jeff Johnston - 6.3.0.0-1.6 +- Bump up release number. + +* Thu Mar 24 2005 Jeff Johnston - 6.3.0.0-1.4 +- Fix printing of inherited members of C++ classes. +- Fix for Bugzilla 146835. + +* Tue Mar 22 2005 Jeff Johnston - 6.3.0.0-1.3 +- Bump up release number. + +* Thu Mar 17 2005 Jeff Johnston - 6.3.0.0-1.1 +- Remove warnings that cause errors when compiled with gcc4 and -Werror. + +* Wed Mar 16 2005 Elliot Lee +- rebuilt + +* Fri Mar 04 2005 Jeff Johnston - 6.3.0.0-0.37 +- Bump up release number. + +* Thu Mar 03 2005 Jeff Johnston - 6.3.0.0-0.35 +- Add follow-fork fix from mainline sources. + +* Thu Mar 03 2005 Jeff Johnston - 6.3.0.0-0.34 +- Bump up release number. + +* Mon Feb 28 2005 Jeff Johnston - 6.3.0.0-0.32 +- Modify debug register handling for x86, x86-64 to be thread-specific. +- Modify threaded watchpoint code for x86, x86-64 to properly insert + and remove watchpoints on all threads. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.31 +- Bump version number. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.30 +- Bump version number. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.29 +- Modify gdb-6.3-dwattype0-20050201.patch to check for a zero address + and not zero unsnd. Fix BE 32- vs 64-bit problem. + +* Mon Feb 21 2005 Andrew Cagney - 6.3.0.0-0.28 +- Back port patch adding symfile-mem.o to all GNU/Linux builds. + Fix BZ 146087. + +* Wed Feb 16 2005 Jeff Johnston - 6.3.0.0-0.27 +- Bump up release number. + +* Wed Feb 16 2005 Jeff Johnston - 6.3.0.0-0.26 +- Fix unload.exp testcase. + +* Mon Feb 14 2005 Jeff Johnston - 6.3.0.0-0.25 +- Bump up release number. + +* Mon Feb 14 2005 Jeff Johnston - 6.3.0.0-0.24 +- Fix gdb to always grab the terminal before a readline call. +- Bugzilla 147880 + +* Fri Feb 11 2005 Jeff Johnston - 6.3.0.0-0.23 +- Bump up release number. + +* Fri Feb 11 2005 Jeff Johnston - 6.3.0.0-0.21 +- Fix gdb to handle stepping over the end of an exiting thread. +- Bugzilla 146848 + +* Thu Feb 10 2005 Jeff Johnston - 6.3.0.0-0.20 +- Bump up release number. + +* Tue Feb 08 2005 Jeff Johnston - 6.3.0.0-0.18 +- Modify previous gcore patch to not use linux_proc_xfer_memory even + for main thread. + +* Mon Feb 07 2005 Jeff Johnston - 6.3.0.0-0.17 +- Modify previous gcore patch to only apply to ia64. + +* Fri Feb 04 2005 Jeff Johnston - 6.3.0.0-0.16 +- Fix gcore to work properly for threaded applications +- Bugzilla 145309, 145092 + +* Fri Feb 04 2005 Jeff Johnston - 6.3.0.0-0.15 +- Tolerate DW_AT_type referencing <0> and instead of generating an + error, treat as unknown type. +- Bugzilla 144852. + +* Thu Feb 3 2005 Andrew Cagney - 6.3.0.0-0.14 +- Separate out test patches. + +* Thu Jan 27 2005 Jeff Johnston - 6.3.0.0-0.13 +- Fix to allow ia64 gdb to backtrace from syscalls in a corefile. +- Bugzilla 145092. + +* Wed Jan 26 2005 Jeff Johnston - 6.3.0.0-0.12 +- Fix to support examining files even when the executable moves +- Bugzilla 142122 + +* Wed Jan 26 2005 Andrew Cagney - 6.3.0.0-0.11 +- gdb-6.3-ppcdotsyms-20050126.patch: Backport BFD changes for reading + synthetic symbols. Rewrite code reading elf minimal symbols so that + it includes synthetics. + +* Fri Jan 21 2005 Jeff Johnston - 6.3.0.0-0.10 +- Fix to prevent resetting unwind kernel table size to invalid value + when debugging a core file +- Bugzilla 145309 + +* Fri Jan 21 2005 Andrew Cagney - 6.3.0.0-0.9 +- When single stepping handle both back-to-back and nested signals. +- Disable .symbol patch, results in BFD errors. + +* Fri Jan 21 2005 Jeff Johnston - 6.3.0.0-0.8 +- Support listing both in-charge and not-in-charge dtors when + just the dtor name is given. +- Add new test case for newly added ctor/dtor functionality. + +* Thu Jan 20 2005 Jeff Johnston - 6.3.0.0-0.7 +- Fix to allow breaking by line in both the in-charge and + not-in-charge ctor/dtor. +- Bugzilla 117826 + +* Thu Jan 20 2005 Andrew Cagney - 6.3.0.0-0.6 +- Rebuild. + +* Thu Jan 20 2005 Andrew Cagney - 6.3.0.0-0.5 +- Use bfd_get_synthetic_symtab to read in any synthetic symbols + such as 64-bit PPC's ".symbol"s. + +* Tue Jan 18 2005 Jeff Johnston - 6.3.0.0-0.4 +- Modify non-threaded watchpoint patch to use new observer. + +* Mon Jan 17 2005 Jeff Johnston - 6.3.0.0-0.3 +- Fix for non-threaded watchpoints. + +* Mon Jan 17 2005 Andrew Cagney - 6.3.0.0-0.2 +- Enable PPC CFI, remove merged ppc patches. + +* Wed Jan 12 2005 Elena Zannoni - 6.3.0.0-0.1 +- commit co-authors Andrew Cagney and + Jeff Johnston . +- Various fixes to complete the import and merge. + +* Wed Dec 01 2004 Andrew Cagney - 6.3.0.0 +- Import GDB 6.3, get building, add all patches. + +* Tue Nov 30 2004 Jeff Johnston - 1.200400607.63 +- When removing breakpoints, continue removing breakpoints even if an + error occurs on the list. + +* Sun Nov 28 2004 Andrew Cagney - 1.200400607.62 +- Bump version for RHEL4 build. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.61 +- For PPC-64, fix search for a symbol (wasn't specifying the section). + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.60 +- For PPC-64, do not set malloc name to ".malloc"; no longer needed. +- For all, only define kfail when not already defined. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.59 +- Bump version. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.58 +- Add rs6000 reggroups; fixes problem of PS register being trashed + causing mysterious branch breakpoints. + +* Tue Nov 23 2004 Andrew Cagney - 1.200400607.57 +- Backport i386 prolog parser - better backtraces out of semop(). +- Add option --readnever to suppress the reading of symbolic debug + information. +- Add script gstack.sh, installed as gstack. + Bugzilla 136584, 137121 +- Add missing files gdb.pie/attach2.c, gdb.pie/break1.c and + gdb.pie/Makefile.in along with testsuite/configure stuff for pie. + +* Tue Nov 23 2004 Andrew Cagney - 1.200400607.57 +- Backport i386 prolog parser - better backtraces out of semop(). +- Add option --readnever to suppress the reading of symbolic debug + information. +- Add script gstack.sh, installed as gstack. + Bugzilla 136584, 137121 + +* Mon Nov 22 2004 Jeff Johnston - 1.200400607.56 +- Bump up release number. + +* Mon Nov 22 2004 Jeff Johnston - 1.200400607.55 +- Multiple ia64 backtrace fixes. Bugzilla 125157 + +* Thu Nov 11 2004 Elena Zannoni - 1.200400607.54 +- Bump up release number + +* Thu Nov 11 2004 Elena Zannoni - 1.200400607.51 +- Modify configure line to not use absolute paths. This was + creating problems with makeinfo/texinfo. +- Get rid of makeinfo hack. +Bugzilla 135633 + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.50 +- Bump up release number + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.49 +- Bump up release number + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.48 +- Expose $base, $allocate constructors and $delete, $base destructors + for breakpoints. + +* Tue Nov 09 2004 Andrew Cagney - 1.200400607.47 +- Enable PPC CFI. + +* Mon Nov 08 2004 Jeff Johnston - 1.200400607.46 +- Bump up release number + +* Mon Nov 08 2004 Jeff Johnston - 1.200400607.45 +- Bump up release number + +* Fri Nov 05 2004 Jeff Johnston - 1.200400607.44 +- Allow macros to continue past a backtrace error + +* Tue Oct 26 2004 Andrew Cagney - 1.200400607.43 +- Hack around broken PT_FPSCR defined in headers. +- Import latest s390 fixes. +- Disable sigstep.exp - s390 has problems. +- Use PC's symtab when looking for a symbol. +- Work around DW_OP_piece. + +* Fri Oct 22 2004 Andrew Cagney - 1.200400607.42 +- For 64-bit PPC, convert _dl_debug_state descriptor into a code address. +- Fix --ignore option. + +* Sun Oct 10 2004 Andrew Cagney - 1.200400607.40 +- Disable attach-pie.exp test, hangs on amd64 without auxv. +- Move pie tests to pie. + +* Sun Oct 10 2004 Andrew Cagney - 1.200400607.39 +- Fix comment bug in sigstep.exp. + +* Thu Oct 07 2004 Jeff Johnston - 1.200400607.38 +- Do not invalidate cached thread info when resuming threads. +- Bump up release number. + +* Fri Oct 01 2004 Jeff Johnston - 1.200400607.35 +- Fix S/390 watchpoint support to work better under threading. + +* Fri Oct 01 2004 Jeff Johnston - 1.200400607.34 +- Fix thread_db_get_lwp to handle 2nd format ptids. + +* Mon Sep 27 2004 Andrew Cagney - 1.200400607.33 +- Don't unwind past a zero PC (when normal frames). + +* Mon Sep 27 2004 Jeff Johnston - 1.200400607.32 +- Add threaded watchpoint support for x86, x86-64, and ia64. + +* Mon Sep 27 2004 Andrew Cagney - 1.200400607.31 +- Instead of deleting bigcore.exp, use runtest --ignore. + +* Thu Sep 23 2004 Andrew Cagney - 1.200400607.30 +- Merge in mainline testsuite up to 2004-09-23, pick up sig*.exp tests. + Merge in mainline infrun.c, pick up all infrun.c fixes. + Generate bigcore's corefile from the running inferior. + Limit bigcore's corefile to max file-size. + +* Thu Sep 02 2004 Jeff Johnston - 1.200400607.29 +- Fix low-level lin-lwp code to wait specifically for any stepping + LWP (bugzilla 130896) + +* Tue Aug 31 2004 Jeff Johnston - 1.200400607.28 +- Add test case for bugzilla 128618 fix. + +* Mon Aug 30 2004 Jeff Johnston - 1.200400607.27 +- Add support for breakpoints in manually loaded/unloaded shared libs. + (bugzilla 128618) + +* Mon Aug 30 2004 Jeff Johnston - 1.200400607.26 +- Add java inferior call support. + +* Mon Aug 30 2004 Andrew Cagney - 1.200400607.25 +- Convert "main" the function descriptor, into an address. + +* Mon Aug 30 2004 Andrew Cagney - 1.200400607.24 +- Fix single-stepping when a signal is pending, was exiting program. + -- needs kernel fix so that ptrace(PT_STEP,SIG) doesn't do a PT_CONT. + -- sigstep.exp tests pass with this fix applied. + +* Mon Aug 30 2004 Elena Zannoni - 1.200400607.23 +- Delete some part of gdb-6.1post-test-rh.patch, to avoid confusing + gdb when testing itself, and loading separate debug info. + +* Fri Aug 13 2004 Jeff Johnston - 1.200400607.22 +- Check in gdb mainline fix for applications calling clone directly. + +* Tue Aug 10 2004 Jeff Johnston - 1.200400607.21 +- Alter libunwind frame code to allow using libunwind 0.97 and up. + +* Tue Aug 03 2004 Jeff Johnston - 1.200400607.20 +- Fix the ia64 libunwind test to match current output. + +* Fri Jul 30 2004 Elena Zannoni - 1.200400607.19 +- Fix the tests where gdb debugs itself, as to not copy + the executable to xgdb. + +* Mon Jul 26 2004 Elena Zannoni - 1.200400607.18 +- Add Pie patches back in. + +* Fri Jul 16 2004 Andrew Cagney - 1.200400607.17 +- Fix stepping over a no-debug shared-library function. +- Fix patch vsyscall patch name. + +* Thu Jul 8 2004 Jeff Johnston - 1.200400607.16 +- Update thread code with fix from gdb HEAD + +* Wed Jul 7 2004 Andrew Cagney - 1.200400607.15 +- disable vsyscall +- import Bob's crasher fix +- disable bigcore.exp + +* Mon Jul 5 2004 Andrew Cagney - 1.200400607.14 +- Make large corefiles work on systems that require O_LARGEFILE. + +* Tue Jun 29 2004 Elena Zannoni - 1.200400607.13 +- Fix BuildRequires for libunwind on ia64. + +* Mon Jun 28 2004 Andrew Cagney - 1.200400607.12 +- Import wild frame ID patch. Stops GDB incorrectly matching invalid + frame IDs. +- Disable bigcore on ia64 and amd64. + +* Fri Jun 25 2004 Andrew Cagney - 1.200400607.11 +- Fix testsuite to kill attach process (from corrinna/mainline). +- Fix build problems with vsyscall patch. + +* Fri Jun 25 2004 Andrew Cagney - 1.200400607.10 +- Fix annotate test messages. +- Recognize VSYSCALL pages. + +* Thu Jun 24 2004 Jeff Johnston - 1.200400607.9 +- Fix ia64 watchpoint support. + +* Wed Jun 23 2004 Andrew Cagney - 1.200400607.8 +- Do not xfail signals on i387, convert KFAIL to FAIL and not XFAIL. + +* Wed Jun 23 2004 Andrew Cagney - 1.200400607.7 +- Fix to ppc64 unwinder - handle glibcs function within syscall + function hack. +- Update sigbpt.exp, ena-dis-br.exp observer.exp signull.exp, + step-test.exp and sizeof.exp, so that test names are architecture + clean. +- Disable bigcore.exp on PowerPC 64. + +* Tue Jun 22 2004 Andrew Cagney - 1.200400607.6 +- Merge in mainline testsuite changes up to 2004-06-21. +- Re-implement 32 and 64-bit PPC signal trampolines. +- Check i386 and amd64 signal trampolines before dwarf2. +- Allow tramp-frame when there is a symbol. +- Test interaction between single-step, breakpoint and signal. +- ABI: Fix PPC64 function parameters, sizeof long-double, and enum + return values. + +* Mon Jun 21 2004 Elena Zannoni - 1.200400607.5 +- Fix sed line for gz info files. + +* Mon Jun 21 2004 Andrew Cagney - 1.200400607.4 +- Tar/uuencode both the .sum and .log test results. + +* Tue Jun 15 2004 Elena Zannoni - 0.200400607.3 +- Remove installation of mmalloc, and its info files. +- Add hack to deal with differring info files generated by makeinfo. +- Restore release number convention. + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Thu Jun 10 2004 Elena Zannoni - 0.200400607.2 +- Fix Requires and BuildRequires for libunwind dependencies. +- Add patch to silence gcc3.4 warnings. + +* Wed Jun 09 2004 Elena Zannoni - 0.200400607.1 +- New import: revamp everything. Remove all patches for now. +- Update the Requires and BuildRequires sections. +- Removed stupid Ada testcases (there is no ada support in gdb yet). + +* Mon May 10 2004 Elena Zannoni - 0.20040223.20 +- Disable PIE again. +- obsolete gdb64 only if on ppc64. + +* Mon May 03 2004 Jeff Johnston - 0.20040223.19 +- Add -u parameter to build ChangeLog patch. + +* Mon May 03 2004 Jeff Johnston - 0.20040223.18 +- Update thread fix made for .6 release to FSF version. + +* Thu Apr 22 2004 Elena Zannoni - 0.20040223.17 +- Disable PIE again. + +* Thu Apr 22 2004 Jeff Johnston - 0.20040223.16 +- Bump version number. + +* Wed Apr 21 2004 Jeff Johnston - 0.20040223.15 +- fix ia64 info frame command +- also fix ia64 tdep file for which elf header file to include + +* Tue Mar 30 2004 Elena Zannoni - 0.20040223.14 +- re-enable pie. + +* Tue Mar 30 2004 Elena Zannoni - 0.20040223.13 +- Fix testsuite glitches. + +* Wed Mar 24 2004 Elena Zannoni - 0.20040223.12 +- Fix typo. + +* Wed Mar 24 2004 Elena Zannoni - 0.20040223.11 +- Make gdb compile w/o warnings with gcc-3.4. +- Reenable PIE support code. + +* Tue Mar 23 2004 Elena Zannoni - 0.20040223.10 +- Bump version number + +* Tue Mar 23 2004 Elena Zannoni - 0.20040223.9 +- temporarily disable PIE support. +- Add section to obsolete gdb64 package. + +* Sun Mar 21 2004 Elena Zannoni - 0.20040223.8 +- Add support for debugging of PIE executables. + +* Tue Mar 09 2004 Elena Zannoni - 0.20040223.7 +- Bump version number. + +* Mon Mar 08 2004 Jeff Johnston - 0.20040223.6 +- Fix thread support to recognize new threads even when they reuse + tids of expired threads. Also ensure that terminal is held by gdb + while determining if a thread-create event has occurred. + +* Mon Mar 08 2004 Andrew Cagney - 0.20040223.5 +- Sync with 6.1 branch; eliminate all amd64 patches; + add more robust 32x64 PPC64 patches. + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Tue Mar 2 2004 Andrew Cagney - 0.20040223.4 +- 32x64 fixes that work with threads, replaced old + non-thread 32x64 patch, add nat patch. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.3 +- Add patch for x86_64 in 32 bit mode. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.2 +- Remove ppc64 hacks. +- Refresh some patches. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.1 +- Import new gdb snapshot from mainline FSF. +- Update patch list. + +* Tue Feb 17 2004 Jeff Johnston - 1.20031117.8 +- Switch ia64-tdep.c to use new abi used by libunwind-0.95 and up. +- Fix gate area specification for ia64-linux-tdep.c. +- Fix long double support for ia64. + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Thu Jan 08 2004 Elena Zannoni - 0.20031117.7 +- Add fixes for ppc32 support on ppc64 platform, from Andrew Cagney. + +* Tue Jan 06 2004 Elena Zannoni - 0.20031117.6 +- Add patch to have unique binary names in the testsuite. +- Disable s390/s390x pthread.exp test (FIXME) +- Don't install any info files for the ppc platform. Let's take them + from the ppc64 one (or we get install conflicts). +- Remove generated info files from the source tree. They are generated + as part of the FSF snapshot process. + +* Mon Nov 24 2003 Elena Zannoni - 0.20031117.5 +- Add patches from old rpm for i386 support on x86_64. +- Add build dependency on libunwind for ia64. + +* Fri Nov 21 2003 Jeremy Katz - 0.20031117.4 +- more rpm tricks to get the gdb64 package happier + +* Thu Nov 20 2003 Elena Zannoni - 0.20031117.3 +- Add sick and twisted workaround for ppc64 architecture. + +* Wed Nov 19 2003 Elena Zannoni - 0.20031117.2 +- Fix typo in libunwind test. + +* Tue Nov 18 2003 Elena Zannoni - 0.20031117.1 +- Import new gdb snapshot from mainline FSF. +- Fix some testfiles. +- Add fixes for gcore, and patch for libunwind support on ia64. +- Add tests to see what versions of gcc, binutils, glibc and kernel we + are running with. + +* Wed Oct 15 2003 Elena Zannoni - 0.20030710.41 +- Bump up version number. + +* Wed Sep 24 2003 Elena Zannoni - 0.20030710.40 +- Fix problem with gcore and single threaded programs. (bugzilla 103531) + +* Mon Sep 22 2003 Jeff Johnston - 0.20030710.39 +- Fix call to quit_target from quit_force. + +* Sun Sep 21 2003 Andrew Cagney - 0.20030710.38 +- Fix PPC64 push dummy call. +- Re-fix PPC64 return value (had wrong / old patch). + +* Sat Sep 20 2003 Andrew Cagney - 0.20030710.37 +- Fix PPC32 return values. + +* Sat Sep 20 2003 Andrew Cagney - 0.20030710.36 +- Rewrite ppc64 retun value methods so that they (hopefully) +match the SysV spec. +- Enable ppc64 testsuite. + +* Thu Sep 18 2003 Andrew Cagney - 0.20030710.35 +- Hack around problem "break main" vs "break .main" when there is +only a minimal ppc64 symbol table. The former is a function descriptor +and not where you want the breakpoint to go. Only convert descriptors +to pointers when the address is in the ".opd" section. + +* Wed Sep 17 2003 Andrew Cagney - 0.20030710.34 +- Fix ppc32 push_dummy_call. + +* Tue Sep 16 2003 Andrew Cagney - 0.20030710.33 +- Pack gdb.sum and gdb.log using uuencode and bzip. + +* Tue Sep 16 2003 Jeff Johnston - 0.20030710.32 +- Catch errors when quitting so exit of gdb still occurs. + +* Mon Sep 15 2003 Andrew Cagney - 0.20030710.31 +- Fix ppc32 use_struct_convention. + +* Thu Sep 11 2003 Andrew Cagney - 0.20030710.30 +- Mods to dwarf2-frame.c to work around a lack of GCC/CFI info. + +* Thu Sep 11 2003 Elena Zannoni - 0.20030710.29 +- Bump up version number. + +* Wed Sep 10 2003 Elena Zannoni - 0.20030710.28 +- Fix a core dump with MI. +- Add new ChangeLog patch for mi changes. + +* Thu Sep 04 2003 Elena Zannoni - 0.20030710.27 +- Change the name of the package to gdb64 in ppc64 case. + +* Tue Aug 26 2003 Elena Zannoni - 0.20030710.26 +- Add testcase for separate debug info. + +* Tue Aug 26 2003 Andrew Cagney - 0.20030710.25 +- fix i386 on x86-64 TLS +- add "base-aug2003" suffix to older x86i386 patch + +* Tue Aug 26 2003 Andrew Cagney - 0.20030710.24 +- skip the ppc64 and x86-64 frame redzone. + +* Fri Aug 22 2003 Elena Zannoni - 0.20030710.23 +- Relax one testcase in selftest.exp a bit. +- Accept different output as well in thread bt (platform dependent). +- Enable testsuite run for ia64, ppc, s390 and s390x. They are in + reasonably good shape. + +* Thu Aug 21 2003 Jeff Johnston - 0.20030710.22 +- Multiple ia64 fixes. +- Fix ia64 printing of function pointers. +- Fix ia64 prologue examination to ignore predicated insns if we + haven't found the return address yet. +- Skip dump.exp testcase for ia64 + +* Thu Aug 21 2003 Elena Zannoni - 0.20030710.21 +- Bump release number. + +* Wed Aug 20 2003 Elena Zannoni - 0.20030710.20 +- Relax pattern in annota2.exp test. + +* Wed Aug 20 2003 Elena Zannoni - 0.20030710.19 +- rename gdb binary to gdb64 for ppc64 platform. + +* Tue Aug 19 2003 Jeff Johnston - 0.20030710.18 +- Fix ia64 pc unwinding to include psr slot. + +* Mon Aug 18 2003 Elena Zannoni - 0.20030710.17 +- Fix info installation for annotate.texi. (Bugzilla 102521) + +* Fri Aug 15 2003 Elena Zannoni - 0.20030710.16 +- revamp tls tests a bit. +- Handle new output from gdb in relocate.exp + +* Wed Aug 13 2003 Elena Zannoni - 0.20030710.15 +- Fix problem for processing of separate debug info files. + +* Wed Aug 13 2003 Jeff Johnston - 0.20030710.14 +- add ia64.inc file for testing ia64 in gdb.asm testsuite + +* Fri Aug 8 2003 Andrew Cagney - 0.20030710.13 +- print the libthread_db library path, print when threads are enabled + +* Thu Aug 7 2003 Andrew Cagney - 0.20030710.12 +- "cat" the test log into the build log + +* Wed Aug 06 2003 Jeff Johnston - 0.20030710.11 +- modernize ia64 gdb to use new frame model +- remove/replace deprecated interfaces used by ia64 gdb + +* Wed Aug 06 2003 Andrew Cagney - 0.20030710.10 +- Sync to gdb-5.3.90-sync-20030806.patch. + +* Tue Jul 29 2003 Andrew Cagney - 0.20030710.9 +- add x86-64 i386 fixes + +* Tue Jul 29 2003 Elena Zannoni - 0.20030710.8 +- Fix some tests by xfailing the correct target triplet for RedHat. +- Remove include of config.h from pthreads.c testcases. + +* Mon Jul 28 2003 Elena Zannoni - 0.20030710.7 +- Fix some test failures, by escaping correctly. + +* Thu Jul 24 2003 Elena Zannoni - 0.20030710.6 +- Remove one testcase that is redundant. + +* Wed Jul 23 2003 Elena Zannoni - 0.20030710.5 +- Bump up release number. + +* Wed Jul 23 2003 Elena Zannoni - 0.20030710.4 +- Bring in sync with current head of gdb-6 branch. +- Remove linespec patch, because included in the new sync patch. + +* Fri Jul 18 2003 Elena Zannoni - 0.20030710.3 +- Add patch to avoid gdb segfault with bad debug info. +- Change location of build tree to avoid conflicts with older versions + possibly installed. + +* Thu Jul 17 2003 Elena Zannoni - 0.20030710.2 +- Add patch to synchronize the current snapshot with the gdb-6 branch head. +- Remove some patches that are includd in such diff. +- Enable tests on AMD64 as well. + +* Fri Jul 11 2003 Elena Zannoni - 0.20030710.1 +- Import new gdb snapshot. +- Revamp gdb.spec. Get rid of patches that apply to older versions. +- Add patches for ppc64 support, kfail and make gdb more robust in copingi + with bad debug info. + +* Wed Jul 02 2003 Jeff Johnston - 1.20021129.39 +- Fix bug with ia64 checking of hardware breakpoints. + +* Mon Jun 30 2003 Elena Zannoni - 1.20021129.38 +- Add necessary function for NPTL support on x86-64. + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jun 04 2003 Elena Zannoni - 0.20021129.37 +* Tue Jun 03 2003 Elena Zannoni - 0.20021129.36 +- Enable warnings for x86_64, not x86-64. +- Fix warnings from infptrace.c and dwarfread.c. +- Print error message only when reading separate debug info really + doesn't work (jimb@redhat.com). + +* Fri May 23 2003 Elena Zannoni - 0.20021129.35 +- Fixes for fetching and storing access registers on s390x (jimb@redhat.com). + Bugzilla 91455. + +* Wed May 21 2003 Jeff Johnston - 0.20021129.34 +- Do not generate error on detach failure. Bugzilla 90900. + +* Thu May 8 2003 Elena Zannoni - 0.20021129.33 +- New tests for asm on s390x (jimb@redhat.com). Bugzilla 90503. +- Fixes for prologue analysis on s390x (jimb@redhat.com). Bugzilla 90506. +- bfd fix for 64-bit platforms (jimb@redhat.com). +- Disable ppc64 builds until we have a port. + +* Thu May 1 2003 Jeff Johnston - 0.20021129.32 +- Add ia64 support to the float.exp testcase. + +* Thu May 1 2003 Elena Zannoni - 0.20021129.31 +- Clean up the tls tests some more. +- Fix problem with non US-eng locale. Bugzilla bug 88823. + +* Wed Apr 30 2003 Jeff Johnston - 0.20021129.30 +- Fix ia64 prologue skipping. +- Fix ia64 line table. +- Fix setting of prev_pc in infrun.c. + +* Mon Mar 31 2003 Elena Zannoni - 0.20021129.29 +- Include the gcore script, as gdb_gcore.sh and install it in + /usr/bin as gcore. +- One more disassembly fix for core files. Added to + gdb-5.3post-disasm-mar2003.patch. Bugzilla 87677. +- Enable build warnings for x86-64. + +* Mon Mar 31 2003 Elena Zannoni - 0.20021129.28 +- Fix Java strings printing. +- Fix memory corruption in disassembly code. Bugzilla 85644. +- Testsuite fixes (jimb@redhat.com). Bugzilla 85457. +- Fixes for s390 stack handling (jimb@redhat.com). Bugzilla 85039. +- Fixes for s390 struct return (jimb@redhat.com). + +* Wed Mar 26 2003 Elena Zannoni - 0.20021129.27 +- Fixes for disassembly of code in threaded applications. Bugzilla 87495. +- Fixes for s390 prologue analysis. (jimb@redhat.com). + Bugzilla bugs 85251, 85214. + +* Thu Mar 20 2003 Elena Zannoni - 0.20021129.26 +- Fix inferior function calls with void return on x86-64. Bugzilla bug 83197. +- Fix for upstream PR/699. +- Fix some problems with gdb-5.3post-thrtst-feb2003.patch. + +* Wed Mar 19 2003 Jeff Johnston - 0.20021129.25 +- Fix for thread-db.c: check_event() - Bugzilla bug 86231. + +* Fri Mar 14 2003 Elena Zannoni - 0.20021129.24 +- Fix some problems with inferior function calls on x86-64. + +* Fri Mar 07 2003 Elena Zannoni - 0.20021129.23 +- testsuite patches. Bugzilla 85215 85028 85335. + +* Thu Mar 06 2003 Elena Zannoni - 0.20021129.22 +- Fix testsuite problems related to having '+' in the directory name. + Bugzilla 85031. + +* Mon Mar 03 2003 Elena Zannoni - 0.20021129.21 +- Fix a few inferior function call problems. + +* Mon Mar 03 2003 Elena Zannoni - 0.20021129.20 +- Split the changelog patches in two. Cleanup messy patch section. + +* Thu Feb 27 2003 Jeff Johnston - 0.20021129.19 +- Perform run-time check for tkill syscall in lin-lwp.c. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.18 +- Update copyright year printed in version. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.17 +- Refresh build. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.16 +- Add some testsuite cleanups, to avoid spurious test failures. + +* Fri Feb 21 2003 Jeff Johnston - 0.20021129.15 +- Add patch to handle thread exiting when LD_ASSUME_KERNEL=2.4.1 which + fixes Bugzilla bug 84217. + +* Fri Feb 21 2003 Elena Zannoni - 0.20021129.14 +- New patch to fix disassembly on s390. Bugzilla bug 84286. +- New patch for attach/ptrace fix. Bugzilla bug 84220. +- Reenable tests for x86. + +* Thu Feb 20 2003 Jeff Johnston - 0.20021129.13 +- Add patch for mixed stabs with dwarf2 - bugzilla bug 84253. + +* Wed Feb 12 2003 Elena Zannoni - 0.20021129.12 +- Disable tests also for x86. + +* Tue Feb 11 2003 Elena Zannoni - 0.20021129.11 +- Add patch for mi threads tests. +- Add patch for dwarf2 debug_ranges section. +- Add patch for detach bug. + +* Mon Feb 10 2003 Elena Zannoni - 0.20021129.10 +- Add patch for testsuite auto answering internal error queries. +- Add new TLS tests. +- Add cleanup patches for thread tests. + +* Mon Feb 03 2003 Elena Zannoni - 0.20021129.9 +- Add new patch for thread support. Apply on all arches. +- Do not apply old patches, but leave them around for now. +- Add new patch for dwarf2 debug info reading. +- Add new patch for dwarf2 cfi engine cleanup. +- Add new patch for uiout problems. +- Add new patch for s390 build. +- Disable tests on all platforms but x86. + +* Mon Jan 27 2003 Elena Zannoni - 0.20021129.8 +- Move all the changelog entries to a single patch. +- Add tests to the args patch. +- Add new patch for until command fix (bugzilla Bug 19890). +- s390 and s390x can be built with -Werror. +- Run make check for s390 and s390x too. +- Include an updated version of the thread nptl patch (still WIP). + +* Wed Jan 15 2003 Phil Knirsch - 0.20021129.7 +- Apply the 2nd misc patch for s390 and s390x, too. + +* Tue Jan 14 2003 Elena Zannoni - 0.20021129.6 +- Add patches for NPTL support, to be applied on i386 only. + (this is still WIP) +- Split old misc patch in two parts. +- Temporarily disable testsuite run on alpha. + +* Sun Jan 12 2003 Elena Zannoni - 0.20021129.5 +- Add patch for --args with zero-length arguments. Fix for bug 79833. + +* Tue Dec 17 2002 Elliot Lee - 0.20021129.4 +- The define directive to rpm is significant even if the line it is + in happens to start with a '#' character. Fixed. + +* Fri Dec 13 2002 Elena Zannoni - 0.20021129.3 +- Merge previous patches for warnings into a single one. +- Add changelogs to patches. +- Add, but don't use, a macro to avoid stripping. + +* Fri Dec 6 2002 Elena Zannoni +- Add patch to allow debugging of executables with debug info stored + in separate files. +- Add patch for Makefile dependencies and disable warnings for + building thread-db.c. +- Re-enable building with -Werror for alpha, ia64, ppc. + +* Mon Dec 2 2002 Elena Zannoni +- Don't pass to gdb an empty build warnings flag, or that will disable warnings + completely. We want to build using gdb's standard warnings instead. + +* Mon Dec 2 2002 Elena Zannoni +- Don't do testing for x86_64. + +* Sun Dec 1 2002 Elena Zannoni +- x86_64 doesn't build with Werror yet. +- Add patch for alpha. +- Alpha doesn't build with -Werror either. +- Add patch for ia64. +- Add patch for ppc. +- Drop ia64 from -Werror list. +- Drop ppc from -Werror list. + +* Sun Dec 1 2002 Elena Zannoni +- Add dejagnu to the build requirements. +- Enable make check. +- Add enable-gdb-build-warnings to the configure flags. + +* Fri Nov 29 2002 Elena Zannoni +- Import new upstream sources. +- Change version and release strings. +- Upgrade patches. +- Build gdb/gdbserver as well. +- Define and use 'cvsdate'. +- Do %%setup specifying the source directory name. +- Don't cd up one dir before removing tcl and friends. +- Change the configure command to allow for the new source tree name. +- Ditto for the copy of NEWS. +- Add some comments. + +* Mon Nov 25 2002 Elena Zannoni 5.2.1-5 +General revamp. +- Add patch for gdb/doc/Makefile.in. Part of fix for bug 77615. +- Add patch for mmalloc/Makefile.in. Part of fix for bug 77615. +- Change string printed in version.in to -rh. +- Move the deletion of dejagnu, expect, tcl to the prep section, + from the build section. +- Add build directory housekeeping to build section. +- Use macros for configure parameters. +- Do the build in a separate directory. +- Prepare for testing, but not enable it yet. +- Correctly copy the NEWS file to the top level directory, for the doc + section to find it. +- Cd to build directory before doing install. +- Use makeinstall macro, w/o options. +- Remove workaround for broken gdb info files. Part of fix for bug 77615. +- Remove share/locale directory, it is in binutils. +- Remove info/dir file. +- Clarify meaning of post-install section. +- Add gdbint info files to post-install, pre-uninstall and files sections. + Part of fix for bugs 77615, 76423. +- Add libmmalloc.a to package. + +* Fri Aug 23 2002 Florian La Roche +- added mainframe patch from developerworks + +* Wed Aug 21 2002 Trond Eivind Glomsrod 5.2.1-3 +- Add changelogs to the previous patch + +* Wed Aug 14 2002 Trond Eivind Glomsrod 5.2.1-2 +- Add some patches from Elena Zannoni + +* Tue Jul 23 2002 Trond Eivind Glomsrod 5.2.1-1 +- 5.2.1 + +* Mon Jul 22 2002 Florian La Roche +- compile on mainframe + +* Mon Jul 8 2002 Trond Eivind Glomsrod 5.2-3 +- Rebuild + +* Tue May 7 2002 Trond Eivind Glomsrod 5.2-2 +- Rebuild + +* Mon Apr 29 2002 Trond Eivind Glomsrod 5.2-1 +- 5.2 + +* Mon Apr 29 2002 Trond Eivind Glomsrod 5.1.92-1 +- 5.1.92. Hopefully identical to 5.2 final + +* Mon Apr 22 2002 Trond Eivind Glomsrod 5.1.91-1 +- 5.1.91. 5.2 expected in a week + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-5 +- Update to current + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-4 +- Update to current + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-3 +- Update to current + +* Wed Mar 20 2002 Trond Eivind Glomsrod 5.1.90CVS-2 +- Update to current + +* Wed Mar 13 2002 Trond Eivind Glomsrod 5.1.90CVS-1 +- Update to current 5.2 branch + +* Thu Jan 24 2002 Trond Eivind Glomsrod 5.1.1-1 +- 5.1.1 +- add URL + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Mon Dec 10 2001 Trond Eivind Glomsrod 5.1-2 +- Fix some thread+fpu problems + +* Mon Nov 26 2001 Trond Eivind Glomsrod 5.1-1 +- 5.1 + +* Mon Nov 19 2001 Trond Eivind Glomsrod 5.0.94-0.71 +- 5.0.94. Almost there.... + +* Mon Nov 12 2001 Trond Eivind Glomsrod 5.0.93-2 +- Add patch from jakub@redhat.com to improve handling of DWARF + +* Mon Nov 12 2001 Trond Eivind Glomsrod 5.0.93-1 +- 5.0.93 +- handle missing info pages in post/pre scripts + +* Wed Oct 31 2001 Trond Eivind Glomsrod 5.0.92-1 +- 5.0.92 + +* Fri Oct 26 2001 Trond Eivind Glomsrod 5.0.91rh-1 +- New snapshot +- Use the 5.0.91 versioning from the snapshot + +* Wed Oct 17 2001 Trond Eivind Glomsrod 5.0rh-17 +- New snapshot + +* Thu Sep 27 2001 Trond Eivind Glomsrod +- New snapshot + +* Wed Sep 12 2001 Trond Eivind Glomsrod 5.0rh-16 +- New snapshot + +* Mon Aug 13 2001 Trond Eivind Glomsrod 5.0rh-15 +- Don't buildrequire compat-glibc (#51690) + +* Thu Aug 9 2001 Trond Eivind Glomsrod +- New snapshot, from the stable branch eventually leading to gdb 5.1 + +* Mon Jul 30 2001 Trond Eivind Glomsrod +- s/Copyright/License/ +- Add texinfo to BuildRequires + +* Mon Jun 25 2001 Trond Eivind Glomsrod +- New snapshot + +* Fri Jun 15 2001 Trond Eivind Glomsrod +- New snapshot +- Add ncurses-devel to buildprereq +- Remove perl from buildprereq, as gdb changed the way + version strings are generated + +* Thu Jun 14 2001 Trond Eivind Glomsrod +- New snapshot + +* Wed May 16 2001 Trond Eivind Glomsrod +- New snapshot - this had thread fixes for curing #39070 +- New way of specifying version + +* Tue May 1 2001 Trond Eivind Glomsrod +- New tarball +- Kevin's patch is now part of gdb + +* Mon Apr 9 2001 Trond Eivind Glomsrod +- Add patch from kevinb@redhat.com to fix floating point + thread + problem (#24310) +- remove old workarounds +- new snapshot + +* Thu Apr 5 2001 Trond Eivind Glomsrod +- New snapshot + +* Sat Mar 17 2001 Bill Nottingham +- on ia64, there are no old headers :) + +* Fri Mar 16 2001 Trond Eivind Glomsrod +- build with old headers, new compiler + +* Fri Mar 16 2001 Trond Eivind Glomsrod +- new snapshot + +* Mon Feb 26 2001 Trond Eivind Glomsrod +- new snapshot which should fix some more IA64 problems (#29151) +- remove IA64 patch, it's now integrated + +* Wed Feb 21 2001 Trond Eivind Glomsrod +- add IA64 and Alpha patches from Kevin Buettner +- use perl instead of patch for fixing the version string + +* Tue Feb 20 2001 Trond Eivind Glomsrod +- don't use kgcc anymore +- mark it as our own version +- new snapshot + +* Mon Jan 22 2001 Bernhard Rosenkraenzer +- Link with ncurses 5.x even though we're using kgcc. + No need to drag in requirements on ncurses4 (Bug #24445) + +* Fri Jan 19 2001 Trond Eivind Glomsrod +- new snapshot + +* Wed Dec 20 2000 Trond Eivind Glomsrod +- new snapshot + +* Mon Dec 04 2000 Trond Eivind Glomsrod +- new snapshot +- new alpha patch - it now compiles everywhere. Finally. + +* Fri Dec 01 2000 Trond Eivind Glomsrod +- new snapshot + +* Mon Nov 20 2000 Trond Eivind Glomsrod +- new CVS snapshot +- disable the patches +- don't use %%configure, as it confuses the autoconf script +- enable SPARC, disable Alpha + + +* Wed Aug 09 2000 Trond Eivind Glomsrod +- added patch from GDB team for C++ symbol handling + +* Tue Jul 25 2000 Trond Eivind Glomsrod +- upgrade to CVS snapshot +- excludearch SPARC, build on IA61 + +* Wed Jul 19 2000 Trond Eivind Glomsrod +- rebuild + +* Thu Jul 13 2000 Prospector +- automatic rebuild + +* Sun Jul 02 2000 Trond Eivind Glomsrod +- rebuild + +* Thu Jun 08 2000 Trond Eivind Glomsrod +- use %%configure, %%makeinstall, %%{_infodir}, %%{_mandir}, + and %%{_tmppath} +- the install scripts for info are broken(they don't care about + you specify in the installstep), work around that. +- don't build for IA64 + +* Mon May 22 2000 Trond Eivind Glomsrod +- upgraded to 5.0 - dump all patches. Reapply later if needed. +- added the NEWS file to the %%doc files +- don't delete files which doesn't get installed (readline, texinfo) +- let build system handle stripping and gzipping +- don't delete libmmalloc +- apply patch from jakub@redhat.com to make it build on SPARC + +* Fri Apr 28 2000 Matt Wilson +- rebuilt against new ncurses + +* Tue Mar 7 2000 Jeff Johnson +- rebuild for sparc baud rates > 38400. + +* Tue Feb 8 2000 Jakub Jelinek +- fix core file handling on i386 with glibc 2.1.3 headers + +* Fri Jan 14 2000 Jakub Jelinek +- fix reading registers from core on sparc. +- hack around build problems on i386 with glibc 2.1.3 headers + +* Thu Oct 7 1999 Jim Kingdon +- List files to install in /usr/info specifically (so we don't pick up +things like info.info from GDB snapshots). + +* Thu Oct 7 1999 Jim Kingdon +- Update GDB to 19991004 snapshot. This eliminates the need for the +sigtramp, sparc, xref, and threads patches. Update sparcmin patch. + +* Mon Aug 23 1999 Jim Kingdon +- Omit readline manpage. + +* Sat Aug 7 1999 Jim Kingdon +- Remove H.J. Lu's patches (they had been commented out). +- Add sigtramp patch (from gdb.cygnus.com) and threads patch (adapted +from code fusion CD-ROM). + +* Wed Apr 14 1999 Jeff Johnson +- merge H.J. Lu's patches into 4.18. + +* Mon Apr 05 1999 Cristian Gafton +- updated the kern22 patch with stuff from davem + +* Thu Apr 1 1999 Jeff Johnson +- sparc with 2.2 kernels no longer uses sunos ptrace (davem) + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 3) + +* Mon Mar 8 1999 Jeff Johnson +- Sparc fiddles for Red Hat 6.0.