Browse Source

gdb package update

Signed-off-by: basebuilder_pel7ppc64lebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64lebuilder0 6 years ago
parent
commit
f74dbacc7a
  1. 87297
      SOURCES/binutils-2.23.52.0.1-avx512-mpx-sha.patch
  2. 103
      SOURCES/gdb-6.3-attach-see-vdso-test.patch
  3. 310
      SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch
  4. 98
      SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch
  5. 196
      SOURCES/gdb-6.3-bz231832-obstack-2gb.patch
  6. 28
      SOURCES/gdb-6.3-focus-cmd-prev-test.patch
  7. 25
      SOURCES/gdb-6.3-gcore-thread-20050204.patch
  8. 232
      SOURCES/gdb-6.3-gstack-20050411.patch
  9. 20
      SOURCES/gdb-6.3-ia64-gcore-page0-20050421.patch
  10. 126
      SOURCES/gdb-6.3-ia64-gcore-speedup-20050714.patch
  11. 107
      SOURCES/gdb-6.3-ia64-info-frame-fix-20050725.patch
  12. 95
      SOURCES/gdb-6.3-ia64-sigill-20051115.patch
  13. 158
      SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch
  14. 315
      SOURCES/gdb-6.3-inferior-notification-20050721.patch
  15. 153
      SOURCES/gdb-6.3-inheritancetest-20050726.patch
  16. 229
      SOURCES/gdb-6.3-mapping-zero-inode-test.patch
  17. 24
      SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch
  18. 111
      SOURCES/gdb-6.3-ppc64syscall-20040622.patch
  19. 98
      SOURCES/gdb-6.3-readnever-20050907.patch
  20. 22
      SOURCES/gdb-6.3-rh-dummykfail-20041202.patch
  21. 103
      SOURCES/gdb-6.3-rh-testlibunwind-20041202.patch
  22. 19
      SOURCES/gdb-6.3-rh-testversion-20041202.patch
  23. 239
      SOURCES/gdb-6.3-test-dtorfix-20050121.patch
  24. 95
      SOURCES/gdb-6.3-test-movedir-20050125.patch
  25. 2085
      SOURCES/gdb-6.3-test-pie-20050107.patch
  26. 101
      SOURCES/gdb-6.3-test-self-20050110.patch
  27. 246
      SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch
  28. 930
      SOURCES/gdb-6.5-BEA-testsuite.patch
  29. 120
      SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch
  30. 258
      SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
  31. 28
      SOURCES/gdb-6.5-bz190810-gdbserver-arch-advice.patch
  32. 17
      SOURCES/gdb-6.5-bz203661-emit-relocs.patch
  33. 450
      SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch
  34. 91
      SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
  35. 21
      SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
  36. 79
      SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch
  37. 139
      SOURCES/gdb-6.5-gcore-buffer-limit-test.patch
  38. 120
      SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch
  39. 56
      SOURCES/gdb-6.5-last-address-space-byte-test.patch
  40. 83
      SOURCES/gdb-6.5-missed-trap-on-step-test.patch
  41. 136
      SOURCES/gdb-6.5-readline-long-line-crash-test.patch
  42. 111
      SOURCES/gdb-6.5-section-num-fixup-test.patch
  43. 171
      SOURCES/gdb-6.5-sharedlibrary-path.patch
  44. 119
      SOURCES/gdb-6.6-bfd-vdso8k.patch
  45. 196
      SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch
  46. 36
      SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
  47. 105
      SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch
  48. 1476
      SOURCES/gdb-6.6-buildid-locate-rpm.patch
  49. 59
      SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch
  50. 1124
      SOURCES/gdb-6.6-buildid-locate.patch
  51. 171
      SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch
  52. 87
      SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch
  53. 121
      SOURCES/gdb-6.6-bz235197-fork-detach-info.patch
  54. 270
      SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
  55. 62
      SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch
  56. 205
      SOURCES/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
  57. 26
      SOURCES/gdb-6.6-testsuite-timeouts.patch
  58. 18
      SOURCES/gdb-6.6-threads-static-test.patch
  59. 703
      SOURCES/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch
  60. 118
      SOURCES/gdb-6.7-charsign-test.patch
  61. 96
      SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch
  62. 108
      SOURCES/gdb-6.7-testsuite-stable-results.patch
  63. 152
      SOURCES/gdb-6.8-attach-signalled-detach-stopped.patch
  64. 25
      SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch
  65. 173
      SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch
  66. 105
      SOURCES/gdb-6.8-bz457187-largefile-test.patch
  67. 473
      SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch
  68. 74
      SOURCES/gdb-6.8-quit-never-aborts.patch
  69. 12
      SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch
  70. 78
      SOURCES/gdb-6.8-watchpoint-conditionals-test.patch
  71. 51
      SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
  72. 85
      SOURCES/gdb-archer-next-over-throw-cxx-exec.patch
  73. 83
      SOURCES/gdb-archer-pie-addons-keep-disabled.patch
  74. 82
      SOURCES/gdb-archer-pie-addons.patch
  75. 8489
      SOURCES/gdb-archer.patch
  76. 245
      SOURCES/gdb-attach-fail-reasons-5of5.patch
  77. 186
      SOURCES/gdb-attach-fail-reasons-5of5configure.patch
  78. 234
      SOURCES/gdb-bare-DW_TAG_lexical_block-1of2.patch
  79. 371
      SOURCES/gdb-bare-DW_TAG_lexical_block-2of2.patch
  80. 209
      SOURCES/gdb-bz1326476-attach-kills.patch
  81. 125
      SOURCES/gdb-bz533176-fortran-omp-step.patch
  82. 151
      SOURCES/gdb-bz541866-rwatch-before-run.patch
  83. 68
      SOURCES/gdb-bz568248-oom-is-error.patch
  84. 240
      SOURCES/gdb-bz601887-dwarf4-rh-test.patch
  85. 31
      SOURCES/gdb-bz634108-solib_address.patch
  86. 17
      SOURCES/gdb-ccache-workaround.patch
  87. 131
      SOURCES/gdb-core-open-vdso-warning.patch
  88. 102
      SOURCES/gdb-dlopen-stap-probe-1of9.patch
  89. 181
      SOURCES/gdb-dlopen-stap-probe-2of9.patch
  90. 298
      SOURCES/gdb-dlopen-stap-probe-3of9.patch
  91. 35
      SOURCES/gdb-dlopen-stap-probe-4of9.patch
  92. 91
      SOURCES/gdb-dlopen-stap-probe-5of9.patch
  93. 132
      SOURCES/gdb-dlopen-stap-probe-6of9.patch
  94. 1107
      SOURCES/gdb-dlopen-stap-probe-7of9.patch
  95. 462
      SOURCES/gdb-dlopen-stap-probe-8of9.patch
  96. 415
      SOURCES/gdb-dlopen-stap-probe-9of9.patch
  97. 86
      SOURCES/gdb-enable-count-crash.patch
  98. 27
      SOURCES/gdb-follow-child-stale-parent.patch
  99. 207
      SOURCES/gdb-gdb-add-index-script.patch
  100. 143
      SOURCES/gdb-glibc-strstr-workaround.patch
  101. Some files were not shown because too many files have changed in this diff Show More

87297
SOURCES/binutils-2.23.52.0.1-avx512-mpx-sha.patch

File diff suppressed because it is too large Load Diff

103
SOURCES/gdb-6.3-attach-see-vdso-test.patch

@ -0,0 +1,103 @@ @@ -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 <unistd.h>
+
+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 <jan.kratochvil@redhat.com>.
+
+# 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}"

310
SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch

@ -0,0 +1,310 @@ @@ -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 <stdlib.h>
+
+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 <stdlib.h>
+
+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
}

98
SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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 <stddef.h>
+#include <pthread.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+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"
+ }
+}

196
SOURCES/gdb-6.3-bz231832-obstack-2gb.patch

@ -0,0 +1,196 @@ @@ -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 <gnu-versions.h>
#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
+#if 0 /* 64-bit obstack is not compatible with any glibc implementation. */
#define ELIDE_CODE
#endif
#endif
+#endif
#ifndef ELIDE_CODE
@@ -139,7 +141,7 @@ struct obstack *_obstack;
free up some memory, then call this again. */
int
-_obstack_begin (struct obstack *h, int size, int alignment,
+_obstack_begin (struct obstack *h, PTR_INT_TYPE size, int alignment,
POINTER (*chunkfun) (long), void (*freefun) (void *))
{
register struct _obstack_chunk *chunk; /* points to new chunk */
@@ -183,7 +185,7 @@ _obstack_begin (struct obstack *h, int s
}
int
-_obstack_begin_1 (struct obstack *h, int size, int alignment,
+_obstack_begin_1 (struct obstack *h, PTR_INT_TYPE size, int alignment,
POINTER (*chunkfun) (POINTER, long),
void (*freefun) (POINTER, POINTER), POINTER arg)
{
@@ -235,7 +237,7 @@ _obstack_begin_1 (struct obstack *h, int
to the beginning of the new one. */
void
-_obstack_newchunk (struct obstack *h, int length)
+_obstack_newchunk (struct obstack *h, PTR_INT_TYPE length)
{
register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk;
@@ -388,11 +390,11 @@ obstack_free (struct obstack *h, POINTER
abort ();
}
-int
+PTR_INT_TYPE
_obstack_memory_used (struct obstack *h)
{
register struct _obstack_chunk* lp;
- register int nbytes = 0;
+ register PTR_INT_TYPE nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
@@ -421,6 +423,7 @@ print_and_abort (void)
}
#if 0
+/* These functions are now broken for 64-bit obstack! */
/* These are now turned off because the applications do not use it
and it uses bcopy via obstack_grow, which causes trouble on sysV. */

28
SOURCES/gdb-6.3-focus-cmd-prev-test.patch

@ -0,0 +1,28 @@ @@ -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"

25
SOURCES/gdb-6.3-gcore-thread-20050204.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
2005-02-07 Jeff Johnston <jjohnstn@redhat.com>

* linux-nat.c (linux_nat_xfer_memory): Don't use
linux_proc_xfer_memory for ia64.

Index: gdb-6.8.50.20090803/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-04 06:29:47.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-04 06:29:55.000000000 +0200
@@ -4495,10 +4495,15 @@ linux_xfer_partial (struct target_ops *o
offset &= ((ULONGEST) 1 << addr_bit) - 1;
}
+#ifndef NATIVE_XFER_UNWIND_TABLE
+ /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
+ for accessing thread storage. Revert when Bugzilla 147436
+ is fixed. */
xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
if (xfer != 0)
return xfer;
+#endif
return super_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);

232
SOURCES/gdb-6.3-gstack-20050411.patch

@ -0,0 +1,232 @@ @@ -0,0 +1,232 @@
2004-11-23 Andrew Cagney <cagney@redhat.com>

* 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` <process-id>" 1>&2
+ exit 1
+fi
+
+if test ! -r /proc/$1; then
+ echo "Process $1 not found." 1>&2
+ exit 1
+fi
+
+# GDB doesn't allow "thread apply all bt" when the process isn't
+# threaded; need to peek at the process to determine if that or the
+# simpler "bt" should be used.
+
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
+GDB=${GDB:-/usr/bin/gdb}
+
+# Run GDB, strip out unwanted noise.
+# --readnever is no longer used since .gdb_index is now in use.
+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
+set width 0
+set height 0
+set pagination no
+$backtrace
+EOF
+/bin/sed -n \
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
Index: gdb-7.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 <http://www.gnu.org/licenses/>.
+
+set testfile gstack
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/$executable
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
+ return -1
+}
+
+set test "spawn inferior"
+set command "${binfile}"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+}
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+}
+gdb_exit
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+
+set test "spawn gstack"
+set command "sh -c GDB=$GDB\\ 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 <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+void
+func (void)
+{
+ const char msg[] = "looping\n";
+
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
+
+ for (;;);
+}
+
+int
+main (void)
+{
+ alarm (60);
+ nice (100);
+
+ func ();
+
+ return 0;
+}

20
SOURCES/gdb-6.3-ia64-gcore-page0-20050421.patch

@ -0,0 +1,20 @@ @@ -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."),

126
SOURCES/gdb-6.3-ia64-gcore-speedup-20050714.patch

@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
2005-07-14 Jeff Johnsotn <jjohnstn@redhat.com>

* linux-nat.c (linux_nat_xfer_memory): Incorporate Fujitsu
work-around to use /proc/mem for storage, but to fall-back
to PTRACE for ia64 rse register areas.
* ia64-linux-nat.c (ia64_rse_slot_num): New static function.
(ia64_rse_skip_regs): Ditto.
(ia64_linux_check_stack_region): New function.
Index: gdb-6.8.50.20090803/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-04 06:29:55.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-04 06:30:53.000000000 +0200
@@ -4495,15 +4495,38 @@ linux_xfer_partial (struct target_ops *o
offset &= ((ULONGEST) 1 << addr_bit) - 1;
}
-#ifndef NATIVE_XFER_UNWIND_TABLE
- /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
- for accessing thread storage. Revert when Bugzilla 147436
- is fixed. */
xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
if (xfer != 0)
- return xfer;
+ {
+#ifdef NATIVE_XFER_UNWIND_TABLE
+ struct mem_region range;
+ range.lo = memaddr;
+ range.hi = memaddr + len;
+
+ /* FIXME: For ia64, we cannot currently use
+ linux_proc_xfer_partial for accessing rse register storage.
+ Revert when Bugzilla 147436 is fixed. */
+#ifdef NATIVE_XFER_UNWIND_TABLE
+ extern int ia64_linux_check_stack_region (struct lwp_info *lwp,
+ void *range);
+#endif
+ if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
+ { /* This region contains ia64 rse registers, we have to re-read. */
+ int xxfer;
+
+ /* Re-read register stack area. */
+ xxfer = super_xfer_partial (ops, object, annex,
+ readbuf + (range.lo - memaddr),
+ writebuf + (range.lo - memaddr),
+ offset + (range.lo - memaddr),
+ range.hi - range.lo);
+ if (xxfer == 0)
+ xfer = 0;
+ }
#endif
+ return xfer;
+ }
return super_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
Index: gdb-6.8.50.20090803/gdb/ia64-linux-nat.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/ia64-linux-nat.c 2009-02-23 01:03:49.000000000 +0100
+++ gdb-6.8.50.20090803/gdb/ia64-linux-nat.c 2009-08-04 06:30:53.000000000 +0200
@@ -809,6 +809,64 @@ ia64_linux_xfer_partial (struct target_o
void _initialize_ia64_linux_nat (void);
+/*
+ * Note: taken from ia64_tdep.c
+ *
+ */
+
+static __inline__ unsigned long
+ia64_rse_slot_num (unsigned long addr)
+{
+ return (addr >> 3) & 0x3f;
+}
+
+/* Skip over a designated number of registers in the backing
+ store, remembering every 64th position is for NAT. */
+static __inline__ unsigned long
+ia64_rse_skip_regs (unsigned long addr, long num_regs)
+{
+ long delta = ia64_rse_slot_num(addr) + num_regs;
+
+ if (num_regs < 0)
+ delta -= 0x3e;
+ return addr + ((num_regs + delta/0x3f) << 3);
+}
+
+/*
+ * Check mem_region is stack or not. If stack, /proc/<pid>/mem cannot return
+ * expected value.
+ */
+int ia64_linux_check_stack_region(struct lwp_info *ti, struct mem_region *range)
+{
+ CORE_ADDR addr;
+ int error;
+ unsigned long bsp, cfm, bspstore;
+ long sof;
+ pid_t pid = ptid_get_lwp(ti->ptid);
+ bsp = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSP ,NULL);
+ if (bsp == (unsigned long)-1) {
+ return 1;
+ }
+ /* stack is allocated by one-segment, not separated into several segments.
+ So, we only have to check whether bsp is in *range* or not. */
+ if((range->lo <= bsp) && (bsp <= range->hi)) {
+ bspstore = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSPSTORE, NULL);
+ cfm = ptrace(PTRACE_PEEKUSER, pid, PT_CFM, NULL);
+ sof = cfm & 0x3f;
+ bsp = ia64_rse_skip_regs(bsp, -sof);
+ range->lo = bspstore;
+ range->hi = bsp;
+ /* we have to check the size of dirty register stack area */
+ /*
+ fprintf_unfiltered(gdb_stdlog, "<%d> <%p> <%lx> <%p> <%p>\n",
+ pid, bsp, sof, range->lo, range->hi);
+ */
+ return 1;
+ }
+
+ return 0;
+}
+
void
_initialize_ia64_linux_nat (void)
{

107
SOURCES/gdb-6.3-ia64-info-frame-fix-20050725.patch

@ -0,0 +1,107 @@ @@ -0,0 +1,107 @@
2005-07-25 Jeff Johnstno <jjohnstn@redhat.com>

* libunwind-frame.c (libunwind_frame_prev_register): Check valuep
is not NULL before copying cursor address into it.
testsuite:
2005-07-25 Jeff Johnstno <jjohnstn@redhat.com>

* gdb.arch/ia64-sigtramp.exp: New test.
* gdb.arch/ia64-sigtramp.c: Ditto.

2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>

Port to GDB-6.8pre. (Only the testcase has remained.)

--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix 2005-07-25 16:42:46.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c 2005-07-25 16:42:08.000000000 -0400
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <signal.h>
+
+int *l;
+
+void x (int sig)
+{
+ printf ("in signal handler for signal %d\n", sig);
+}
+
+int main()
+{
+ int k;
+
+ signal (SIGSEGV, &x);
+
+ k = *l;
+
+ printf ("k is %d\n", k);
+
+ return 0;
+}
+
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400
@@ -0,0 +1,63 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@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"

95
SOURCES/gdb-6.3-ia64-sigill-20051115.patch

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
2005-11-15 Jeff Johnston <jjohnstn@redhat.com>

* linux-thread-db.c (thread_db_wait): Don't bother continuing if
the wait result indicates the program terminated with a signal.
* linux-nat.c (linux_nat_wait): For SIGILL and SIGTRAP, don't
throw away the event if the user has specified nostop noprint.

gdb/testsuite:

2005-11-15 Jeff Johnston <jjohnstn@redhat.com>

* gdb.arch/ia64-sigill.c: New test.
* gdb.arch/ia64-sigill.exp: Ditto.

Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp 2011-07-22 19:16:13.000000000 +0200
@@ -0,0 +1,49 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@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 <stdio.h>
+
+int main()
+{
+ printf ("hello world\n");
+ return 0;
+}
+
Index: gdb-7.3.50.20110722/gdb/linux-nat.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 19:15:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-22 19:16:13.000000000 +0200
@@ -3733,7 +3733,8 @@ retry:
threads can be a bit time-consuming so if we want decent
performance with heavily multi-threaded programs, especially when
they're using a high frequency timer, we'd better avoid it if we
- can. */
+ can. For possible trap signals like SIGTRAP and SIGILL, don't
+ avoid reporting. */
if (WIFSTOPPED (status))
{

158
SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch

@ -0,0 +1,158 @@ @@ -0,0 +1,158 @@
2005-07-08 Jeff Johnston <jjohnstn@redhat.com>

* ia64-tdep.c (ia64_sigtramp_frame_prev_register): Build
pseudo-registers the same as ia64_pseudo_register_read.

2008-04-16 Yi Zhan <yi.zhan@intel.com>

* ia64-tdep.c (ia64_sigtramp_frame_prev_register): Fix an
ISO C compliance compilation error.

2008-02-12 Jan Kratochvil <jan.kratochvil@redhat.com>

Port to gdb-6.8.50.20081128, follow the upstream change:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ia64-tdep.c.diff?cvsroot=src&r1=1.176&r2=1.177

Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/ia64-tdep.c 2008-11-26 06:27:48.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/ia64-tdep.c 2008-12-02 19:04:32.000000000 +0100
@@ -2107,6 +2107,94 @@ ia64_sigtramp_frame_prev_register (struc
return frame_unwind_got_constant (this_frame, regnum, pc);
}
+ /* Red Hat patch begin. */
+ else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
+ {
+ /* NAT pseudo registers 0-31: get them from UNAT.
+ * "copied" from ia64_pseudo_register_read() */
+ ULONGEST unatN_val;
+ ULONGEST unat;
+ read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
+ register_size (target_gdbarch, IA64_UNAT_REGNUM));
+ unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
+ return frame_unwind_got_constant (this_frame, regnum, unatN_val);
+ }
+ else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
+ {
+ /* NAT pseudo registers 32-127.
+ * "copied" from ia64_pseudo_register_read()
+ * FIXME: Not currently tested -- cannot get the frame to include
+ * NAT32-NAT127. */
+ ULONGEST bsp;
+ ULONGEST cfm;
+ ULONGEST natN_val = 0;
+ CORE_ADDR gr_addr = 0, nat_addr = 0;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (target_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get start of register frame. */
+ bsp = rse_address_add (bsp, -(cfm & 0x7f));
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
+ gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
+
+ if (gr_addr != 0)
+ {
+ /* Compute address of nat collection bits */
+ CORE_ADDR nat_collection;
+ int nat_bit;
+ nat_addr = gr_addr | 0x1f8;
+ /* If our nat collection address is bigger than bsp, we have to get
+ the nat collection from rnat. Otherwise, we fetch the nat
+ collection from the computed address. FIXME: Do not know if
+ RNAT can be not stored in the frame--being extra cautious. */
+ if (nat_addr >= bsp)
+ {
+ nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
+ if (nat_addr != 0)
+ read_memory (nat_addr, (char *) &nat_collection,
+ register_size (target_gdbarch, IA64_RNAT_REGNUM));
+ }
+ else
+ nat_collection = read_memory_integer (nat_addr, 8, BFD_ENDIAN_LITTLE);
+ if (nat_addr != 0)
+ {
+ nat_bit = (gr_addr >> 3) & 0x3f;
+ natN_val = (nat_collection >> nat_bit) & 1;
+ return frame_unwind_got_constant (this_frame, regnum, natN_val);
+ }
+ }
+ warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
+ regnum);
+ }
+ else if (regnum == VBOF_REGNUM)
+ {
+ /* BOF pseudo register.
+ * "copied" from ia64_pseudo_register_read()
+ *
+ * A virtual register frame start is provided for user convenience.
+ * It can be calculated as the bsp - sof (sizeof frame). */
+ ULONGEST bsp;
+ ULONGEST cfm;
+ ULONGEST bof;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (target_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get beginning of frame. */
+ bof = rse_address_add (bsp, -(cfm & 0x7f));
+
+ return frame_unwind_got_constant (this_frame, regnum, bof);
+ }
+ /* Red Hat patch end. */
+
else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
|| (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
{
@@ -2121,7 +2209,42 @@ ia64_sigtramp_frame_prev_register (struc
return frame_unwind_got_constant (this_frame, regnum, 0);
}
- else /* All other registers not listed above. */
+ /* Red Hat patch begin. */
+ else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
+ {
+ /* VP 0-63.
+ * "copied" from ia64_pseudo_register_read()
+ *
+ * FIXME: Not currently tested--cannot get the frame to include PR. */
+ CORE_ADDR pr_addr = 0;
+
+ pr_addr = cache->saved_regs[IA64_PR_REGNUM];
+ if (pr_addr != 0)
+ {
+ ULONGEST pr;
+ ULONGEST cfm;
+ ULONGEST prN_val;
+ read_memory (pr_addr, (char *) &pr,
+ register_size (target_gdbarch, IA64_PR_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* Get the register rename base for this frame and adjust the
+ * register name to take rotation into account. */
+ if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
+ {
+ int rrb_pr = (cfm >> 32) & 0x3f;
+ regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ }
+ prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
+ return frame_unwind_got_constant (this_frame, regnum, prN_val);
+ }
+ warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
+ regnum);
+ }
+ /* Red Hat patch end. */
+
+ /* All other registers not listed above. */
{
CORE_ADDR addr = cache->saved_regs[regnum];

315
SOURCES/gdb-6.3-inferior-notification-20050721.patch

@ -0,0 +1,315 @@ @@ -0,0 +1,315 @@
2005-07-21 Jeff Johnston <jjohnstn@redhat.com>

* 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 <jan.kratochvil@redhat.com>

* 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 <stdio.h>
+
+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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+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);
+}

153
SOURCES/gdb-6.3-inheritancetest-20050726.patch

@ -0,0 +1,153 @@ @@ -0,0 +1,153 @@
2005-07-26 Jeff Johnston <jjohnstn@redhat.com>

* 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 <iostream>
+
+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();
+};

229
SOURCES/gdb-6.3-mapping-zero-inode-test.patch

@ -0,0 +1,229 @@ @@ -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 <sys/ipc.h>
+#include <sys/shm.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+
+/* 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;
+}

24
SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
2004-11-24 Andrew Cagney <cagney@gnu.org>

* printcmd.c (build_address_symbolic): Find a section for the
address.

Index: gdb-6.8.50.20081128/gdb/printcmd.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/printcmd.c 2008-12-04 01:36:05.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/printcmd.c 2008-12-04 01:37:18.000000000 +0100
@@ -616,6 +616,14 @@ build_address_symbolic (CORE_ADDR addr,
addr = overlay_mapped_address (addr, section);
}
}
+ /* To ensure that the symbol returned belongs to the correct setion
+ (and that the last [random] symbol from the previous section
+ isn't returned) try to find the section containing PC. First try
+ the overlay code (which by default returns NULL); and second try
+ the normal section code (which almost always succeeds). */
+ section = find_pc_overlay (addr);
+ if (section == NULL)
+ section = find_pc_section (addr);
/* First try to find the address in the symbol table, then
in the minsyms. Take the closest one. */

111
SOURCES/gdb-6.3-ppc64syscall-20040622.patch

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
2004-06-22 Andrew Cagney <cagney@gnu.org>

* rs6000-tdep.c (struct rs6000_framedata): Add field "func_start".
(skip_prologue): Delete local variable "orig_pc", use
"func_start". Add local variable "num_skip_linux_syscall_insn",
use to skip over first half of a GNU/Linux syscall and update
"func_start".

Index: gdb-7.2.50.20110117/gdb/rs6000-tdep.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/rs6000-tdep.c 2011-01-11 20:23:02.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/rs6000-tdep.c 2011-01-17 15:48:19.000000000 +0100
@@ -126,6 +126,7 @@ static const char *powerpc_vector_abi_st
struct rs6000_framedata
{
+ CORE_ADDR func_start; /* True function start. */
int offset; /* total size of frame --- the distance
by which we decrement sp to allocate
the frame */
@@ -1496,7 +1497,6 @@ static CORE_ADDR
skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
struct rs6000_framedata *fdata)
{
- CORE_ADDR orig_pc = pc;
CORE_ADDR last_prologue_pc = pc;
CORE_ADDR li_found_pc = 0;
gdb_byte buf[4];
@@ -1514,12 +1514,14 @@ skip_prologue (struct gdbarch *gdbarch,
int minimal_toc_loaded = 0;
int prev_insn_was_prologue_insn = 1;
int num_skip_non_prologue_insns = 0;
+ int num_skip_ppc64_gnu_linux_syscall_insn = 0;
int r0_contains_arg = 0;
const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
memset (fdata, 0, sizeof (struct rs6000_framedata));
+ fdata->func_start = pc;
fdata->saved_gpr = -1;
fdata->saved_fpr = -1;
fdata->saved_vr = -1;
@@ -1553,6 +1555,55 @@ skip_prologue (struct gdbarch *gdbarch,
break;
op = extract_unsigned_integer (buf, 4, byte_order);
+ /* A PPC64 GNU/Linux system call function is split into two
+ sub-functions: a non-threaded fast-path (__NAME_nocancel)
+ which does not use a frame; and a threaded slow-path
+ (Lpseudo_cancel) that does create a frame. Ref:
+ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+
+ *INDENT-OFF*
+ NAME:
+ SINGLE_THREAD_P
+ bne- .Lpseudo_cancel
+ __NAME_nocancel:
+ li r0,162
+ sc
+ bnslr+
+ b 0x7fe014ef64 <.__syscall_error>
+ Lpseudo_cancel:
+ stdu r1,-128(r1)
+ ...
+ *INDENT-ON*
+
+ Unfortunatly, because the latter case uses a local label (not
+ in the symbol table) a PC in "Lpseudo_cancel" appears to be
+ in "__NAME_nocancel". The following code recognizes this,
+ adjusting FUNC_START to point to where "Lpseudo_cancel"
+ should be, and parsing the prologue sequence as if
+ "Lpseudo_cancel" was the entry point. */
+
+ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */
+ && pc == fdata->func_start + 0
+ && num_skip_ppc64_gnu_linux_syscall_insn == 0)
+ || (op == 0x44000002 /* sc */
+ && pc == fdata->func_start + 4
+ && num_skip_ppc64_gnu_linux_syscall_insn == 1)
+ || (op == 0x4ca30020 /* bnslr+ */
+ && pc == fdata->func_start + 8
+ && num_skip_ppc64_gnu_linux_syscall_insn == 2))
+ {
+ num_skip_ppc64_gnu_linux_syscall_insn++;
+ continue;
+ }
+ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */
+ && pc == fdata->func_start + 12
+ && num_skip_ppc64_gnu_linux_syscall_insn == 3)
+ {
+ num_skip_ppc64_gnu_linux_syscall_insn = -1;
+ fdata->func_start = pc;
+ continue;
+ }
+
if ((op & 0xfc1fffff) == 0x7c0802a6)
{ /* mflr Rx */
/* Since shared library / PIC code, which needs to get its
@@ -1734,9 +1785,9 @@ skip_prologue (struct gdbarch *gdbarch,
we have no line table information or the line info tells
us that the subroutine call is not part of the line
associated with the prologue. */
- if ((pc - orig_pc) > 8)
+ if ((pc - fdata->func_start) > 8)
{
- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
+ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0);
struct symtab_and_line this_sal = find_pc_line (pc, 0);
if ((prologue_sal.line == 0)

98
SOURCES/gdb-6.3-readnever-20050907.patch

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
2004-11-18 Andrew Cagney <cagney@gnu.org>

* 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 <cagney@gnu.org>

* 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 <fcntl.h>
#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 *);

22
SOURCES/gdb-6.3-rh-dummykfail-20041202.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
2003-07-11 Elena Zannoni <ezannoni@redhat.com>

* 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
#

103
SOURCES/gdb-6.3-rh-testlibunwind-20041202.patch

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
2003-11-17 Elena Zannoni <ezannoni@redhat.com>
From Jeff Johnston <jjohnstn@redhat.com>
* gdb.arch/ia64-libunwind.exp: New file.
* gdb.arch/ia64-libunwind.c: New file.

2004-08-03 Jeff Johnston <jjohnstn@redhat.com>
* 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 <jan.kratochvil@redhat.com>

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 <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+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
+ }
+}

19
SOURCES/gdb-6.3-rh-testversion-20041202.patch

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
2003-02-24 Elena Zannoni <ezannoni@redhat.com>

* 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

239
SOURCES/gdb-6.3-test-dtorfix-20050121.patch

@ -0,0 +1,239 @@ @@ -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"

95
SOURCES/gdb-6.3-test-movedir-20050125.patch

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
2005-01-25 Elena Zannoni <ezannoni@redhat.com>

* 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 <stdio.h>
+#include <stdlib.h>
+#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 <stdlib.h>
+
+void other() {
+ const char* ostring = "other";
+ printf ("%s\n", ostring);;
+}
+

2085
SOURCES/gdb-6.3-test-pie-20050107.patch

File diff suppressed because it is too large Load Diff

101
SOURCES/gdb-6.3-test-self-20050110.patch

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
2004-02-23 Elena Zannoni <ezannoni@redhat.com>

* 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"

246
SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch

@ -0,0 +1,246 @@ @@ -0,0 +1,246 @@
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>

* 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 <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+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
+}

930
SOURCES/gdb-6.5-BEA-testsuite.patch

@ -0,0 +1,930 @@ @@ -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 <signal handler called>
+ * #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 <signal handler called>
+ * #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 <signal handler called>
+ * #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 <signal handler called>
+ * #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 <pthread.h>
+#include <signal.h>
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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 \<name of threadcrash binary\> [\<gdb binary\> \<args...\>]
+ 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 <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $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 <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+run
+gcore
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > /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 <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $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 <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+set width 0
+run
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > $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 \<name of threadcrash binary\>
+ 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 <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $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 <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+run
+gcore
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > /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 <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $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 <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+set width 0
+run
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $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

120
SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921

It is duplicite to its upstream variant:
http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>

* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.

------------------------------------------------------------------------------

2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
gdb.dwarf2/dw2-included.h: New files.

--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include "dw2-included.h"
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.exp 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,47 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on targets which support DWARF-2.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-included"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+gdb_test "list integer" "int integer;\r"
+gdb_test "ptype integer" "type = int\r"
+# Path varies depending on the build location.
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\nint integer;\r"
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.h 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+int integer;

258
SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch

@ -0,0 +1,258 @@ @@ -0,0 +1,258 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337

2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>

Port to GDB-6.8pre.

currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
will get:
(gdb) p errno
[some error]

* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
compiled to "(*__errno_location ())" and the macro definition is not present.
Unfortunately gdb will find the TLS symbol and it will try to access it but
as the program has been compiled without -lpthread the TLS base register
(%gs on i386) is not setup and it will result in:
Cannot access memory at address 0x8

Attached suggestion patch how to deal with the most common "errno" symbol
for the most common under-ggdb3 compiled programs.

Original patch hooked into target_translate_tls_address. But its inferior
call invalidates `struct frame *' in the callers - RH BZ 690908.

https://bugzilla.redhat.com/show_bug.cgi?id=1166549


2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>

* ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.

glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location

Index: gdb-7.8.1/gdb/printcmd.c
===================================================================
--- gdb-7.8.1.orig/gdb/printcmd.c 2014-11-21 19:05:44.699959209 +0100
+++ gdb-7.8.1/gdb/printcmd.c 2014-11-21 19:05:44.868959291 +0100
@@ -968,6 +968,10 @@ print_command_1 (char *exp, int voidprin
if (exp && *exp)
{
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */
+ if (target_has_execution && 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.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2014-11-21 19:05:44.869959291 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2014-11-21 19:05:44.869959291 +0100
@@ -0,0 +1,60 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile dw2-errno
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc prep {} {
+ global srcdir subdir binfile
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ runto_main
+
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
+ gdb_continue_to_breakpoint "breakpoint"
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
+
+# TODO: Test the error on resolving ERRNO with only libc loaded.
+# Just how to find the current libc filename?
Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.c 2014-11-21 19:05:44.869959291 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp 2014-11-21 19:13:01.553171326 +0100
@@ -0,0 +1,71 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile dw2-errno2
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc prep { message {do_xfail 0} } { with_test_prefix $message {
+ global srcdir subdir binfile variant
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}${variant}
+
+ runto_main
+
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
+ gdb_continue_to_breakpoint "breakpoint"
+
+ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant"
+
+ gdb_test "print errno" ".* = 42"
+
+ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y"
+ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file"
+ if $do_xfail {
+ setup_xfail "*-*-*"
+ }
+ gdb_test "print errno" ".* = 42" "print errno for core"
+}}
+
+set variant g2thrN
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep "macros=N threads=N" 1
+
+set variant g3thrN
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep "macros=Y threads=N" 1
+
+set variant g2thrY
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
+ return -1
+}
+prep "macros=N threads=Y"
+
+set variant g3thrY
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
+ return -1
+}
+prep "macros=Y threads=Y" 1
+
+# TODO: Test the error on resolving ERRNO with only libc loaded.
+# Just how to find the current libc filename?

28
SOURCES/gdb-6.5-bz190810-gdbserver-arch-advice.patch

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=190810


2006-09-26 Jan Kratochvil <jan.kratochvil@redhat.com>

* remote.c (remote_wait): Suggestion on crash due to nonmatching target.
(remote_async_wait): Likewise.


Index: gdb-6.8.50.20090818/gdb/remote.c
===================================================================
--- gdb-6.8.50.20090818.orig/gdb/remote.c 2009-08-18 21:00:35.000000000 +0200
+++ gdb-6.8.50.20090818/gdb/remote.c 2009-08-18 21:04:46.000000000 +0200
@@ -4408,8 +4408,13 @@ Packet: '%s'\n"),
VEC_safe_push (cached_reg_t, event->regcache, &cached_reg);
}
+ /* It may also occur on amd64 which defaults to 32-bit i386
+ target. gdbserver(1) is not aware of the `set architecture'
+ name itself as it is not using libbfd. */
if (*p != ';')
- error (_("Remote register badly formatted: %s\nhere: %s"),
+ error (_("Remote register badly formatted: %s\nhere: %s"
+ "\nTry to load the executable by `file' first,"
+ "\nyou may also check `set/show architecture'."),
buf, p);
++p;
}

17
SOURCES/gdb-6.5-bz203661-emit-relocs.patch

@ -0,0 +1,17 @@ @@ -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)

450
SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch

@ -0,0 +1,450 @@ @@ -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 <jan.kratochvil@redhat.com>

* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
(LINUX_CLONE_LEN): New definition.
(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
(amd64_linux_init_abi): Initialize `outermost_frame_p'.
* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.

2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
New file.

2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>

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 <pthread.h>
+#include <unistd.h>
+#include <assert.h>
+
+
+void *threader (void *arg)
+{
+ assert (0);
+ return NULL;
+}
+
+int main (void)
+{
+ pthread_t t1;
+
+ pthread_create (&t1, NULL, threader, (void *) NULL);
+ for (;;)
+ pause();
+}
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"
+ }
+}

91
SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch

@ -0,0 +1,91 @@ @@ -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 <stdio.h>
+
+int main (void)
+{
+ puts ("hello world");
+ return 0;
+}

21
SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch

@ -0,0 +1,21 @@ @@ -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);
}

79
SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch

@ -0,0 +1,79 @@ @@ -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
+}

139
SOURCES/gdb-6.5-gcore-buffer-limit-test.patch

@ -0,0 +1,139 @@ @@ -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 <unistd.h>
+#include <stdlib.h>
+
+#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

120
SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch

@ -0,0 +1,120 @@ @@ -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 <unistd.h>
+
+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
+ }
+}

56
SOURCES/gdb-6.5-last-address-space-byte-test.patch

@ -0,0 +1,56 @@ @@ -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}

83
SOURCES/gdb-6.5-missed-trap-on-step-test.patch

@ -0,0 +1,83 @@ @@ -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;
+}

136
SOURCES/gdb-6.5-readline-long-line-crash-test.patch

@ -0,0 +1,136 @@ @@ -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 <jan.kratochvil@redhat.com>
+
+# 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

111
SOURCES/gdb-6.5-section-num-fixup-test.patch

@ -0,0 +1,111 @@ @@ -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"

171
SOURCES/gdb-6.5-sharedlibrary-path.patch

@ -0,0 +1,171 @@ @@ -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 <jan.kratochvil@redhat.com>

* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
requested pathnames to the internal loaded relative pathnames.

2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>

Port to GDB-6.7.

2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>

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"
+}

119
SOURCES/gdb-6.6-bfd-vdso8k.patch

@ -0,0 +1,119 @@ @@ -0,0 +1,119 @@
2007-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>

* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
check for its aligned size between the last segment and still before
the section header end. Added variables check to cover also the
section header string table.

--- gdb-7.4.50.20120120-orig/bfd/elfcode.h 2012-02-29 09:17:08.000000000 +0100
+++ gdb-7.4.50.20120120/bfd/elfcode.h 2012-02-29 10:23:03.000000000 +0100
@@ -1621,6 +1621,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
Elf_External_Phdr *x_phdrs;
Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ Elf_External_Shdr *x_shdrs;
+ Elf_Internal_Shdr *i_shdrs;
bfd *nbfd;
struct bfd_in_memory *bim;
int contents_size;
@@ -1740,24 +1742,46 @@ NAME(_bfd_elf,bfd_from_remote_memory)
/* Trim the last segment so we don't bother with zeros in the last page
that are off the end of the file. However, if the extra bit in that
- page includes the section headers, keep them. */
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ page includes the section headers os the section header string table,
+ keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+
+ if ((bfd_vma) contents_size < i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+
+ /* Verify also all the sections fit into CONTENTS_SIZE. */
+
+ x_shdrs = bfd_malloc (i_ehdr.e_shnum * (sizeof *x_shdrs + sizeof *i_shdrs));
+ if (x_shdrs == NULL)
{
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
}
+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff, (bfd_byte *) x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+ if (err)
+ i_shdrs = NULL;
else
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ {
+ i_shdrs = (Elf_Internal_Shdr *) &x_shdrs[i_ehdr.e_shnum];
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ elf_swap_shdr_in (templ, &x_shdrs[i], &i_shdrs[i]);
+
+ if ((bfd_vma) contents_size < i_shdrs[i].sh_offset + i_shdrs[i].sh_size)
+ contents_size = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+ }
+ }
/* Now we know the size of the whole image we want read in. */
contents = (bfd_byte *) bfd_zmalloc (contents_size);
if (contents == NULL)
{
free (x_phdrs);
+ free (x_shdrs);
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@@ -1776,6 +1800,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
if (err)
{
free (x_phdrs);
+ free (x_shdrs);
free (contents);
bfd_set_error (bfd_error_system_call);
errno = err;
@@ -1784,10 +1809,32 @@ NAME(_bfd_elf,bfd_from_remote_memory)
}
free (x_phdrs);
- /* If the segments visible in memory didn't include the section headers,
+ if (i_shdrs)
+ {
+ memcpy (contents + i_ehdr.e_shoff, x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ bfd_vma start = i_shdrs[i].sh_offset;
+ bfd_vma end = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+
+ if (end > (bfd_vma) contents_size)
+ end = contents_size;
+ err = target_read_memory (ehdr_vma + start, contents + start,
+ end - start);
+ if (err)
+ {
+ i_shdrs = NULL;
+ break;
+ }
+ }
+ }
+ free (x_shdrs);
+
+ /* If the segments readable in memory didn't include the section headers,
then clear them from the file header. */
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ if (i_shdrs == NULL)
{
memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);

196
SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch

@ -0,0 +1,196 @@ @@ -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 <jan.kratochvil@redhat.com>

* exceptions.h (enum errors <IS_CORE_ERROR>): New.
* exec.c: Include exceptions.h.
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
* main.c (exec_or_core_file_attach): New.
(captured_main <optind < argc>): Set also corearg.
(captured_main <strcmp (execarg, symarg) == 0>): 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 <dje@google.com>

* 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 <fcntl.h>
#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);
}

36
SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch

@ -0,0 +1,36 @@ @@ -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 <dlfcn.h>
#endif
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
+ librpm must not exit() an application on SIGINT
+
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
+int
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
+{
+ return 0;
+}
+
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
and avoid their duplicities during a single inferior run. */
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;
};

105
SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch

@ -0,0 +1,105 @@ @@ -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);

1476
SOURCES/gdb-6.6-buildid-locate-rpm.patch

File diff suppressed because it is too large Load Diff

59
SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch

@ -0,0 +1,59 @@ @@ -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);

1124
SOURCES/gdb-6.6-buildid-locate.patch

File diff suppressed because it is too large Load Diff

171
SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch

@ -0,0 +1,171 @@ @@ -0,0 +1,171 @@
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb_gcore.sh: Redirect GDB from `</dev/null'.

2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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 <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+
+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} <gcore command> <core output file>\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 <jan.kratochvil@redhat.com>.
+# 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"

87
SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch

@ -0,0 +1,87 @@ @@ -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 */

121
SOURCES/gdb-6.6-bz235197-fork-detach-info.patch

@ -0,0 +1,121 @@ @@ -0,0 +1,121 @@
2008-03-01 Jan Kratochvil <jan.kratochvil@redhat.com>

Port to GDB-6.8pre.
Remove the `[' character from the GDB-6.8 default message.

Index: gdb-7.2.50.20110320/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/linux-nat.c 2011-03-20 16:59:51.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/linux-nat.c 2011-03-20 16:59:51.000000000 +0100
@@ -716,7 +716,7 @@ holding the child stopped. Try \"set de
remove_breakpoints_pid (GET_PID (inferior_ptid));
}
- if (info_verbose || debug_linux_nat)
+ if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat)
{
target_terminal_ours ();
fprintf_filtered (gdb_stdlog,
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c 2011-03-20 16:59:51.000000000 +0100
@@ -0,0 +1,57 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <assert.h>
+#include <stdlib.h>
+
+static void func (void)
+{
+}
+
+int main (void)
+{
+ pid_t child;
+
+ child = fork ();
+ switch (child)
+ {
+ case -1:
+ abort ();
+ case 0:
+ func ();
+ break;
+ default:
+ {
+/* We do not test the switching to the other fork by GDB `fork 1'. */
+#if 0
+ pid_t got;
+
+ got = waitpid (child, NULL, 0);
+ assert (got == child);
+#endif
+ break;
+ }
+ }
+ return 0;
+}
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp 2011-03-20 17:12:22.000000000 +0100
@@ -0,0 +1,36 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile fork-detach
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_run_cmd
+# `Starting program: .*' prefix is available since gdb-6.7.
+gdb_test "" \
+ "Detaching after fork from child process.*\\\[Inferior .* exited normally\\\]" \
+ "Info message caught"

270
SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch

@ -0,0 +1,270 @@ @@ -0,0 +1,270 @@
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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 <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+#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"

62
SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch

@ -0,0 +1,62 @@ @@ -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\")?" \

205
SOURCES/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch

@ -0,0 +1,205 @@ @@ -0,0 +1,205 @@
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>

* inferior.h (enum resume_step): New definition.
(resume): Change STEP parameter type to ENUM RESUME_STEP.
* infrun.c (resume): Likewise. Extend debug printing of the STEP
parameter. Lock the scheduler only for intentional stepping.
(proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
(currently_stepping): Change the return type to ENUM RESUME_STEP.
Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
* linux-nat.c (select_singlestep_lwp_callback): Do not focus on
the software watchpoint events.
* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.

2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>

* infrun.c (proceed): RESUME_STEP initialized for non-stepping.
RESUME_STEP set according to STEP only at the end of the function.

2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>

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. */

26
SOURCES/gdb-6.6-testsuite-timeouts.patch

@ -0,0 +1,26 @@ @@ -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
# <return> 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
# <return> to continue" prompts.
gdb_test_no_output "set height 0"

18
SOURCES/gdb-6.6-threads-static-test.patch

@ -0,0 +1,18 @@ @@ -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" {

703
SOURCES/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch

@ -0,0 +1,703 @@ @@ -0,0 +1,703 @@
http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html

2007-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.arch/i386-interface.S, gdb.arch/i386-interface.exp: New files.

2008-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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 <http://www.gnu.org/licenses/>.
+
+ 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 "<init>"
+ .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 "<init>"
+ .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 <http://www.gnu.org/licenses/>.
+
+# 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
+ }
+}

118
SOURCES/gdb-6.7-charsign-test.patch

@ -0,0 +1,118 @@ @@ -0,0 +1,118 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128

2007-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.base/charsign.exp, gdb.base/charsign.c: New files.
[ stripped ]

2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>

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}

96
SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
2007-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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 <luisgpm@br.ibm.com>

* 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=<value optimized out>.*operand1=<value optimized out>.*" \
+ "Check value of call clobbered registers"

108
SOURCES/gdb-6.7-testsuite-stable-results.patch

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
gdb/testsuite/gdb.base/fileio.c:
gdb/testsuite/gdb.base/fileio.exp:
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>

* 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

152
SOURCES/gdb-6.8-attach-signalled-detach-stopped.patch

@ -0,0 +1,152 @@ @@ -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" {

25
SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch

@ -0,0 +1,25 @@ @@ -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."));

173
SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch

@ -0,0 +1,173 @@ @@ -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 <stddef.h>
-#include <pthread.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
+#include <stdio.h>
+#ifdef THREADS
+
+# include <pthread.h>
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 <non-threaded> <threaded> <phase>\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 $" {

105
SOURCES/gdb-6.8-bz457187-largefile-test.patch

@ -0,0 +1,105 @@ @@ -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<(%<V`.32$`JU["
+/G`68?\7<D4X4)`0,$?,`
+`
+end

473
SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch

@ -0,0 +1,473 @@ @@ -0,0 +1,473 @@
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).

Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp 2009-09-09 20:10:35.000000000 +0200
@@ -0,0 +1,102 @@
+# 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.
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on i386/x86_64 targets which support DWARF-2.
+# For now pick a sampling of likely targets.
+if {(![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*])
+ || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
+ return 0
+}
+
+set testfile "dw2-loclist-prelinked"
+set srcfuncfile ${testfile}-func.S
+set binsharedfuncfile ${objdir}/${subdir}/${testfile}.so
+set srcmainfile ${testfile}-main.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+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_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
+ untested "Couldn't compile test library"
+ return -1
+}
+
+# The new separate debug info file will be stored in the .debug subdirectory.
+
+if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
+ # check that you have a recent version of strip and objcopy installed
+ unsupported "cannot produce separate debug info files"
+ return -1
+}
+
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
+ # Maybe we don't have prelink.
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
+ "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_run_cmd
+
+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
+
+# Incorrect:
+# #0 0x00110430 in __kernel_vsyscall ()
+# No symbol table info available.
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
+# No symbol table info available.
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
+# No symbol table info available.
+# #3 0x44f10437 in func () at dw2-loclist-prelinked.c:8
+# i = Could not find the frame base for "func".
+
+# Correct:
+# #0 0x00110430 in __kernel_vsyscall ()
+# No symbol table info available.
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
+# No symbol table info available.
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
+# No symbol table info available.
+# #3 0x4ae36437 in func () at dw2-loclist-prelinked.c:8
+# i = 3827288
+# #4 0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
+# No locals.
+
+# `abort' can get expressed as `*__GI_abort'.
+gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c 2009-09-09 20:10:35.000000000 +0200
@@ -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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* 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 <http://www.gnu.org/licenses/>. */
+
+/*
+#include <stdlib.h>
+
+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

74
SOURCES/gdb-6.8-quit-never-aborts.patch

@ -0,0 +1,74 @@ @@ -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 ();
}

12
SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch

@ -0,0 +1,12 @@ @@ -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)

78
SOURCES/gdb-6.8-watchpoint-conditionals-test.patch

@ -0,0 +1,78 @@ @@ -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 <http://www.gnu.org/licenses/>.
+
+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 <http://www.gnu.org/licenses/>.
+
+ 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;
+}

51
SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch

@ -0,0 +1,51 @@ @@ -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 <zlib.h>
#endif
+#ifndef __sparc__
#ifdef HAVE_MMAP
#include <sys/mman.h>
#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. */

85
SOURCES/gdb-archer-next-over-throw-cxx-exec.patch

@ -0,0 +1,85 @@ @@ -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 <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+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 <http://www.gnu.org/licenses/>.
+
+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 <null> on older GDBs.
+gdb_test "info threads" "info threads" "program finished"

83
SOURCES/gdb-archer-pie-addons-keep-disabled.patch

@ -0,0 +1,83 @@ @@ -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;
}

82
SOURCES/gdb-archer-pie-addons.patch

@ -0,0 +1,82 @@ @@ -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:
{

8489
SOURCES/gdb-archer.patch

File diff suppressed because it is too large Load Diff

245
SOURCES/gdb-attach-fail-reasons-5of5.patch

@ -0,0 +1,245 @@ @@ -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 <jan.kratochvil@redhat.com>

* 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 <selinux/selinux.h>
+#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

186
SOURCES/gdb-attach-fail-reasons-5of5configure.patch

@ -0,0 +1,186 @@ @@ -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 <libunwind-ia64.h> 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 <selinux/selinux.h> 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 <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
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
+
+

234
SOURCES/gdb-bare-DW_TAG_lexical_block-1of2.patch

@ -0,0 +1,234 @@ @@ -0,0 +1,234 @@
From 3a2b436ae9958a1029545c03201b7223ff33c150 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon, 30 May 2016 14:11:43 +0200
Subject: [PATCH 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum

Make the code (maybe) more readable + primarily prepare it for [patch 2/2]
enum extension.

This change should have no code change impact.

gdb/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>

Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
* dwarf2read.c (enum pc_bounds_kind) New.
(dwarf2_get_pc_bounds): Use it in the declaration.
(process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
to cu_bounds_kind.
(read_func_scope, read_lexical_block_scope, read_call_site_scope):
Adjust callers.
(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
---
gdb/ChangeLog | 12 ++++++++++
gdb/dwarf2read.c | 71 ++++++++++++++++++++++++++++++++++++--------------------
2 files changed, 58 insertions(+), 25 deletions(-)

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,15 @@
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
+ * dwarf2read.c (enum pc_bounds_kind) New.
+ (dwarf2_get_pc_bounds): Use it in the declaration.
+ (process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
+ to cu_bounds_kind.
+ (read_func_scope, read_lexical_block_scope, read_call_site_scope):
+ Adjust callers.
+ (dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
+
2016-05-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (QCatchSyscalls): Remove the parameter. Include ...
Index: gdb-7.6.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.6.1.orig/gdb/dwarf2read.c 2016-05-30 15:06:34.709331070 +0200
+++ gdb-7.6.1/gdb/dwarf2read.c 2016-05-30 15:06:39.950377045 +0200
@@ -1485,9 +1485,25 @@
static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
struct dwarf2_cu *, struct partial_symtab *);
-static int dwarf2_get_pc_bounds (struct die_info *,
- CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
- struct partial_symtab *);
+/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
+ values. */
+enum pc_bounds_kind
+{
+ /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+ was found. */
+ PC_BOUNDS_NOT_PRESENT,
+
+ /* Discontiguous range was found - that is DW_AT_ranges was found. */
+ PC_BOUNDS_RANGES,
+
+ /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found. */
+ PC_BOUNDS_HIGH_LOW,
+};
+
+static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
+ CORE_ADDR *, CORE_ADDR *,
+ struct dwarf2_cu *,
+ struct partial_symtab *);
static void get_scope_pc_bounds (struct die_info *,
CORE_ADDR *, CORE_ADDR *,
@@ -4953,7 +4969,7 @@
CORE_ADDR baseaddr;
CORE_ADDR best_lowpc = 0, best_highpc = 0;
struct partial_symtab *pst;
- int has_pc_info;
+ enum pc_bounds_kind cu_bounds_kind;
const char *filename;
int *want_partial_unit_ptr = data;
@@ -4988,9 +5004,9 @@
/* Possibly set the default values of LOWPC and HIGHPC from
`DW_AT_ranges'. */
- has_pc_info = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
- &best_highpc, cu, pst);
- if (has_pc_info == 1 && best_lowpc < best_highpc)
+ cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
+ &best_highpc, cu, pst);
+ if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
/* Store the contiguous range if it is not empty; it can be empty for
CUs with no code. */
addrmap_set_empty (objfile->psymtabs_addrmap,
@@ -5011,7 +5027,7 @@
first_die = load_partial_dies (reader, info_ptr, 1);
scan_partial_symbols (first_die, &lowpc, &highpc,
- ! has_pc_info, cu);
+ cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
/* If we didn't find a lowpc, set it to highpc to avoid
complaints from `maint check'. */
@@ -5020,7 +5036,7 @@
/* If the compilation unit didn't have an explicit address range,
then use the information extracted from its child dies. */
- if (! has_pc_info)
+ if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
{
best_lowpc = lowpc;
best_highpc = highpc;
@@ -9589,7 +9605,8 @@
}
/* Ignore functions with missing or invalid low and high pc attributes. */
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
{
attr = dwarf2_attr (die, DW_AT_external, cu);
if (!attr || !DW_UNSND (attr))
@@ -9746,7 +9763,8 @@
as multiple lexical blocks? Handling children in a sane way would
be nasty. Might be easier to properly extend generic blocks to
describe ranges. */
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
return;
lowpc += baseaddr;
highpc += baseaddr;
@@ -9951,7 +9969,8 @@
CORE_ADDR lowpc;
/* DW_AT_entry_pc should be preferred. */
- if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
+ if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
complaint (&symfile_complaints,
_("DW_AT_GNU_call_site_target target DIE has invalid "
"low pc, for referencing DIE 0x%x [in module %s]"),
@@ -10228,11 +10247,11 @@
return 1;
}
-/* Get low and high pc attributes from a die. Return 1 if the attributes
- are present and valid, otherwise, return 0. Return -1 if the range is
- discontinuous, i.e. derived from DW_AT_ranges information. */
+/* Get low and high pc attributes from a die. See enum pc_bounds_kind
+ definition for the return value. *LOWPC and *HIGHPC are set iff
+ PC_BOUNDS_NOT_PRESENT is not returned. */
-static int
+static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR *highpc, struct dwarf2_cu *cu,
struct partial_symtab *pst)
@@ -10241,7 +10260,7 @@
struct attribute *attr_high;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
- int ret = 0;
+ enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
if (attr_high)
@@ -10258,10 +10277,10 @@
}
else
/* Found high w/o low attribute. */
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* Found consecutive range of addresses. */
- ret = 1;
+ ret = PC_BOUNDS_HIGH_LOW;
}
else
{
@@ -10280,15 +10299,15 @@
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* Found discontinuous range of addresses. */
- ret = -1;
+ ret = PC_BOUNDS_RANGES;
}
}
/* read_partial_die has also the strict LOW < HIGH requirement. */
if (high <= low)
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* When using the GNU linker, .gnu.linkonce. sections are used to
eliminate duplicate copies of functions and vtables and such.
@@ -10299,7 +10318,7 @@
If this is a discarded function, mark the pc bounds as invalid,
so that GDB will ignore it. */
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
*lowpc = low;
if (highpc)
@@ -10320,7 +10339,8 @@
CORE_ADDR low, high;
struct die_info *child = die->child;
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
+ != PC_BOUNDS_NOT_PRESENT)
{
*lowpc = min (*lowpc, low);
*highpc = max (*highpc, high);
@@ -10357,7 +10377,8 @@
CORE_ADDR best_high = (CORE_ADDR) 0;
CORE_ADDR current_low, current_high;
- if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
+ != PC_BOUNDS_NOT_PRESENT)
{
best_low = current_low;
best_high = current_high;

371
SOURCES/gdb-bare-DW_TAG_lexical_block-2of2.patch

@ -0,0 +1,371 @@ @@ -0,0 +1,371 @@
From e385593eef98ac92be57159e141f4b805dadbbb3 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon, 30 May 2016 14:14:43 +0200
Subject: [PATCH 2/2] PR 15231: import bare DW_TAG_lexical_block

Local variables in lambdas are not accessible
https://sourceware.org/bugzilla/show_bug.cgi?id=15231

GDB: read_lexical_block_scope
/* Ignore blocks with missing or invalid low and high pc attributes. */
[...]
if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
return;

But sometimes there is:

FAIL: gcc-5.3.1-6.fc23.x86_64
<2><92>: Abbrev Number: 11 (DW_TAG_lexical_block)
<3><9c>: Abbrev Number: 13 (DW_TAG_structure_type)
<9d> DW_AT_name : (indirect string, offset: 0x3c): <lambda()>
[...]

Where DW_TAG_lexical_block has no attributes. Such whole subtree is currently
dropped by GDB while I think it should just import all its children DIEs.

It even XFAIL->XPASSes gdb.ada/out_of_line_in_inlined.exp:
commit 0fa7fe506c242b459c4c05d331e7c7d66fb52390
Author: Joel Brobecker <brobecker@adacore.com>
out of line functions nested inside inline functions.
So I have removed that xfail.

gdb/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>

PR c++/15231
* dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
(process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
(read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
(read_call_site_scope): Adjust callers.
(dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.

gdb/testsuite/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>

PR c++/15231
* gdb.ada/out_of_line_in_inlined.exp: Remove xfails.
* gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
---
gdb/ChangeLog | 10 ++++
gdb/dwarf2read.c | 53 ++++++++++------
gdb/testsuite/ChangeLog | 6 ++
gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 6 --
.../gdb.dwarf2/dw2-lexical-block-bare.exp | 70 ++++++++++++++++++++++
5 files changed, 120 insertions(+), 25 deletions(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,15 @@
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+ PR c++/15231
+ * dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
+ (process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
+ (read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
+ (read_call_site_scope): Adjust callers.
+ (dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
+
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
* dwarf2read.c (enum pc_bounds_kind) New.
(dwarf2_get_pc_bounds): Use it in the declaration.
Index: gdb-7.6.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.6.1.orig/gdb/dwarf2read.c 2016-05-30 15:07:34.285853679 +0200
+++ gdb-7.6.1/gdb/dwarf2read.c 2016-05-30 15:08:13.485197538 +0200
@@ -1486,13 +1486,16 @@
struct dwarf2_cu *, struct partial_symtab *);
/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
- values. */
+ values. Keep the items ordered with increasing constraints compliance. */
enum pc_bounds_kind
{
- /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
- was found. */
+ /* No attribute DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges was found. */
PC_BOUNDS_NOT_PRESENT,
+ /* Some of the attributes DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+ were present but they do not form a valid range of PC addresses. */
+ PC_BOUNDS_INVALID,
+
/* Discontiguous range was found - that is DW_AT_ranges was found. */
PC_BOUNDS_RANGES,
@@ -5027,7 +5030,7 @@
first_die = load_partial_dies (reader, info_ptr, 1);
scan_partial_symbols (first_die, &lowpc, &highpc,
- cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
+ cu_bounds_kind <= PC_BOUNDS_INVALID, cu);
/* If we didn't find a lowpc, set it to highpc to avoid
complaints from `maint check'. */
@@ -5036,7 +5039,7 @@
/* If the compilation unit didn't have an explicit address range,
then use the information extracted from its child dies. */
- if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
+ if (cu_bounds_kind <= PC_BOUNDS_INVALID)
{
best_lowpc = lowpc;
best_highpc = highpc;
@@ -9606,7 +9609,7 @@
/* Ignore functions with missing or invalid low and high pc attributes. */
if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
+ <= PC_BOUNDS_INVALID)
{
attr = dwarf2_attr (die, DW_AT_external, cu);
if (!attr || !DW_UNSND (attr))
@@ -9763,9 +9766,20 @@
as multiple lexical blocks? Handling children in a sane way would
be nasty. Might be easier to properly extend generic blocks to
describe ranges. */
- if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
- return;
+ switch (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ {
+ case PC_BOUNDS_NOT_PRESENT:
+ /* DW_TAG_lexical_block has no attributes, process its children as if
+ there was no wrapping by that DW_TAG_lexical_block.
+ GCC does no longer produces such DWARF since GCC r224161. */
+ for (child_die = die->child;
+ child_die != NULL && child_die->tag;
+ child_die = sibling_die (child_die))
+ process_die (child_die, cu);
+ return;
+ case PC_BOUNDS_INVALID:
+ return;
+ }
lowpc += baseaddr;
highpc += baseaddr;
@@ -9970,7 +9984,7 @@
/* DW_AT_entry_pc should be preferred. */
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
+ <= PC_BOUNDS_INVALID)
complaint (&symfile_complaints,
_("DW_AT_GNU_call_site_target target DIE has invalid "
"low pc, for referencing DIE 0x%x [in module %s]"),
@@ -10249,7 +10263,7 @@
/* Get low and high pc attributes from a die. See enum pc_bounds_kind
definition for the return value. *LOWPC and *HIGHPC are set iff
- PC_BOUNDS_NOT_PRESENT is not returned. */
+ neither PC_BOUNDS_NOT_PRESENT nor PC_BOUNDS_INVALID are returned. */
static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
@@ -10260,7 +10274,7 @@
struct attribute *attr_high;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
- enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
+ enum pc_bounds_kind ret;
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
if (attr_high)
@@ -10277,7 +10291,7 @@
}
else
/* Found high w/o low attribute. */
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* Found consecutive range of addresses. */
ret = PC_BOUNDS_HIGH_LOW;
@@ -10299,15 +10313,17 @@
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* Found discontinuous range of addresses. */
ret = PC_BOUNDS_RANGES;
}
+ else
+ return PC_BOUNDS_NOT_PRESENT;
}
/* read_partial_die has also the strict LOW < HIGH requirement. */
if (high <= low)
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* When using the GNU linker, .gnu.linkonce. sections are used to
eliminate duplicate copies of functions and vtables and such.
@@ -10318,7 +10334,7 @@
If this is a discarded function, mark the pc bounds as invalid,
so that GDB will ignore it. */
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
*lowpc = low;
if (highpc)
@@ -10339,8 +10355,7 @@
CORE_ADDR low, high;
struct die_info *child = die->child;
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
- != PC_BOUNDS_NOT_PRESENT)
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL) >= PC_BOUNDS_RANGES)
{
*lowpc = min (*lowpc, low);
*highpc = max (*highpc, high);
@@ -10378,7 +10393,7 @@
CORE_ADDR current_low, current_high;
if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
- != PC_BOUNDS_NOT_PRESENT)
+ >= PC_BOUNDS_RANGES)
{
best_low = current_low;
best_high = current_high;
--- /dev/null 2016-05-30 15:04:01.916990766 +0200
+++ gdb-7.6.1/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp 2016-05-30 15:19:22.236042134 +0200
@@ -0,0 +1,32 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+standard_testfile .S main.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile2 $srcfile] {nodebug}] } {
+ return -1
+}
+
+runto_main
+
+# FAILing GDB did print: No symbol "testvar" in current context.
+gdb_test "p testvar" { = -?[0-9]+}
--- /dev/null 2016-05-30 15:04:01.916990766 +0200
+++ gdb-7.6.1/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.S 2016-05-30 15:17:42.580173290 +0200
@@ -0,0 +1,89 @@
+ .section .debug_info
+.Lcu1_begin:
+ .4byte .Lcu1_end - .Lcu1_start
+.Lcu1_start:
+ .2byte 4 /* Version */
+ .4byte .Labbrev1_begin /* Abbrevs */
+ .byte 4 /* Pointer size */
+ .uleb128 2 /* Abbrev (DW_TAG_compile_unit) */
+ .4byte main_label
+ .4byte main_label+0x10000
+.Llabel1:
+ .uleb128 3 /* Abbrev (DW_TAG_base_type) */
+ .sleb128 4
+ .sleb128 0x5
+ .ascii "integer\0"
+ .uleb128 4 /* Abbrev (DW_TAG_subprogram) */
+ .ascii "main\0"
+ .byte 1
+ .4byte main_label
+ .4byte main_label+0x10000
+ .uleb128 5 /* Abbrev (DW_TAG_lexical_block) */
+ .uleb128 6 /* Abbrev (DW_TAG_variable) */
+ .ascii "testvar\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+ .uleb128 .Lexpr_end3 - .Lexpr_start2/* expression */
+.Lexpr_start2:
+ .byte 0x03 /* DW_OP_addr */
+ .4byte main
+.Lexpr_end3:
+ .byte 0x0 /* Terminate children */
+ .byte 0x0 /* Terminate children */
+ .byte 0x0 /* Terminate children */
+.Lcu1_end:
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 2 /* Abbrev start */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 3 /* Abbrev start */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 4 /* Abbrev start */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 5 /* Abbrev start */
+ .uleb128 0x0b /* DW_TAG_lexical_block */
+ .byte 1 /* has_children */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 6 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x09 /* SPECIAL_expr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
diff -dup -rup gdb-7.6.1/gdb/testsuite/gdb.dwarf2/main.c gdb-7.6.1-orig/gdb/testsuite/gdb.dwarf2/main.c
--- gdb-7.6.1/gdb/testsuite/gdb.dwarf2/main.c 2013-01-01 07:41:22.000000000 +0100
+++ gdb-7.6.1-orig/gdb/testsuite/gdb.dwarf2/main.c 2017-03-08 22:20:21.085438961 +0100
@@ -20,5 +20,6 @@
int
main()
{
+ asm ("main_label: .globl main_label");
return 0;
}

209
SOURCES/gdb-bz1326476-attach-kills.patch

@ -0,0 +1,209 @@ @@ -0,0 +1,209 @@
http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html
Subject: [PATCH 1/3] Never kill PID on: gdb exec PID

Hi,

in some cases with deleted main executable GDB will want to kill the inferior.

$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
$ rm /tmp/sleep
$ gdb /tmp/sleep $p
GNU gdb (GDB) 7.10.50.20151016-cvs
/tmp/sleep: No such file or directory.
Attaching to process 9694
/tmp/sleep (deleted): No such file or directory.
A program is being debugged already. Kill it? (y or n) _

The first attachment of "/tmp/sleep" commandline argument errors at:

#0 throw_error (error=GENERIC_ERROR, fmt=0x116d135 "%s.") at ./common/common-exceptions.c:371
#1 in throw_perror_with_name (errcode=GENERIC_ERROR, string=0x7fffffffdb96 "/dfsfds") at utils.c:974
#2 in perror_with_name (string=0x7fffffffdb96 "/dfsfds") at utils.c:982
#3 in exec_file_attach (filename=0x7fffffffdb96 "/dfsfds", from_tty=1) at exec.c:268
267 if (scratch_chan < 0)
268 perror_with_name (filename);
#4 in catch_command_errors_const (command=0x80f59f <exec_file_attach>, arg=0x7fffffffdb96 "/dfsfds", from_tty=1) at main.c:395
#5 in captured_main (data=0x7fffffffd6f0) at main.c:1051
1051 if (catch_command_errors_const (exec_file_attach, execarg,
1052 !batch_flag))

Then GDB tries to attach to the process $p:

#0 inferior_appeared (inf=0x240e0b0, pid=29210) at inferior.c:305
#1 in inf_ptrace_attach (ops=0x2339540, args=0x21dcdc0 "29210", from_tty=1) at inf-ptrace.c:206
#2 in linux_nat_attach (ops=0x2339540, args=0x21dcdc0 "29210", from_tty=1) at linux-nat.c:1278
#3 in attach_command (args=0x21dcdc0 "29210", from_tty=1) at infcmd.c:2748
#4 in catch_command_errors (command=0x79d7e5 <attach_command>, arg=0x7fffffffdb9e "29210", from_tty=1) at main.c:368
#5 in captured_main (data=0x7fffffffd6f0) at main.c:1082
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)

This succeeds and since this moment GDB has a valid inferior. But despite that
the lines
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
still fail because consequently attach_command() fails to find the associated
executable file:

#0 throw_error (error=GENERIC_ERROR, fmt=0x116d135 "%s.") at ./common/common-exceptions.c:371
#1 in throw_perror_with_name (errcode=GENERIC_ERROR, string=0x2477860 "/tmp/sleep (deleted)") at utils.c:974
#2 in perror_with_name (string=0x2477860 "/tmp/sleep (deleted)") at utils.c:982
#3 in exec_file_attach (filename=0x2477860 "/tmp/sleep (deleted)", from_tty=1) at exec.c:268
267 if (scratch_chan < 0)
268 perror_with_name (filename);
#4 in exec_file_locate_attach (pid=29210, from_tty=1) at exec.c:173
#5 in attach_command_post_wait (args=0x24739b0 "29210", from_tty=1, async_exec=0) at infcmd.c:2628
#6 in attach_command_continuation (args=0x2473590, err=0) at infcmd.c:2700
#7 in do_my_continuations_1 (pmy_chain=0x7fffffffd190, err=0) at continuations.c:59
#8 in do_my_continuations (list=0x240e130, err=0) at continuations.c:83
#9 in do_all_inferior_continuations (err=0) at continuations.c:125
#10 in inferior_event_handler (event_type=INF_EXEC_COMPLETE, client_data=0x0) at inf-loop.c:60
#11 in fetch_inferior_event (client_data=0x0) at infrun.c:3929
#12 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at inf-loop.c:44
#13 in handle_target_event (error=0, client_data=0x0) at linux-nat.c:4681
#14 in handle_file_event (file_ptr=0x21e4170, ready_mask=1) at event-loop.c:708
#15 in gdb_wait_for_event (block=0) at event-loop.c:834
#16 in gdb_do_one_event () at event-loop.c:298
#17 in wait_sync_command_done () at top.c:373
#18 in maybe_wait_sync_command_done (was_sync=0) at top.c:388
#19 in catch_command_errors (command=0x79d7e5 <attach_command>, arg=0x7fffffffdb9e "29210", from_tty=1) at main.c:370
#20 in captured_main (data=0x7fffffffd6f0) at main.c:1082
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)

and therefore GDB executes the following:

(gdb) bt
#5 in query (ctlstr=0x1141ae8 "A program is being debugged already. Kill it? ") at utils.c:1371
#6 in target_preopen (from_tty=1) at target.c:2183
2179 if (have_inferiors ())
2180 {
2181 if (!from_tty
2182 || !have_live_inferiors ()
2183 || query (_("A program is being debugged already. Kill it? ")))
2184 iterate_over_inferiors (dispose_inferior, NULL);
2185 else
2186 error (_("Program not killed."));
2187 }
#7 in core_open (arg=0x7fffffffdb9f "9694", from_tty=1) at corelow.c:283
#8 in core_file_command (filename=0x7fffffffdb9f "9694", from_tty=1) at corefile.c:77
#9 in catch_command_errors (command=0x86ca16 <core_file_command>, arg=0x7fffffffdb9f "9694", from_tty=1) at main.c:368
#10 in captured_main (data=0x7fffffffd6f0) at main.c:1084
1084 catch_command_errors (core_file_command, pid_or_core_arg,
1085 !batch_flag);

No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.


Thanks,
Jan


gdb/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>

* main.c (captured_main): Run core_file_command for pid_or_core_arg
only if not have_inferiors ().

gdb/testsuite/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.base/attach-kills.c: New.
* gdb.base/attach-kills.exp: New.
---
gdb/testsuite/gdb.base/attach-kills.c | 25 ++++++++++++++++
gdb/testsuite/gdb.base/attach-kills.exp | 49 +++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/attach-kills.c
create mode 100644 gdb/testsuite/gdb.base/attach-kills.exp

Index: gdb-7.2/gdb/main.c
===================================================================
--- gdb-7.2.orig/gdb/main.c 2015-10-16 22:53:14.000000000 +0200
+++ gdb-7.2/gdb/main.c 2015-10-16 22:53:58.840722140 +0200
@@ -975,7 +975,10 @@ Can't attach to process and specify a co
if (isdigit (pid_or_core_arg[0]))
{
if (catch_command_errors (attach_command, pid_or_core_arg,
- !batch_flag, RETURN_MASK_ALL) == 0)
+ !batch_flag, RETURN_MASK_ALL) == 0
+ /* attach_command could succeed partially and core_file_command
+ would try to kill it. */
+ && !have_inferiors ())
catch_command_errors (core_file_command, pid_or_core_arg,
!batch_flag, RETURN_MASK_ALL);
}
Index: gdb-7.2/gdb/testsuite/gdb.base/attach-kills.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.base/attach-kills.c 2015-10-16 22:53:22.843486331 +0200
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+int
+main (void)
+{
+ sleep (600);
+ return 0;
+}
Index: gdb-7.2/gdb/testsuite/gdb.base/attach-kills.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.base/attach-kills.exp 2015-10-16 23:02:33.791095444 +0200
@@ -0,0 +1,39 @@
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile attach-kills
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [build_executable ${testfile}.exp $testfile] == -1 } {
+ 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 &]
+exec sleep 2
+
+remote_exec target "cp -pf -- $binfile $binfile-copy"
+remote_exec target "rm -f -- $binfile"
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "$GDBFLAGS /DoEsNoTeXySt $testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_test "info inferiors" " process \[0-9\].*"
+
+remote_exec build "kill -9 ${testpid}"

125
SOURCES/gdb-bz533176-fortran-omp-step.patch

@ -0,0 +1,125 @@ @@ -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 <http://www.gnu.org/licenses/>.
+
+set testfile "omp-step"
+set srcfile ${testfile}.f90
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
+ return -1
+}
+
+if ![runto [gdb_get_line_number "start-here"]] {
+ perror "Couldn't run to start-here"
+ return 0
+}
+
+gdb_test "next" {!\$omp parallel} "step closer"
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
+
+gdb_breakpoint [gdb_get_line_number "success"]
+gdb_continue_to_breakpoint "success" ".*success.*"
Index: gdb-7.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 <http://www.gnu.org/licenses/>.
+
+ use omp_lib
+ integer nthreads, i, a(1000)
+ nthreads = omp_get_num_threads()
+ if (nthreads .gt. 1000) call abort
+
+ do i = 1, nthreads
+ a(i) = 0
+ end do
+ print *, "start-here"
+!$omp parallel
+ a(omp_get_thread_num() + 1) = 1
+!$omp end parallel
+ do i = 1, nthreads
+ if (a(i) .ne. 1) call abort
+ end do
+ print *, "success"
+ end

151
SOURCES/gdb-bz541866-rwatch-before-run.patch

@ -0,0 +1,151 @@ @@ -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 <http://www.gnu.org/licenses/>. */
+
+#ifndef NM_LINUX_H
+#define NM_LINUX_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
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 <http://www.gnu.org/licenses/>. */
+
+#ifndef NM_LINUX64_H
+#define NM_LINUX64_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
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 <http://www.gnu.org/licenses/>.
+
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
+ && ![istarget "ia64-*-*"])
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
+ verbose "Skipping watchpoint-hw-before-run test."
+ return
+}
+
+set test watchpoint-hw-before-run
+set srcfile watchpoint-hw-hit-once.c
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
+ return -1
+}
+
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
+
+# `runto_main' or `runto main' would delete the watchpoint created above.
+
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
+gdb_test "" "main .* at .*" "start"
+
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"

68
SOURCES/gdb-bz568248-oom-is-error.patch

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
Subject: [rfc patch] nomem: internal_error -> error

Hi,

unfortunately I see this problem reproducible only with the
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
OTOH this branch I hopefully submit in some form for FSF GDB later.

In this case (a general problem but tested for example on Fedora 13 i686):

int
main (int argc, char **argv)
{
char a[argc];
return a[0];
}

(gdb) start
(gdb) print a
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.

It is apparently because boundary for the variable `a' is not initialized
there. Users notice it due to Eclipse-CDT trying to automatically display all
the local variables on each step.


Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
But is anone aware of the reasons to use internal_error there?
I find simple error as a perfectly reasonable there.
(history only tracks it since the initial import)

IIRC this idea has been discussed with Tom Tromey, not sure of its origin.

I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
sure if it can happen only due to the VLA variables.


Thanks,
Jan


gdb/
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>

* utils.c (nomem): Change internal_error to error.

Index: gdb-7.3.50.20110722/gdb/utils.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/utils.c 2011-07-22 19:28:58.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/utils.c 2011-07-22 19:34:25.000000000 +0200
@@ -1219,13 +1219,11 @@ malloc_failure (long size)
{
if (size > 0)
{
- internal_error (__FILE__, __LINE__,
- _("virtual memory exhausted: can't allocate %ld bytes."),
- size);
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
}
else
{
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
+ error (_("virtual memory exhausted."));
}
}

240
SOURCES/gdb-bz601887-dwarf4-rh-test.patch

@ -0,0 +1,240 @@ @@ -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 <http://www.gnu.org/licenses/>. */
+
+ .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 <http://www.gnu.org/licenses/>. */
+
+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 <http://www.gnu.org/licenses/>.
+
+# 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\)}

31
SOURCES/gdb-bz634108-solib_address.patch

@ -0,0 +1,31 @@ @@ -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 <http://www.gnu.org/licenses/>.
+
+# 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"

17
SOURCES/gdb-ccache-workaround.patch

@ -0,0 +1,17 @@ @@ -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}" \

131
SOURCES/gdb-core-open-vdso-warning.patch

@ -0,0 +1,131 @@ @@ -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"

102
SOURCES/gdb-dlopen-stap-probe-1of9.patch

@ -0,0 +1,102 @@ @@ -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 <gbenson@redhat.com>
+
+ * 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 <amodra@gmail.com>
* 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,

181
SOURCES/gdb-dlopen-stap-probe-2of9.patch

@ -0,0 +1,181 @@ @@ -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 <gbenson@redhat.com>
+ * 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 <gbenson@redhat.com>
+
* 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,

298
SOURCES/gdb-dlopen-stap-probe-3of9.patch

@ -0,0 +1,298 @@ @@ -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 <gbenson@redhat.com>
+
+ * 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 <dje@google.com>
* 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 ("<library-list-svr4 version=\"1.0\"/>\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, "<library-list-svr4 version=\"1.0\"");
- p = document + strlen (document);
-
- r_version = 0;
- if (linux_read_memory (priv->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, "<library-list-svr4 version=\"1.0\"");
+ p = document + strlen (document);
+
+ while (lm_addr
+ && 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)
+ {
+ 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 `<library-list-svr4'. */
+ *p++ = '>';
+ header_done = 1;
}
- /* 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')
+ while (allocated < p - document + len + 200)
{
- /* 6x the size for xml_escape_text below. */
- size_t len = 6 * strlen ((char *) libname);
- char *name;
-
- if (!header_done)
- {
- /* Terminate `<library-list-svr4'. */
- *p++ = '>';
- header_done = 1;
- }
-
- while (allocated < p - document + len + 200)
- {
- /* Expand to guarantee sufficient storage. */
- uintptr_t document_len = p - document;
-
- document = xrealloc (document, 2 * allocated);
- allocated *= 2;
- p = document + document_len;
- }
-
- name = xml_escape_text ((char *) libname);
- p += sprintf (p, "<library name=\"%s\" lm=\"0x%lx\" "
- "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
- 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, "<library name=\"%s\" lm=\"0x%lx\" "
+ "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
+ 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 `<library-list-svr4'. */
- strcpy (p, "/>");
+ sprintf (p, " main-lm=\"0x%lx\"", (unsigned long) lm_addr);
+ p = p + strlen (p);
}
- else
- strcpy (p, "</library-list-svr4>");
+
+ lm_prev = lm_addr;
+ lm_addr = l_next;
}
+ if (!header_done)
+ {
+ /* Empty list; terminate `<library-list-svr4'. */
+ strcpy (p, "/>");
+ }
+ else
+ strcpy (p, "</library-list-svr4>");
+
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

35
SOURCES/gdb-dlopen-stap-probe-4of9.patch

@ -0,0 +1,35 @@ @@ -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 <gbenson@redhat.com>
+ * NEWS: Update.
+
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
* 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.

91
SOURCES/gdb-dlopen-stap-probe-5of9.patch

@ -0,0 +1,91 @@ @@ -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 <gbenson@redhat.com>
+
+ * 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 <brobecker@adacore.com>
* 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

132
SOURCES/gdb-dlopen-stap-probe-6of9.patch

@ -0,0 +1,132 @@ @@ -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 <gbenson@redhat.com>
+ * 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 <gbenson@redhat.com>
+
* NEWS: Update.
2013-06-04 Gary Benson <gbenson@redhat.com>
--- 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) \

1107
SOURCES/gdb-dlopen-stap-probe-7of9.patch

File diff suppressed because it is too large Load Diff

462
SOURCES/gdb-dlopen-stap-probe-8of9.patch

@ -0,0 +1,462 @@ @@ -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 <jan.kratochvil@redhat.com>
+ Gary Benson <gbenson@redhat.com>
+
+ * 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 <yao@codesourcery.com>
* 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 <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <assert.h>
+
+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 <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <assert.h>
+
+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 <http://www.gnu.org/licenses/>.
+
+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
}

415
SOURCES/gdb-dlopen-stap-probe-9of9.patch

@ -0,0 +1,415 @@ @@ -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 <gbenson@redhat.com>
+
+ * 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 <jan.kratochvil@redhat.com>
Gary Benson <gbenson@redhat.com>
--- 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 <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+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 <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <assert.h>
+#include <stddef.h>
+
+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 <http://www.gnu.org/licenses/>.
+
+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 <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+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 <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+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 <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <assert.h>
+#include <stddef.h>
+
+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 <http://www.gnu.org/licenses/>.
+
+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

86
SOURCES/gdb-enable-count-crash.patch

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html
Subject: [PATCH] "enable count" user input error handling (PR gdb/15678)

Typing "enable count" by itself crashes GDB. Also, if you omit the
breakpoint number/range, the error message is not very clear:

(gdb) enable count 2
warning: bad breakpoint number at or near ''
(gdb) enable count
Segmentation fault (core dumped)

With this patch, the error messages are slightly more helpful:

(gdb) enable count 2
Argument required (one or more breakpoint numbers).
(gdb) enable count
Argument required (hit count).

They are not as helpful to the user as I would like, but it's better
than crashing. Suggestions are welcome.

Simon

gdb/ChangeLog:
2013-06-26 Simon Marchi <simon.marchi@ericsson.com>

* breakpoint.c (map_breakpoint_numbers): Check for empty args
string.
(enable_count_command): Check args for NULL value.

gdb/testsuite/ChangeLog:
2013-06-26 Simon Marchi <simon.marchi@ericsson.com>

* gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
---
gdb/breakpoint.c | 9 +++++++--
gdb/testsuite/gdb.base/ena-dis-br.exp | 8 ++++++++
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ccd05d9..5a0c5ab 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14389,7 +14389,7 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *,
int match;
struct get_number_or_range_state state;

- if (args == 0)
+ if (args == 0 || *args == '\0')
error_no_arg (_("one or more breakpoint numbers"));

init_number_or_range (&state, args);
@@ -14713,7 +14713,12 @@ do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr)
static void
enable_count_command (char *args, int from_tty)
{
- int count = get_number (&args);
+ int count;
+
+ if (args == NULL)
+ error_no_arg (_("hit count"));
+
+ count = get_number (&args);

map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
}
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index b08b709..82aef64 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -173,6 +173,14 @@ set bp [break_at $bp_location7 "line $bp_location7"]

set bp2 [break_at marker1 " line ($bp_location15|$bp_location16)"]

+gdb_test "enable count" \
+ "Argument required \\(hit count\\)\\." \
+ "enable count missing arguments"
+
+gdb_test "enable count 2" \
+ "Argument required \\(one or more breakpoint numbers\\)\\." \
+ "enable count missing last argument"
+
gdb_test_no_output "enable count 2 $bp" "disable break with count"

gdb_test "continue" \

27
SOURCES/gdb-follow-child-stale-parent.patch

@ -0,0 +1,27 @@ @@ -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

207
SOURCES/gdb-gdb-add-index-script.patch

@ -0,0 +1,207 @@ @@ -0,0 +1,207 @@
http://sourceware.org/ml/gdb-patches/2010-07/msg00184.html
Subject: Re: [0/4] RFC: add DWARF index support

Jan Kratochvil: Fixed $d -> $dir.
Jan Kratochvil: Remove /dev/null redirection.

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This patch series adds support for a DWARF index to gdb.

Roland suggested we wrap up the index-creation code into a helper
script.

I'm not sure if this is something people would want in gdb proper, but I
figured I would send it here just in case.

Tom

2010-07-09 Tom Tromey <tromey@redhat.com>

* Makefile.in (install-only): Install gdb-add-index.
* gdb-add-index: New file.

2010-07-09 Tom Tromey <tromey@redhat.com>

* gdb.texinfo (Index Files): Mention gdb-add-index.

>From 30714fe719e61baea03d0dc5793eb0d564faebb7 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Fri, 9 Jul 2010 11:17:54 -0600
Subject: [PATCH 4/4] add gdb-add-index
Subject: [PATCH 4/4] add gdb-add-index

---
gdb/ChangeLog | 5 +++++
gdb/Makefile.in | 11 ++++++++++-
gdb/doc/ChangeLog | 4 ++++
gdb/doc/gdb.texinfo | 8 ++++++++
gdb/gdb-add-index | 30 ++++++++++++++++++++++++++++++
5 files changed, 57 insertions(+), 1 deletions(-)
create mode 100755 gdb/gdb-add-index

Index: gdb-7.6.1/gdb/Makefile.in
===================================================================
--- gdb-7.6.1.orig/gdb/Makefile.in
+++ gdb-7.6.1/gdb/Makefile.in
@@ -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.6.1/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.6.1.orig/gdb/doc/gdb.texinfo
+++ gdb-7.6.1/gdb/doc/gdb.texinfo
@@ -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
@@ -41738,6 +41746,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
@@ -42390,6 +42399,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.6.1/gdb/gdb-add-index
===================================================================
--- /dev/null
+++ gdb-7.6.1/gdb/gdb-add-index
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+# Add a .gdb_index section to a file.
+
+# Copyright (C) 2010 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+file="$1"
+dir="${file%/*}"
+test "$dir" = "$file" && dir="."
+
+# 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.6.1/gdb/doc/Makefile.in
===================================================================
--- gdb-7.6.1.orig/gdb/doc/Makefile.in
+++ gdb-7.6.1/gdb/doc/Makefile.in
@@ -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

143
SOURCES/gdb-glibc-strstr-workaround.patch

@ -0,0 +1,143 @@ @@ -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 <http://www.gnu.org/licenses/>.
+
+# Workaround for:
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
+
+if {[skip_shlib_tests]} {
+ return 0
+}
+
+set testfile "gnu-ifunc-strstr-workaround"
+set executable ${testfile}
+set srcfile start.c
+set binfile ${objdir}/${subdir}/${executable}
+
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return 0
+}
+
+set test "ptype atoi"
+gdb_test_multiple $test $test {
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
+ untested "$test (no DWARF)"
+ return 0
+ }
+}
+
+set addr ""
+set test "print strstr"
+gdb_test_multiple $test $test {
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass $test
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass "$test (GDB workaround)"
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass "$test (fixed glibc)"
+ }
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ untested "$test (gnu-ifunc not in use by glibc)"
+ return 0
+ }
+}
+
+set test "info sym"
+gdb_test_multiple "info sym $addr" $test {
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ # unexpected
+ xfail "$test (not in libc.so.6)"
+ return 0
+ }
+}
+
+set test "info addr strstr"
+gdb_test_multiple $test $test {
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
+ fail "$test (DWARF for strstr)"
+ }
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+}
+
+set test "print strstr second time"
+gdb_test_multiple "print strstr" $test {
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
+ pass "$test (GDB workaround)"
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
+ pass "$test (fixed glibc)"
+ }
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ fail $test
+ }
+}
+
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save