upgrade GDB version to 11.1

This commit is contained in:
zhouwenpei 2021-12-08 15:30:13 +08:00
parent 3f18337299
commit 31a78bf421
112 changed files with 3377 additions and 12762 deletions

View File

@ -1,46 +0,0 @@
From 8488c357ce4fc309d49c7b0224cf9574b68e8116 Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Thu, 18 Feb 2021 22:46:58 -0700
Subject: [PATCH] amd64-linux-siginfo.c: Adjust include order to avoid gnulib
error
On Fedora rawhide, after updating to glibc-2.33, I'm seeing the
following build failure:
CXX nat/amd64-linux-siginfo.o
In file included from /usr/include/bits/sigstksz.h:24,
from /usr/include/signal.h:315,
from ../gnulib/import/signal.h:52,
from /ironwood1/sourceware-git/rawhide-gnulib/bld/../../worktree-gnulib/gdbserver/../gdb/nat/amd64-linux-siginfo.c:20:
../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
663 | #error "Please include config.h first."
| ^~~~~
glibc-2.33 has changed signal.h to now include <bits/sigstksz.h> which,
in turn, includes <unistd.h>. For a gdb build, this causes the gnulib
version of unistd.h to be pulled in first. The build failure shown
above happens because gnulib's config.h has not been included before
the include of <signal.h>.
The fix is simple - we just rearrange the order of the header file
includes to make sure that gdbsupport/commondefs.h is included before
attempting to include signal.h. Note that gdbsupport/commondefs.h
includes <gnulib/config.h>.
Build and regression tested on Fedora 33. On Fedora rawhide, GDB
builds again.
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -17,8 +17,8 @@
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 <signal.h>
#include "gdbsupport/common-defs.h"
+#include <signal.h>
#include "amd64-linux-siginfo.h"
#define GDB_SI_SIZE 128
--
2.27.0

Binary file not shown.

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-attach-see-vdso-test.patch
;; Test kernel VDSO decoding while attaching to an i386 process.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -32,7 +40,7 @@ diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp +++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
@@ -0,0 +1,72 @@ @@ -0,0 +1,77 @@
+# Copyright 2007 +# Copyright 2007
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -56,6 +64,11 @@ new file mode 100644
+ return 0 + return 0
+} +}
+ +
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile "attach-see-vdso" +set testfile "attach-see-vdso"
+set srcfile ${testfile}.c +set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}] +set binfile [standard_output_file ${testfile}]

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-bz140532-ppc-unwinding-test.patch
;; Update PPC unwinding patches to their upstream variants (BZ 140532).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch
;; Testcase for exec() from threaded program (BZ 202689).
;;=fedoratest
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -69,7 +81,7 @@ new file mode 100644
+# +#
+# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+# Please email any bugs, comments, and/or additions to this file to: +# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu +# bug-gdb@prep.ai.mit.edu

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-focus-cmd-prev-test.patch
;; Test a crash on `focus cmd', `focus prev' commands.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/focus-cmd-prev.exp b/gdb/testsuite/gdb.base/focus-cmd-prev.exp diff --git a/gdb/testsuite/gdb.base/focus-cmd-prev.exp b/gdb/testsuite/gdb.base/focus-cmd-prev.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,7 +1,22 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Cagney <cagney@gnu.org>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-gstack-20050411.patch
;; Add a wrapper script to GDB that implements pstack using the
;; --readnever option.
;;=push
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.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in --- a/gdb/Makefile.in
+++ b/gdb/Makefile.in +++ b/gdb/Makefile.in
@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force @@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only @$(MAKE) $(FLAGS_TO_PASS) install-only
@ -10,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \ transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \ echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \ if test "x$$transformed_name" = x; then \
@@ -1817,7 +1817,25 @@ install-guile: @@ -1802,7 +1802,25 @@ install-guile:
install-python: install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -37,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \ transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \ echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \ if test "x$$transformed_name" = x; then \
@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL) @@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do

View File

@ -1,3 +1,22 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-inferior-notification-20050721.patch
;; Notify observers that the inferior has been created
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -27,7 +46,7 @@ diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attac
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.exp +++ b/gdb/testsuite/gdb.base/attach-32.exp
@@ -0,0 +1,245 @@ @@ -0,0 +1,246 @@
+# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -59,8 +78,9 @@ new file mode 100644
+} +}
+ +
+# are we on a target board +# are we on a target board
+if [is_remote target] then { +if {[use_gdb_stub]} {
+ return 0 + untested "skipping test because of use_gdb_stub"
+ return -1
+} +}
+ +
+set testfile "attach-32" +set testfile "attach-32"

View File

@ -1,8 +1,23 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-inheritancetest-20050726.patch
;; Verify printing of inherited members test
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835.cc +++ b/gdb/testsuite/gdb.cp/b146835.cc
@@ -0,0 +1,32 @@ @@ -0,0 +1,31 @@
+#include "b146835.h" +#include "b146835.h"
+#include <iostream> +#include <iostream>
+ +
@ -34,7 +49,6 @@ new file mode 100644
+ F f; + F f;
+ f.foo(); + f.foo();
+} +}
+
diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-mapping-zero-inode-test.patch
;; Test GCORE for shmid 0 shared memory mappings.
;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -0,0 +1,38 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Elena Zannoni <ezannoni@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-rh-testversion-20041202.patch
;; Match the Fedora's version info.
;;=fedora
2003-02-24 Elena Zannoni <ezannoni@redhat.com>
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
string.
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -53,6 +53,9 @@ proc test_with_self { } {
-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"
+ }
}
# start the "xgdb" process
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2195,7 +2195,7 @@ init_gdb_version_vars (void)
struct internalvar *major_version_var = create_internalvar ("_gdb_major");
struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
int vmajor = 0, vminor = 0, vrevision = 0;
- sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision);
+ sscanf (version, "Fedora %d.%d.%d", &vmajor, &vminor, &vrevision);
set_internalvar_integer (major_version_var, vmajor);
set_internalvar_integer (minor_version_var, vminor + (vrevision > 0));
}

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-test-dtorfix-20050121.patch
;; Test support of multiple destructors just like multiple constructors
;;=fedoratest
diff --git a/gdb/testsuite/gdb.cp/constructortest.cc b/gdb/testsuite/gdb.cp/constructortest.cc diff --git a/gdb/testsuite/gdb.cp/constructortest.cc b/gdb/testsuite/gdb.cp/constructortest.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,8 +1,22 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Elena Zannoni <ezannoni@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-test-movedir-20050125.patch
;; Fix to support executable moving
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.c +++ b/gdb/testsuite/gdb.base/move-dir.c
@@ -0,0 +1,10 @@ @@ -0,0 +1,9 @@
+#include <stdio.h> +#include <stdio.h>
+#include <stdlib.h> +#include <stdlib.h>
+#include "move-dir.h" +#include "move-dir.h"
@ -12,7 +26,6 @@ new file mode 100644
+ printf ("%s\n", hw);; + printf ("%s\n", hw);;
+ other(); + other();
+} +}
+
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -79,11 +92,10 @@ diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.h +++ b/gdb/testsuite/gdb.base/move-dir.h
@@ -0,0 +1,7 @@ @@ -0,0 +1,6 @@
+#include <stdlib.h> +#include <stdlib.h>
+ +
+void other() { +void other() {
+ const char* ostring = "other"; + const char* ostring = "other";
+ printf ("%s\n", ostring);; + printf ("%s\n", ostring);;
+} +}
+

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -151,18 +151,18 @@ proc do_self_tests {function body} {
}
# Remove any old copy lying around.
- remote_file host delete $xgdb
+ #remote_file host delete $xgdb
gdb_start
- set file [remote_download host $GDB_FULLPATH $xgdb]
+ #set file [remote_download host $GDB_FULLPATH $xgdb]
- set result [selftest_setup $file $function]
+ set result [selftest_setup $GDB_FULLPATH $function]
if {$result == 0} then {
set result [uplevel $body]
}
gdb_exit
- catch "remote_file host delete $file"
+ #catch "remote_file host delete $file"
if {$result < 0} then {
warning "Couldn't test self"

View File

@ -1,8 +1,60 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-threaded-watchpoints2-20050225.patch
;; Test sibling threads to set threaded watchpoints for x86 and x86-64
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c +++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
@@ -0,0 +1,66 @@ @@ -0,0 +1,65 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
@ -68,7 +120,6 @@ new file mode 100644
+ +
+ pthread_exit(NULL); + pthread_exit(NULL);
+} +}
+
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -161,9 +212,9 @@ new file mode 100644
+ { set args_2 1; set test_flag 1 } + { 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 $" + -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 } + { 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 $" + -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_2 [expr $args_2+1]; set test_flag 1 } + { 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 $" + -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_3 [expr $args_3+1]; set test_flag 1 } + { set args_3 [expr $args_3+1]; set test_flag 1 }
+ } + }
+ # If we fail above, don't bother continuing loop + # If we fail above, don't bother continuing loop

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-BEA-testsuite.patch
;; Improved testsuite results by the testsuite provided by the courtesy of BEA.
;;=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,29 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
;; Find symbols properly at their original (included) file (BZ 109921).
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,17 +1,60 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
;; Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
;;=push+jan: It should be replaced by Infinity project.
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
diff --git a/gdb/printcmd.c b/gdb/printcmd.c diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c --- a/gdb/printcmd.c
+++ b/gdb/printcmd.c +++ b/gdb/printcmd.c
@@ -1214,6 +1214,10 @@ print_command_1 (const char *args, int voidprint) @@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
if (exp != nullptr && *exp) if (exp != nullptr && *exp)
{ {
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with + /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */ + function descriptors. */
+ if (target_has_execution && strcmp (exp, "errno") == 0) + if (target_has_execution () && strcmp (exp, "errno") == 0)
+ exp = "*(*(int *(*)(void)) __errno_location) ()"; + exp = "*(*(int *(*)(void)) __errno_location) ()";
expression_up expr = parse_expression (exp); /* VOIDPRINT is true to indicate that we do want to print a void
val = evaluate_expression (expr.get ()); value, so invert it for parse_expression. */
} expression_up expr = parse_expression (exp, nullptr, !voidprint);
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,13 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
;;=fedoratest
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -35,7 +45,7 @@ diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp +++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
@@ -0,0 +1,54 @@ @@ -0,0 +1,59 @@
+# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -52,6 +62,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+if $tracelevel then { +if $tracelevel then {
+ strace $tracelevel + strace $tracelevel
+} +}

View File

@ -1,17 +0,0 @@
diff --git a/gdb/symtab.c b/gdb/symtab.c
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
/* 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 (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
+ /* fall through */
else
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
}

View File

@ -1,8 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch
;; Test leftover zombie process (BZ 243845).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp +++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
@@ -0,0 +1,75 @@ @@ -0,0 +1,76 @@
+# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -20,8 +28,9 @@ new file mode 100644
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ +
+# are we on a target board +# are we on a target board
+if [is_remote target] then { +if {[use_gdb_stub]} {
+ return 0 + untested "skipping test because of use_gdb_stub"
+ return -1
+} +}
+ +
+# Start the program running and then wait for a bit, to be sure +# Start the program running and then wait for a bit, to be sure

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-gcore-buffer-limit-test.patch
;; Test gcore memory and time requirements for large inferiors.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -44,7 +52,7 @@ diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/g
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp +++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
@@ -0,0 +1,94 @@ @@ -0,0 +1,99 @@
+# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -61,6 +69,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile gcore-excessive-memory +set testfile gcore-excessive-memory
+set srcfile ${testfile}.c +set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh] +set shfile [standard_output_file ${testfile}-gdb.sh]

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-ia64-libunwind-leak-test.patch
;; Test ia64 memory leaks of the code using libunwind.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -36,7 +44,7 @@ diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unw
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.exp +++ b/gdb/testsuite/gdb.base/unwind-leak.exp
@@ -0,0 +1,83 @@ @@ -0,0 +1,88 @@
+# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -53,6 +61,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile unwind-leak +set testfile unwind-leak
+set srcfile ${testfile}.c +set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh] +set shfile [standard_output_file ${testfile}-gdb.sh]

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-last-address-space-byte-test.patch
;; Testcase for deadlocking on last address space byte; for corrupted backtraces.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,14 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-missed-trap-on-step-test.patch
;; Test hiding unexpected breakpoints on intentional step commands.
;;=fedoratest
Fix has been committed to:
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,8 +1,18 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-readline-long-line-crash-test.patch
;; Fix readline segfault on excessively long hand-typed lines.
;;=fedoratest
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp +++ b/gdb/testsuite/gdb.base/readline-overflow.exp
@@ -0,0 +1,104 @@ @@ -0,0 +1,96 @@
+# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -36,20 +46,12 @@ new file mode 100644
+ +
+global env +global env
+ +
+save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } { +save_vars { env(GDBHISTFILE) env(HISTSIZE) TERM timeout } {
+ # The arrow key test relies on the standard VT100 bindings, so + # The arrow key test relies on the standard VT100 bindings, so
+ # make sure that an appropriate terminal is selected. The same + # make sure that an appropriate terminal is selected. The same
+ # bug doesn't show up if we use ^P / ^N instead. + # bug doesn't show up if we use ^P / ^N instead.
+ setenv TERM vt100 + setenv TERM vt100
+ +
+ # 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.
+ set env(INPUTRC) "/dev/null"
+
+ set timeout 600 + set timeout 600
+ +
+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" + set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-section-num-fixup-test.patch
;; Test a crash on libraries missing the .text section.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -60,7 +68,7 @@ diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/datalib.exp +++ b/gdb/testsuite/gdb.base/datalib.exp
@@ -0,0 +1,51 @@ @@ -0,0 +1,56 @@
+# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -77,6 +85,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile datalib +set testfile datalib
+set srcfilemain ${testfile}-main.c +set srcfilemain ${testfile}-main.c
+set srcfilelib ${testfile}-lib.c +set srcfilelib ${testfile}-lib.c

View File

@ -1,8 +1,39 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-sharedlibrary-path.patch
;; Fix TLS symbols resolving for shared libraries with a relative pathname.
;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
;;=fedoratest: One should recheck if it is really fixed upstream.
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.
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c +++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
@@ -0,0 +1,25 @@ @@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2006 Free Software Foundation, Inc. + Copyright 2006 Free Software Foundation, Inc.
@ -24,9 +55,15 @@ new file mode 100644
+ Please email any bugs, comments, and/or additions to this file to: + Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */ + bug-gdb@prep.ai.mit.edu */
+ +
+#include <pthread.h>
+
+extern __thread int var;
+
+int main() +int main()
+{ +{
+ return 0; + /* Ensure we link against pthreads even with --as-needed. */
+ pthread_testcancel();
+ return var;
+} +}
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
new file mode 100644 new file mode 100644
@ -59,7 +96,7 @@ diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.thre
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp +++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -0,0 +1,87 @@ @@ -0,0 +1,94 @@
+# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -76,6 +113,13 @@ new file mode 100644
+# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ +
+# This test uses gdb_exit and gdb_start, which are not supported
+# on non-extended-remote sessions.
+if {[use_gdb_stub]} {
+ untested "skipping test because of stub"
+ return 0
+}
+
+if $tracelevel then { +if $tracelevel then {
+ strace $tracelevel + strace $tracelevel
+} +}

View File

@ -1,133 +0,0 @@
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -18,6 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
+#include "exceptions.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
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).c_str ());
+
+ 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 (_("\"%ss\": not in executable format: %s"),
+ scratch_pathname,
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
if (build_section_table (exec_bfd, &sections, &sections_end))
diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h
--- a/gdb/gdbsupport/common-exceptions.h
+++ b/gdb/gdbsupport/common-exceptions.h
@@ -106,6 +106,9 @@ enum errors {
"_ERROR" is appended to the name. */
MAX_COMPLETIONS_REACHED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
+
/* Add more errors here. */
NR_ERRORS
};
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -467,6 +467,34 @@ struct cmdarg
char *string;
};
+/* 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 (const char *filename, int from_tty)
+{
+ gdb_assert (exec_bfd == NULL);
+
+ try
+ {
+ exec_file_attach (filename, from_tty);
+ }
+ catch (gdb_exception_error &e)
+ {
+ if (e.error == IS_CORE_ERROR)
+ {
+ core_file_command ((char *) 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 (std::move (e));
+ }
+}
+
static void
captured_main_1 (struct captured_main_args *context)
{
@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context)
{
symarg = argv[optind];
execarg = argv[optind];
+ if (optind + 1 == argc && corearg == NULL)
+ corearg = argv[optind];
optind++;
}
@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{
+ catch_command_errors_const_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! */
- ret = catch_command_errors (exec_file_attach, execarg,
- !batch_flag);
- if (ret != 0)
+ 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. */
+ ret = catch_command_errors (func, execarg, !batch_flag);
+ if (ret != 0 && core_bfd == NULL)
ret = catch_command_errors (symbol_file_add_main_adapter,
symarg, !batch_flag);
}

View File

@ -1,3 +1,30 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject:
gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
;; Fix 'gdb gives highly misleading error when debuginfo pkg is present,
;; but not corresponding binary pkg' (RH BZ 981154).
;;=push+jan
Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
This is the fix for RH BZ #981154
It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
file was also needed.
gdb/build-id.c was added by:
commit dc294be54c96414035eed7d53dafdea0a6f31a72
Author: Tom Tromey <tromey@redhat.com>
Date: Tue Oct 8 19:56:15 2013 +0000
and had a little thinko there. The variable 'filename' needs to be set to
NULL after it is free'd, otherwise the code below thinks that it is still
valid and doesn't print the necessary warning ("Try: yum install ...").
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,7 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
;;=push+jan
diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c --- a/gdb/build-id.c
+++ b/gdb/build-id.c +++ b/gdb/build-id.c
@@ -709,6 +709,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) @@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif

View File

@ -1,7 +1,18 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-buildid-locate-rpm-scl.patch
;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
;;=push+jan
warning: Skipping deprecated .gdb_index section
https://bugzilla.redhat.com/show_bug.cgi?id=953585
diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c --- a/gdb/build-id.c
+++ b/gdb/build-id.c +++ b/gdb/build-id.c
@@ -743,7 +743,11 @@ static int missing_rpm_list_entries; @@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
/* Returns the count of newly added rpms. */ /* Returns the count of newly added rpms. */
static int static int
@ -13,7 +24,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{ {
static int rpm_init_done = 0; static int rpm_init_done = 0;
rpmts ts; rpmts ts;
@@ -850,7 +854,11 @@ missing_rpm_enlist (const char *filename) @@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
if (mi != NULL) if (mi != NULL)
{ {
@ -25,7 +36,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{ {
Header h; Header h;
char *debuginfo, **slot, *s, *s2; char *debuginfo, **slot, *s, *s2;
@@ -968,6 +976,37 @@ missing_rpm_enlist (const char *filename) @@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
xfree (debuginfo); xfree (debuginfo);
count++; count++;
} }
@ -63,7 +74,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
rpmdbFreeIterator_p (mi); rpmdbFreeIterator_p (mi);
} }
@@ -977,6 +1016,20 @@ missing_rpm_enlist (const char *filename) @@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
return count; return count;
} }
@ -84,10 +95,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
static bool static bool
missing_rpm_list_compar (const char *ap, const char *bp) missing_rpm_list_compar (const char *ap, const char *bp)
{ {
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2read.c --- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2read.c +++ b/gdb/dwarf2/read.c
@@ -3497,6 +3497,16 @@ read_gdb_index_from_buffer (struct objfile *objfile, @@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */ "set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok) if (version < 6 && !deprecated_ok)
{ {
@ -104,7 +115,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
static int warning_printed = 0; static int warning_printed = 0;
if (!warning_printed) if (!warning_printed)
{ {
@@ -3508,6 +3518,10 @@ to use the section anyway."), @@ -2812,6 +2822,10 @@ to use the section anyway."),
warning_printed = 1; warning_printed = 1;
} }
return 0; return 0;

View File

@ -1,3 +1,10 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-buildid-locate-rpm.patch
;;=push+jan
diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
--- a/gdb/aclocal.m4 --- a/gdb/aclocal.m4
+++ b/gdb/aclocal.m4 +++ b/gdb/aclocal.m4
@ -233,10 +240,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
#include "gdbcmd.h" #include "gdbcmd.h"
#include "gdbcore.h" #include "gdbcore.h"
+#include "inferior.h" +#include "inferior.h"
#include "libbfd.h"
#include "objfiles.h" #include "objfiles.h"
#include "observable.h" #include "observable.h"
@@ -698,8 +699,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) #include "symfile.h"
@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result; return result;
} }
@ -612,7 +619,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
avoidance. */ avoidance. */
struct missing_filepair struct missing_filepair
@@ -753,11 +1120,17 @@ missing_filepair_change (void) @@ -752,11 +1119,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */ /* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL; missing_filepair_hash = NULL;
} }
@ -630,7 +637,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
missing_filepair_change (); missing_filepair_change ();
} }
@@ -824,14 +1197,38 @@ debug_print_missing (const char *binary, const char *debug) @@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair; *slot = missing_filepair;
@ -679,9 +686,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in --- a/gdb/config.in
+++ b/gdb/config.in +++ b/gdb/config.in
@@ -36,6 +36,9 @@ @@ -39,6 +39,9 @@
/* Define to BFD's default target vector. */ /* Handle .ctf type-info sections */
#undef DEFAULT_BFD_VEC #undef ENABLE_LIBCTF
+/* librpm version specific library name to dlopen. */ +/* librpm version specific library name to dlopen. */
+#undef DLOPEN_LIBRPM +#undef DLOPEN_LIBRPM
@ -689,7 +696,7 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if translation of program messages to the user's native /* Define to 1 if translation of program messages to the user's native
language is requested. */ language is requested. */
#undef ENABLE_NLS #undef ENABLE_NLS
@@ -245,6 +248,9 @@ @@ -246,6 +249,9 @@
/* Define if you have the mpfr library. */ /* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR #undef HAVE_LIBMPFR
@ -702,7 +709,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -761,6 +761,11 @@ CODESIGN_CERT @@ -771,6 +771,11 @@ PKG_CONFIG
HAVE_NATIVE_GCORE_TARGET HAVE_NATIVE_GCORE_TARGET
TARGET_OBS TARGET_OBS
subdirs subdirs
@ -714,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR GDB_DATADIR
DEBUGDIR DEBUGDIR
MAKEINFO_EXTRA_FLAGS MAKEINFO_EXTRA_FLAGS
@@ -864,6 +869,7 @@ with_gdb_datadir @@ -876,6 +881,7 @@ with_gdb_datadir
with_relocated_sources with_relocated_sources
with_auto_load_dir with_auto_load_dir
with_auto_load_safe_path with_auto_load_safe_path
@ -722,42 +729,34 @@ diff --git a/gdb/configure b/gdb/configure
enable_targets enable_targets
enable_64_bit_bfd enable_64_bit_bfd
enable_gdbmi enable_gdbmi
@@ -926,6 +932,11 @@ CCC @@ -953,6 +959,8 @@ PKG_CONFIG_PATH
CPP PKG_CONFIG_LIBDIR
MAKEINFO DEBUGINFOD_CFLAGS
MAKEINFOFLAGS DEBUGINFOD_LIBS
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+RPM_CFLAGS +RPM_CFLAGS
+RPM_LIBS +RPM_LIBS
YACC YACC
YFLAGS YFLAGS
XMKMF' XMKMF'
@@ -1598,6 +1609,8 @@ Optional Packages: @@ -1625,6 +1633,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations do not restrict auto-loaded files locations
--with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no)
+ --with-rpm query rpm database for missing debuginfos (yes/no, + --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so) + def. auto=librpm.so)
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap --with-curses use the curses library instead of the termcap
library library
@@ -1661,6 +1674,13 @@ Some influential environment variables: @@ -1705,6 +1715,8 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version. C compiler flags for DEBUGINFOD, overriding pkg-config
MAKEINFOFLAGS DEBUGINFOD_LIBS
Parameters for MAKEINFO. linker flags for DEBUGINFOD, overriding pkg-config
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config + RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another Compiler Compiler' implementation to use. YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc', Defaults to the first program found out of: `bison -y', `byacc',
`yacc'. `yacc'.
@@ -6587,6 +6607,494 @@ _ACEOF @@ -6616,6 +6628,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; } $as_echo "$with_auto_load_safe_path" >&6; }
@ -1255,7 +1254,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac --- a/gdb/configure.ac
+++ b/gdb/configure.ac +++ b/gdb/configure.ac
@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, @@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.]) [Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path]) AC_MSG_RESULT([$with_auto_load_safe_path])
@ -1459,9 +1458,9 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c --- a/gdb/event-top.c
+++ b/gdb/event-top.c +++ b/gdb/event-top.c
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
#include "ser-event.h" #include "gdbsupport/gdb_select.h"
#include "gdb_select.h"
#include "gdbsupport/gdb-sigmask.h" #include "gdbsupport/gdb-sigmask.h"
#include "async-event.h"
+#include "symfile.h" +#include "symfile.h"
/* readline include files. */ /* readline include files. */
@ -1475,7 +1474,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* Do not call the python hook on an explicit prompt change as /* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt, passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */ IE, displayed but not set. */
@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl) @@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd); command_handler (cmd);
if (ui->prompt_state != PROMPTED) if (ui->prompt_state != PROMPTED)
@ -1490,12 +1489,11 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
diff --git a/gdb/symfile.h b/gdb/symfile.h diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h --- a/gdb/symfile.h
+++ b/gdb/symfile.h +++ b/gdb/symfile.h
@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty); @@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */ /* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug); extern void debug_print_missing (const char *binary, const char *debug);
+extern void debug_flush_missing (void); +extern void debug_flush_missing (void);
+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
/* From dwarf2read.c */
/* From minidebug.c. */

View File

@ -1,7 +1,20 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-buildid-locate-solib-missing-ids.patch
;; Fix loading of core files without build-ids but with build-ids in executables.
;; Load strictly build-id-checked core files only if no executable is specified
;; (Jan Kratochvil, RH BZ 1339862).
;;=push+jan
gdb returns an incorrect back trace when applying a debuginfo
https://bugzilla.redhat.com/show_bug.cgi?id=1339862
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c --- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c
@@ -1346,14 +1346,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
} }
{ {
@ -25,13 +38,14 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+ not do any build-id checking of the libraries. There may be missing + 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 + build-ids dumped in the core file and we would map all the libraries
+ to the only existing file loaded that time - the executable. */ + to the only existing file loaded that time - the executable. */
+ if (symfile_objfile != NULL + if (current_program_space->symfile_object_file != NULL
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0) + && (current_program_space->symfile_object_file->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ build_id = build_id_addr_get (li->l_ld); + build_id = build_id_addr_get (li->l_ld);
if (build_id != NULL) if (build_id != NULL)
{ {
char *name, *build_id_filename; char *name, *build_id_filename;
@@ -1368,23 +1381,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name); xfree (name);
} }
else else
@ -47,8 +61,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
- instead) if the on-disk files no longer match the - instead) if the on-disk files no longer match the
- running program version. */ - running program version. */
- -
- if (symfile_objfile != NULL - if (current_program_space->symfile_object_file != NULL
- && (symfile_objfile->flags - && (current_program_space->symfile_object_file->flags
- & OBJF_BUILD_ID_CORE_LOADED) != 0) - & OBJF_BUILD_ID_CORE_LOADED) != 0)
- newobj->so_name[0] = 0; - newobj->so_name[0] = 0;
- } - }

View File

@ -1,7 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-buildid-locate.patch
;; New locating of the matching binaries from the pure core file (build-id).
;;=push+jan
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
--- a/bfd/libbfd-in.h --- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h
@@ -127,7 +127,7 @@ static inline char * @@ -115,7 +115,7 @@ static inline char *
bfd_strdup (const char *str) bfd_strdup (const char *str)
{ {
size_t len = strlen (str) + 1; size_t len = strlen (str) + 1;
@ -13,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
diff --git a/bfd/libbfd.h b/bfd/libbfd.h diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h --- a/bfd/libbfd.h
+++ b/bfd/libbfd.h +++ b/bfd/libbfd.h
@@ -132,7 +132,7 @@ static inline char * @@ -120,7 +120,7 @@ static inline char *
bfd_strdup (const char *str) bfd_strdup (const char *str)
{ {
size_t len = strlen (str) + 1; size_t len = strlen (str) + 1;
@ -25,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h
diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c --- a/gdb/build-id.c
+++ b/gdb/build-id.c +++ b/gdb/build-id.c
@@ -24,13 +24,71 @@ @@ -24,13 +24,70 @@
#include "gdbsupport/gdb_vecs.h" #include "gdbsupport/gdb_vecs.h"
#include "symfile.h" #include "symfile.h"
#include "objfiles.h" #include "objfiles.h"
@ -38,7 +46,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+#include "gdb_bfd.h" +#include "gdb_bfd.h"
+#include "gdbcmd.h" +#include "gdbcmd.h"
#include "gdbcore.h" #include "gdbcore.h"
+#include "libbfd.h"
+#include "objfiles.h" +#include "objfiles.h"
+#include "observable.h" +#include "observable.h"
+#include "symfile.h" +#include "symfile.h"
@ -98,7 +105,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{ {
if (!bfd_check_format (abfd, bfd_object) if (!bfd_check_format (abfd, bfd_object)
&& !bfd_check_format (abfd, bfd_core)) && !bfd_check_format (abfd, bfd_core))
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd) @@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd)
return NULL; return NULL;
} }
@ -447,7 +454,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* See build-id.h. */ /* See build-id.h. */
int int
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) @@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
const struct bfd_build_id *found; const struct bfd_build_id *found;
int retval = 0; int retval = 0;
@ -456,7 +463,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (found == NULL) if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), warning (_("File \"%s\" has no build-id, file skipped"),
@@ -66,56 +466,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) @@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
return retval; return retval;
} }
@ -533,18 +540,18 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* There can be multiple build-id symlinks pointing to real files + /* There can be multiple build-id symlinks pointing to real files
+ with the same build-id (such as hard links). Some of the real + with the same build-id (such as hard links). Some of the real
+ files may not be installed. */ + files may not be installed. */
+
- /* We expect to be silent on the non-existing files. */
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
+ string_appendf (link, ".%u", seqno); + string_appendf (link, ".%u", seqno);
+ } + }
- /* We expect to be silent on the non-existing files. */
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
+ ret_link = link;
- if (debug_bfd == NULL) - if (debug_bfd == NULL)
- { - {
- if (separate_debug_file_debug) - if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to open.\n")); - printf_unfiltered (_(" no, unable to open.\n"));
+ ret_link = link;
+
+ struct stat statbuf_trash; + struct stat statbuf_trash;
+ +
+ /* `access' automatically dereferences LINK. */ + /* `access' automatically dereferences LINK. */
@ -567,11 +574,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ +
+ continue; + continue;
+ } + }
+
- return {};
+ /* We expect to be silent on the non-existing files. */ + /* We expect to be silent on the non-existing files. */
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); + gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
+
- return {};
+ if (debug_bfd == NULL) + if (debug_bfd == NULL)
+ { + {
+ if (separate_debug_file_debug) + if (separate_debug_file_debug)
@ -643,7 +650,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
} }
/* Common code for finding BFDs of a given build-id. This function /* Common code for finding BFDs of a given build-id. This function
@@ -124,7 +627,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, @@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
static gdb_bfd_ref_ptr static gdb_bfd_ref_ptr
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@ -652,7 +659,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{ {
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */ cause "/.build-id/..." lookups. */
@@ -147,16 +650,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (size > 0) if (size > 0)
{ {
size--; size--;
@ -673,7 +680,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL) if (debug_bfd != NULL)
return debug_bfd; return debug_bfd;
@@ -170,7 +674,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0) if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
{ {
link = gdb_sysroot + link; link = gdb_sysroot + link;
@ -683,7 +690,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL) if (debug_bfd != NULL)
return debug_bfd; return debug_bfd;
} }
@@ -179,38 +684,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {}; return {};
} }
@ -899,15 +906,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */ /* Prevent looping on a stripped .debug file. */
if (abfd != NULL if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()), && filename_cmp (bfd_get_filename (abfd.get ()),
@@ -223,3 +898,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) @@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string (); return std::string ();
} }
+ +
+extern void _initialize_build_id (void); +void _initialize_build_id ();
+ +
+void +void
+_initialize_build_id (void) +_initialize_build_id ()
+{ +{
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, + add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\ + _("\
@ -919,7 +926,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ show_build_id_verbose, + show_build_id_verbose,
+ &setlist, &showlist); + &setlist, &showlist);
+ +
+ gdb::observers::executable_changed.attach (debug_print_executable_changed); + gdb::observers::executable_changed.attach (debug_print_executable_changed,
+ "build-id");
+} +}
diff --git a/gdb/build-id.h b/gdb/build-id.h diff --git a/gdb/build-id.h b/gdb/build-id.h
--- a/gdb/build-id.h --- a/gdb/build-id.h
@ -943,7 +951,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
- const bfd_byte *build_id); - const bfd_byte *build_id);
+ const bfd_byte *build_id, + const bfd_byte *build_id,
+ char **link_return); + char **link_return = NULL);
+ +
+extern char *build_id_to_filename (const struct bfd_build_id *build_id, +extern char *build_id_to_filename (const struct bfd_build_id *build_id,
+ char **link_return); + char **link_return);
@ -971,9 +979,9 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
diff --git a/gdb/coffread.c b/gdb/coffread.c diff --git a/gdb/coffread.c b/gdb/coffread.c
--- a/gdb/coffread.c --- a/gdb/coffread.c
+++ b/gdb/coffread.c +++ b/gdb/coffread.c
@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -710,7 +710,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* Try to add separate debug file if no symbols table found. */ /* Try to add separate debug file if no symbols table found. */
if (!objfile_has_partial_symbols (objfile)) if (!objfile->has_partial_symbols ())
{ {
- std::string debugfile = find_separate_debug_file_by_buildid (objfile); - std::string debugfile = find_separate_debug_file_by_buildid (objfile);
+ std::string debugfile = find_separate_debug_file_by_buildid (objfile, + std::string debugfile = find_separate_debug_file_by_buildid (objfile,
@ -995,8 +1003,8 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
#include "inferior.h" #include "inferior.h"
#include "infrun.h" #include "infrun.h"
#include "symtab.h" #include "symtab.h"
@@ -322,6 +326,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) @@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect)
inferior_ptid = ptid; /* Yes, make it current. */ switch_to_thread (thr); /* Yes, make it current. */
} }
+static bool build_id_core_loads = true; +static bool build_id_core_loads = true;
@ -1004,7 +1012,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
/* Issue a message saying we have no core to debug, if FROM_TTY. */ /* Issue a message saying we have no core to debug, if FROM_TTY. */
static void static void
@@ -358,19 +364,25 @@ core_file_command (const char *filename, int from_tty) @@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty)
static void static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{ {
@ -1024,18 +1032,19 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
symbol_file_add_main (bfd_get_filename (execbfd.get ()), symbol_file_add_main (bfd_get_filename (execbfd.get ()),
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
+ if (symfile_objfile != NULL) + if (current_program_space->symfile_object_file != NULL)
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; + current_program_space->symfile_object_file->flags |=
+ OBJF_BUILD_ID_CORE_LOADED;
} }
+ else + else
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
} }
/* See gdbcore.h. */ /* See gdbcore.h. */
@@ -998,4 +1010,11 @@ void @@ -1209,4 +1222,11 @@ _initialize_corelow ()
_initialize_corelow (void) maintenance_print_core_file_backed_mappings,
{ _("Print core file's file-backed mappings."),
add_target (core_target_info, core_target_open, filename_completer); &maintenanceprintlist);
+ +
+ add_setshow_boolean_cmd ("build-id-core-loads", class_files, + add_setshow_boolean_cmd ("build-id-core-loads", class_files,
+ &build_id_core_loads, _("\ + &build_id_core_loads, _("\
@ -1047,7 +1056,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo
@@ -20862,6 +20862,27 @@ information files. @@ -21415,6 +21415,27 @@ information files.
@end table @end table
@ -1075,10 +1084,10 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections @cindex @code{.gnu_debuglink} sections
@cindex debug link sections @cindex debug link sections
A debug link is a special section of the executable file named A debug link is a special section of the executable file named
diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
--- a/gdb/dwarf-index-cache.c --- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf-index-cache.c +++ b/gdb/dwarf2/index-cache.c
@@ -94,7 +94,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) @@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
return; return;
/* Get build id of objfile. */ /* Get build id of objfile. */
@ -1087,7 +1096,7 @@ diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
if (build_id == nullptr) if (build_id == nullptr)
{ {
if (debug_index_cache) if (debug_index_cache)
@@ -112,7 +112,8 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) @@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (dwz != nullptr) if (dwz != nullptr)
{ {
@ -1097,28 +1106,19 @@ diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
if (dwz_build_id == nullptr) if (dwz_build_id == nullptr)
{ {
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2read.c --- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2read.c +++ b/gdb/dwarf2/read.c
@@ -2718,7 +2718,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) @@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
}
if (dwz_bfd == NULL)
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
if (dwz_bfd == NULL)
error (_("could not find '.gnu_debugaltlink' file for %s"),
@@ -6276,7 +6276,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte> static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{ {
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); - const bfd_build_id *build_id = build_id_bfd_get (obj->obfd);
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
if (build_id == nullptr) if (build_id == nullptr)
return {}; return {};
@@ -6289,7 +6289,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) @@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte> static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{ {
@ -1130,7 +1130,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c --- a/gdb/elfread.c
+++ b/gdb/elfread.c +++ b/gdb/elfread.c
@@ -1299,7 +1299,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
&& objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL) && objfile->separate_debug_objfile_backlink == NULL)
{ {
@ -1141,35 +1141,61 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (debugfile.empty ()) if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile); debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1311,8 +1313,12 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (), else
symfile_flags, objfile); {
has_dwarf2 = false;
- const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd);
+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd);
if (build_id != nullptr)
{
@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
has_dwarf2 = true;
}
} }
- else
- has_dwarf2 = false;
+ /* Check if any separate debug info has been extracted out. */ + /* Check if any separate debug info has been extracted out. */
+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") + else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
+ != NULL) + != NULL)
+ debug_print_missing (objfile_name (objfile), build_id_filename.get ()); + debug_print_missing (objfile_name (objfile), build_id_filename.get ());
+ else
+ has_dwarf2 = false;
} }
}
}
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
current_exec_file = get_exec_file (0);
/* Read the CTF section only if there is no DWARF info. */ const bfd_build_id *exec_file_build_id
- = build_id_bfd_get (current_program_space->exec_bfd ());
+ = build_id_bfd_shdr_get (current_program_space->exec_bfd ());
if (exec_file_build_id != nullptr)
{
/* Prepend the target prefix, to force gdb_bfd_open to open the
@@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
if (abfd != nullptr)
{
const bfd_build_id *target_exec_file_build_id
- = build_id_bfd_get (abfd.get ());
+ = build_id_bfd_shdr_get (abfd.get ());
if (target_exec_file_build_id != nullptr)
{
diff --git a/gdb/objfiles.h b/gdb/objfiles.h diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h --- a/gdb/objfiles.h
+++ b/gdb/objfiles.h +++ b/gdb/objfiles.h
@@ -627,6 +627,10 @@ struct objfile @@ -812,6 +812,10 @@ struct objfile
htab_up static_links; bool skip_jit_symbol_lookup = false;
}; };
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ +/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+ +
+#define OBJF_BUILD_ID_CORE_LOADED static_cast<enum objfile_flag>(1 << 12) +#define OBJF_BUILD_ID_CORE_LOADED static_cast<enum objfile_flag>(1 << 12)
+ +
/* Declarations for functions defined in objfiles.c */ /* A deleter for objfile. */
extern struct gdbarch *get_objfile_arch (const struct objfile *); struct objfile_deleter
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
--- a/gdb/python/py-objfile.c --- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c
@ -1202,7 +1228,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void); static int svr4_have_link_map_offsets (void);
@@ -1344,9 +1345,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue; continue;
} }
@ -1244,8 +1270,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+ instead) if the on-disk files no longer match the + instead) if the on-disk files no longer match the
+ running program version. */ + running program version. */
+ +
+ if (symfile_objfile != NULL + if (current_program_space->symfile_object_file != NULL
+ && (symfile_objfile->flags + && (current_program_space->symfile_object_file->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0) + & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ newobj->so_name[0] = 0; + newobj->so_name[0] = 0;
+ } + }
@ -1257,12 +1283,24 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
/* If this entry has no name, or its name matches the name /* If this entry has no name, or its name matches the name
for the main executable, don't include it in the list. */ for the main executable, don't include it in the list. */
diff --git a/gdb/source.c b/gdb/source.c
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s)
srcpath += s->filename;
}
- const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd);
+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd);
/* Query debuginfod for the source file. */
if (build_id != nullptr && !srcpath.empty ())
diff --git a/gdb/symfile.h b/gdb/symfile.h diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h --- a/gdb/symfile.h
+++ b/gdb/symfile.h +++ b/gdb/symfile.h
@@ -532,12 +532,17 @@ void expand_symtabs_matching @@ -332,12 +332,18 @@ bool expand_symtabs_matching
void map_symbol_filenames (symbol_filename_ftype *fun, void *data, void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
int need_fullname); bool need_fullname);
+ +
/* Target-agnostic function to load the sections of an executable into memory. /* Target-agnostic function to load the sections of an executable into memory.
@ -1274,14 +1312,15 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
+/* build-id support. */ +/* build-id support. */
+extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); +extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
+extern void debug_print_missing (const char *binary, const char *debug); +extern void debug_print_missing (const char *binary, const char *debug);
+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+ +
/* From dwarf2read.c */ /* From minidebug.c. */
/* Names for a dwarf2 debugging section. The field NORMAL is the normal extern gdb_bfd_ref_ptr find_separate_debug_file_in_section (struct objfile *);
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
--- a/gdb/testsuite/gdb.base/corefile.exp --- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -311,3 +311,33 @@ gdb_test_multiple "core-file $corefile" $test { @@ -343,3 +343,33 @@ gdb_test_multiple "core-file $corefile" $test {
pass $test pass $test
} }
} }
@ -1315,6 +1354,19 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi
+ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" + gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+ pass $wholetest + pass $wholetest
+} +}
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -185,7 +185,8 @@ proc test_empty_history_filename { } {
global env
global gdb_prompt
- set common_history [list "set height 0" "set width 0"]
+ set common_history [list "set height 0" "set width 0" \
+ "set build-id-verbose 0"]
set test_dir [standard_output_file history_test]
remote_exec host "mkdir -p $test_dir"
diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp --- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp +++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
@ -1329,7 +1381,17 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp
@@ -1891,6 +1891,17 @@ proc default_gdb_start { } { @@ -130,7 +130,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nx" \
"-data-directory $BUILD_DATA_DIRECTORY" \
{-iex "set height 0"} \
- {-iex "set width 0"}]]
+ {-iex "set width 0"} \
+ {-iex "set build-id-verbose 0"}]]
}
# The variable gdb_prompt is a regexp which matches the gdb prompt.
@@ -2130,6 +2131,17 @@ proc default_gdb_start { } {
} }
} }
@ -1350,7 +1412,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp --- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp
@@ -309,6 +309,16 @@ proc default_mi_gdb_start { args } { @@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0." warning "Couldn't set the width to 0."
} }
} }

View File

@ -1,3 +1,19 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-bz229517-gcore-without-terminal.patch
;; Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,17 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-bz230000-power6-disassembly-test.patch
;; Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.exp b/gdb/testsuite/gdb.arch/powerpc-power6.exp diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.exp b/gdb/testsuite/gdb.arch/powerpc-power6.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
;;=fedoratest
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/atomic-seq-threaded.c,
gdb.threads/atomic-seq-threaded.exp: New files.
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-testsuite-timeouts.patch
;; Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
--- a/gdb/testsuite/gdb.base/annota1.exp --- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp

View File

@ -1,3 +1,23 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.7-charsign-test.patch
;; Fix displaying of numeric char arrays as strings (BZ 224128).
;;=fedoratest: But it is failing anyway, one should check the behavior more.
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.
diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,26 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch
;; Test PPC hiding of call-volatile parameter register.
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,7 +1,34 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.7-testsuite-stable-results.patch
;; Testsuite fixes for more stable/comparable results.
;;=fedoratest
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.
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
--- a/gdb/testsuite/gdb.base/fileio.c --- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c
@@ -560,6 +560,28 @@ strerrno (int err) @@ -559,6 +559,28 @@ strerrno (int err)
int int
main () main ()
{ {

View File

@ -1,3 +1,13 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.8-bz442765-threaded-exec-test.patch
;; Test various forms of threads tracking across exec() (BZ 442765).
;;=fedoratest
Test various forms of threads tracking across exec(2).
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
--- a/gdb/testsuite/gdb.threads/threaded-exec.c --- a/gdb/testsuite/gdb.threads/threaded-exec.c
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c +++ b/gdb/testsuite/gdb.threads/threaded-exec.c
@ -165,7 +175,7 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr
+gdb_load ${binfile_nothreads} +gdb_load ${binfile_nothreads}
-gdb_run_cmd -gdb_run_cmd
+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0 +gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0]
gdb_test_multiple {} "Program exited" { gdb_test_multiple {} "Program exited" {
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {

View File

@ -1,3 +1,13 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.8-bz466901-backtrace-full-prelinked.patch
;; Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
;;=fedoratest
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,63 +0,0 @@
diff --git a/gdb/defs.h b/gdb/defs.h
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -168,6 +168,10 @@ extern void default_quit_handler (void);
/* Flag that function quit should call quit_force. */
extern volatile int sync_quit_force_run;
+#ifdef NEED_DETACH_SIGSTOP
+extern int quit_flag_cleanup;
+#endif
+
extern void quit (void);
/* Helper for the QUIT macro. */
diff --git a/gdb/extension.c b/gdb/extension.c
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -823,6 +823,11 @@ check_quit_flag (void)
int i, result = 0;
const struct extension_language_defn *extlang;
+#ifdef NEED_DETACH_SIGSTOP
+ if (quit_flag_cleanup)
+ return 0;
+#endif
+
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
{
if (extlang->ops->check_quit_flag != NULL)
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1703,7 +1703,13 @@ quit_force (int *exit_arg, int from_tty)
qt.from_tty = from_tty;
+#ifndef NEED_DETACH_SIGSTOP
/* We want to handle any quit errors and exit regardless. */
+#else
+ /* 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;
+#endif
/* Get out of tfind mode, and kill or detach all inferiors. */
try
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -102,6 +102,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
static bool debug_timestamp = false;
+#ifdef NEED_DETACH_SIGSTOP
+/* Nonzero means we are already processing the quitting cleanups and we should
+ no longer get aborted. */
+
+int quit_flag_cleanup;
+#endif
+
/* True means that strings with character values >0x7F should be printed
as octal escapes. False means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */

View File

@ -1,3 +1,14 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-archer-next-over-throw-cxx-exec.patch
;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
;;=fedoratest
Archer-upstreamed:
http://sourceware.org/ml/archer/2010-q2/msg00031.html
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,95 +0,0 @@
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15396,6 +15396,51 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
+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);
+
+ bl->address += delta_offset;
+ bl->requested_address += delta_offset;
+
+ changed = 1;
+ }
+ }
+ }
+
+ if (changed)
+ std::sort (bp_locations, bp_locations + bp_locations_count,
+ bp_location_is_less_than);
+}
+
+void _initialize_breakpoint (void);
void
_initialize_breakpoint (void)
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1696,6 +1696,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
UIOUT iff debugging multiple threads. */
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+
/* Print the specified breakpoint. */
extern void print_breakpoint (breakpoint *bp);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -816,6 +816,11 @@ objfile_relocate1 (struct objfile *objfile,
obj_section_addr (s));
}
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
+ their addresses match. */
+ if (objfile->separate_debug_objfile_backlink == NULL)
+ breakpoints_relocate (objfile, delta);
+
/* Data changed. */
return 1;
}
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2840,7 +2840,7 @@ value_static_field (struct type *type, int fieldno)
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
- + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

View File

@ -1,56 +0,0 @@
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -516,6 +516,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 */
@@ -566,6 +567,7 @@ union field_location
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;
@@ -1474,6 +1476,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#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) \
@@ -1485,6 +1488,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#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))
@@ -1501,6 +1505,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#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))
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno)
{
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 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +0,0 @@
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -80,6 +80,7 @@ PYTHON_FILE_LIST = \
gdb/unwinder.py \
gdb/xmethod.py \
gdb/command/__init__.py \
+ gdb/command/ignore_errors.py \
gdb/command/explore.py \
gdb/command/backtrace.py \
gdb/command/frame_filters.py \
@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \
gdb/function/as_string.py \
gdb/function/caller_is.py \
gdb/function/strfns.py \
+ gdb/function/in_scope.py \
gdb/printer/__init__.py \
gdb/printer/bound_registers.py
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
--- a/gdb/gdb-gdb.gdb.in
+++ b/gdb/gdb-gdb.gdb.in
@@ -1,5 +1,15 @@
echo Setting up the environment for debugging gdb.\n
+# Set up the Python library and "require" command.
+python
+from os.path import abspath
+gdb.datadir = abspath ('@srcdir@/python/lib')
+gdb.pythonlibdir = gdb.datadir
+gdb.__path__ = [gdb.datadir + '/gdb']
+sys.path.insert(0, gdb.datadir)
+end
+source @srcdir@/python/lib/gdb/__init__.py
+
if !$gdb_init_done
set variable $gdb_init_done = 1
diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/ignore_errors.py
@@ -0,0 +1,37 @@
+# Ignore errors in user commands.
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+class IgnoreErrorsCommand (gdb.Command):
+ """Execute a single command, ignoring all errors.
+Only one-line commands are supported.
+This is primarily useful in scripts."""
+
+ def __init__ (self):
+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
+ gdb.COMMAND_OBSCURE,
+ # FIXME...
+ gdb.COMPLETE_COMMAND)
+
+ def invoke (self, arg, from_tty):
+ try:
+ gdb.execute (arg, from_tty)
+ except:
+ pass
+
+IgnoreErrorsCommand ()
diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/function/in_scope.py
@@ -0,0 +1,47 @@
+# In-scope function.
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+class InScope (gdb.Function):
+ """Return True if all the given variables or macros are in scope.
+Takes one argument for each variable name to be checked."""
+
+ def __init__ (self):
+ super (InScope, self).__init__ ("in_scope")
+
+ def invoke (self, *vars):
+ if len (vars) == 0:
+ raise (TypeError, "in_scope takes at least one argument")
+
+ # gdb.Value isn't hashable so it can't be put in a map.
+ # Convert to string first.
+ wanted = set (map (lambda x: x.string (), vars))
+ found = set ()
+ block = gdb.selected_frame ().block ()
+ while block:
+ for sym in block:
+ if (sym.is_argument or sym.is_constant
+ or sym.is_function or sym.is_variable):
+ if sym.name in wanted:
+ found.add (sym.name)
+
+ block = block.superblock
+
+ return wanted == found
+
+InScope ()
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r
gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
+gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
+
# Can read SP register.
gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \
" = True" \
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -419,6 +419,15 @@ proc test_value_after_death {} {
"print value's type"
}
+# Regression test for a cast failure. The bug was that if we cast a
+# value to its own type, gdb could crash. This happened because we
+# could end up double-freeing a struct value.
+proc test_cast_regression {} {
+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
+ gdb_test "python print(v)" "5" "print value for cast test"
+}
+
# Regression test for invalid subscript operations. The bug was that
# the type of the value was not being checked before allowing a
# subscript operation to proceed.
@@ -606,6 +615,7 @@ test_value_in_inferior
test_value_from_buffer
test_inferior_function_call
test_value_after_death
+test_cast_regression
# Test either C or C++ values.

View File

@ -1,312 +0,0 @@
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -251,6 +251,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
@@ -386,6 +389,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -16434,6 +16434,64 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1964,6 +1964,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -125,6 +125,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
@@ -210,6 +213,9 @@
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setns' function. */
#undef HAVE_SETNS
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -9398,6 +9398,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -465,6 +465,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -968,7 +968,16 @@ linux_ptrace_fun ()
{
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
(PTRACE_TYPE_ARG4) 0) < 0)
- trace_start_error_with_name ("ptrace");
+ {
+ int save_errno = errno;
+
+ std::string msg (linux_ptrace_create_warnings ());
+
+ msg += _("Cannot trace created process");
+
+ errno = save_errno;
+ trace_start_error_with_name (msg.c_str ());
+ }
if (setpgid (0, 0) < 0)
trace_start_error_with_name ("setpgid");
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1092,7 +1092,16 @@ linux_nat_target::create_inferior (const char *exec_file,
/* Make sure we report all signals during startup. */
pass_signals ({});
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ try
+ {
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ std::string result = linux_ptrace_create_warnings ();
+
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ());
+ }
}
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -25,6 +25,10 @@
#include <sys/procfs.h>
#endif
+#ifdef HAVE_SELINUX_SELINUX_H
+# include <selinux/selinux.h>
+#endif /* HAVE_SELINUX_SELINUX_H */
+
/* Stores the ptrace options supported by the running kernel.
A value of -1 means we did not check for features yet. A value
of 0 means there are no supported features. */
@@ -50,6 +54,8 @@ linux_ptrace_attach_fail_reason (pid_t pid)
"terminated"),
(int) pid);
+ result += linux_ptrace_create_warnings ();
+
return result;
}
@@ -586,6 +592,25 @@ linux_ptrace_init_warnings (void)
linux_ptrace_test_ret_to_nx ();
}
+/* Print all possible reasons we could fail to create a traced process. */
+
+std::string
+linux_ptrace_create_warnings ()
+{
+ std::string result;
+
+#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)
+ string_appendf (result,
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
+ "you can disable this process attach protection by: "
+ "(gdb) shell sudo setsebool deny_ptrace=0\n"));
+#endif /* HAVE_LIBSELINUX */
+ return result;
+}
+
/* Extract extended ptrace event from wait status. */
int
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -184,6 +184,7 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
extern void linux_ptrace_init_warnings (void);
+extern std::string linux_ptrace_create_warnings ();
extern void linux_check_ptrace_features (void);
extern void linux_enable_event_reporting (pid_t pid, int attached);
extern void linux_disable_event_reporting (pid_t pid);

View File

@ -1,32 +0,0 @@
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
htab_eq_pointer,
NULL));
+ int count_printed = 0;
while (true)
{
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
{
if (PyErr_Occurred ())
{
- gdbpy_print_stack_or_quit ();
- return EXT_LANG_BT_ERROR;
+ gdbpy_print_stack ();
+ return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS;
}
break;
}
@@ -1245,7 +1246,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
/* Do not exit on error printing a single frame. Print the
error and continue with other frames. */
if (success == EXT_LANG_BT_ERROR)
- gdbpy_print_stack_or_quit ();
+ gdbpy_print_stack ();
+ count_printed++;
}
return success;

View File

@ -1,99 +0,0 @@
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1148,7 +1148,10 @@ captured_main_1 (struct captured_main_args *context)
{
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);
- if (ret == 0)
+ if (ret == 0
+ /* attach_command could succeed partially and core_file_command
+ would try to kill it. */
+ && !have_inferiors ())
ret = catch_command_errors (core_file_command,
pid_or_core_arg,
!batch_flag);
diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-kills.c
@@ -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;
+}
diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-kills.exp
@@ -0,0 +1,49 @@
+# 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/>.
+
+if { ![can_spawn_for_attach] } {
+ return 0
+}
+
+standard_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 test_spawn_id [spawn_wait_for_attach $binfile]
+set testpid [spawn_id_get_pid $test_spawn_id]
+
+remote_exec target "cp -pf -- $binfile $binfile-copy"
+remote_exec target "rm -f -- $binfile"
+
+set test "start gdb"
+set res [gdb_spawn_with_cmdline_opts \
+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"]
+if { $res != 0} {
+ fail "$test (spawn)"
+ kill_wait_spawned_process $test_spawn_id
+ return -1
+}
+gdb_test_multiple "" $test {
+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+kill_wait_spawned_process $test_spawn_id

View File

@ -1,101 +0,0 @@
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6453,6 +6453,16 @@ process_event_stop_test (struct execution_control_state *ecs)
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
{
+ struct symbol *stop_fn = find_pc_function (stop_pc);
+ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym;
+
+ if ((stop_fn == NULL
+ || strstr (stop_fn->linkage_name (), ".omp_fn.") == NULL)
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
+ && (stopf == NULL
+ || strstr (stopf->linkage_name (), "._omp_fn.") == NULL))
+{ /* ".omp_fn." */
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -6486,6 +6496,7 @@ process_event_stop_test (struct execution_control_state *ecs)
keep_going (ecs);
return;
+} /* ".omp_fn." */
}
/* If we are in a function call trampoline (a stub between the
diff --git a/gdb/testsuite/gdb.fortran/omp-step.exp b/gdb/testsuite/gdb.fortran/omp-step.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/omp-step.exp
@@ -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.*"
diff --git a/gdb/testsuite/gdb.fortran/omp-step.f90 b/gdb/testsuite/gdb.fortran/omp-step.f90
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/omp-step.f90
@@ -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

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-bz601887-dwarf4-rh-test.patch
;; Backport DWARF-4 support (BZ 601887, Tom Tromey).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-bz634108-solib_address.patch
;; Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
;;=fedoratest
Fix gdb.solib_address (fix by Phil Muldoon).
s/solib_address/solib_name/ during upstreaming.
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -26,4 +38,4 @@ new file mode 100644
+# Skip all tests if Python scripting is not enabled. +# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue } +if { [skip_python_tests] } { continue }
+ +
+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" +gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists"

View File

@ -1,8 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-ccache-workaround.patch
;; Workaround ccache making lineno non-zero for command-line definitions.
;;=fedoratest: ccache is rarely used and it is even fixed now.
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
--- a/gdb/testsuite/gdb.base/macscp.exp --- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -25,6 +25,14 @@ if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } { @@ -27,6 +27,14 @@ if { [test_compiler_info "gcc-*"] } {
lappend options additional_flags=-g3 lappend options additional_flags=-fdebug-macro
} }
+# Workaround ccache making lineno non-zero for command-line definitions. +# Workaround ccache making lineno non-zero for command-line definitions.

View File

@ -1,7 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-container-rh-pkg.patch
;; Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
;;=fedora
diff --git a/gdb/remote.c b/gdb/remote.c diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c --- a/gdb/remote.c
+++ b/gdb/remote.c +++ b/gdb/remote.c
@@ -13916,7 +13916,17 @@ remote_target::pid_to_exec_file (int pid) @@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL; char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
@ -18,5 +26,5 @@ diff --git a/gdb/remote.c b/gdb/remote.c
+ return NULL; + return NULL;
+ } + }
inf = find_inferior_pid (pid); inferior *inf = find_inferior_pid (this, pid);
if (inf == NULL) if (inf == NULL)

View File

@ -1,3 +1,21 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-core-open-vdso-warning.patch
;; Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
;; Fix regression of undisplayed missing shared libraries caused by a fix for.
;;=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
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. ]
commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f
Author: Ulrich Weigand <uweigand@de.ibm.com>
Date: Wed Sep 25 11:52:50 2013 +0000
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
--- a/gdb/testsuite/gdb.base/solib-symbol.exp --- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp +++ b/gdb/testsuite/gdb.base/solib-symbol.exp

View File

@ -1,305 +0,0 @@
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -71,6 +71,8 @@ PYTHON_FILE_LIST = \
gdb/__init__.py \
gdb/FrameDecorator.py \
gdb/FrameIterator.py \
+ gdb/FrameWrapper.py \
+ gdb/backtrace.py \
gdb/frames.py \
gdb/printing.py \
gdb/prompt.py \
@@ -79,6 +81,7 @@ PYTHON_FILE_LIST = \
gdb/xmethod.py \
gdb/command/__init__.py \
gdb/command/explore.py \
+ gdb/command/backtrace.py \
gdb/command/frame_filters.py \
gdb/command/pretty_printers.py \
gdb/command/prompt.py \
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/FrameWrapper.py
@@ -0,0 +1,122 @@
+# Wrapper API for frames.
+
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+# FIXME: arguably all this should be on Frame somehow.
+class FrameWrapper:
+ def __init__ (self, frame):
+ self.frame = frame;
+
+ def write_symbol (self, stream, sym, block):
+ if len (sym.linkage_name):
+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
+ sym = nsym
+
+ stream.write (sym.print_name + "=")
+ try:
+ val = self.read_var (sym)
+ if val != None:
+ val = str (val)
+ # FIXME: would be nice to have a more precise exception here.
+ except RuntimeError as text:
+ val = text
+ if val == None:
+ stream.write ("???")
+ else:
+ stream.write (str (val))
+
+ def print_frame_locals (self, stream, func):
+
+ try:
+ block = self.frame.block()
+ except RuntimeError:
+ block = None
+
+ while block != None:
+ if block.is_global or block.is_static:
+ break
+
+ for sym in block:
+ if sym.is_argument:
+ continue;
+
+ self.write_symbol (stream, sym, block)
+ stream.write ('\n')
+
+ def print_frame_args (self, stream, func):
+
+ try:
+ block = self.frame.block()
+ except RuntimeError:
+ block = None
+
+ while block != None:
+ if block.function != None:
+ break
+ block = block.superblock
+
+ first = True
+ for sym in block:
+ if not sym.is_argument:
+ continue;
+
+ if not first:
+ stream.write (", ")
+
+ self.write_symbol (stream, sym, block)
+ first = False
+
+ # FIXME: this should probably just be a method on gdb.Frame.
+ # But then we need stream wrappers.
+ def describe (self, stream, full):
+ if self.type () == gdb.DUMMY_FRAME:
+ stream.write (" <function called from gdb>\n")
+ elif self.type () == gdb.SIGTRAMP_FRAME:
+ stream.write (" <signal handler called>\n")
+ else:
+ sal = self.find_sal ()
+ pc = self.pc ()
+ name = self.name ()
+ if not name:
+ name = "??"
+ if pc != sal.pc or not sal.symtab:
+ stream.write (" 0x%08x in" % pc)
+ stream.write (" " + name + " (")
+
+ func = self.function ()
+ self.print_frame_args (stream, func)
+
+ stream.write (")")
+
+ if sal.symtab and sal.symtab.filename:
+ stream.write (" at " + sal.symtab.filename)
+ stream.write (":" + str (sal.line))
+
+ if not self.name () or (not sal.symtab or not sal.symtab.filename):
+ lib = gdb.solib_name (pc)
+ if lib:
+ stream.write (" from " + lib)
+
+ stream.write ("\n")
+
+ if full:
+ self.print_frame_locals (stream, func)
+
+ def __getattr__ (self, name):
+ return getattr (self.frame, name)
diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/backtrace.py
@@ -0,0 +1,42 @@
+# Filtering backtrace.
+
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import itertools
+
+# Our only exports.
+__all__ = ['push_frame_filter', 'create_frame_filter']
+
+old_frame_filter = None
+
+def push_frame_filter (constructor):
+ """Register a new backtrace filter class with the 'backtrace' command.
+The filter will be passed an iterator as an argument. The iterator
+will return gdb.Frame-like objects. The filter should in turn act as
+an iterator returning such objects."""
+ global old_frame_filter
+ if old_frame_filter == None:
+ old_frame_filter = constructor
+ else:
+ old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator))
+
+def create_frame_filter (iter):
+ global old_frame_filter
+ if old_frame_filter is None:
+ return iter
+ return old_frame_filter (iter)
+
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -0,0 +1,106 @@
+# New backtrace command.
+
+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import gdb.backtrace
+import itertools
+from gdb.FrameIterator import FrameIterator
+from gdb.FrameWrapper import FrameWrapper
+import sys
+
+class ReverseBacktraceParameter (gdb.Parameter):
+ """The new-backtrace command can show backtraces in 'reverse' order.
+This means that the innermost frame will be printed last.
+Note that reverse backtraces are more expensive to compute."""
+
+ set_doc = "Enable or disable reverse backtraces."
+ show_doc = "Show whether backtraces will be printed in reverse order."
+
+ def __init__(self):
+ gdb.Parameter.__init__ (self, "reverse-backtrace",
+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN)
+ # Default to compatibility with gdb.
+ self.value = False
+
+class FilteringBacktrace (gdb.Command):
+ """Print backtrace of all stack frames, or innermost COUNT frames.
+With a negative argument, print outermost -COUNT frames.
+Use of the 'full' qualifier also prints the values of the local variables.
+Use of the 'raw' qualifier avoids any filtering by loadable modules.
+"""
+
+ def __init__ (self):
+ # FIXME: this is not working quite well enough to replace
+ # "backtrace" yet.
+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK)
+ self.reverse = ReverseBacktraceParameter()
+
+ def reverse_iter (self, iter):
+ result = []
+ for item in iter:
+ result.append (item)
+ result.reverse()
+ return result
+
+ def final_n (self, iter, x):
+ result = []
+ for item in iter:
+ result.append (item)
+ return result[x:]
+
+ def invoke (self, arg, from_tty):
+ i = 0
+ count = 0
+ filter = True
+ full = False
+
+ for word in arg.split (" "):
+ if word == '':
+ continue
+ elif word == 'raw':
+ filter = False
+ elif word == 'full':
+ full = True
+ else:
+ count = int (word)
+
+ # FIXME: provide option to start at selected frame
+ # However, should still number as if starting from newest
+ newest_frame = gdb.newest_frame()
+ iter = itertools.imap (FrameWrapper,
+ FrameIterator (newest_frame))
+ if filter:
+ iter = gdb.backtrace.create_frame_filter (iter)
+
+ # Now wrap in an iterator that numbers the frames.
+ iter = itertools.izip (itertools.count (0), iter)
+
+ # Reverse if the user wanted that.
+ if self.reverse.value:
+ iter = self.reverse_iter (iter)
+
+ # Extract sub-range user wants.
+ if count < 0:
+ iter = self.final_n (iter, count)
+ elif count > 0:
+ iter = itertools.islice (iter, 0, count)
+
+ for pair in iter:
+ sys.stdout.write ("#%-2d" % pair[0])
+ pair[1].describe (sys.stdout, full)
+
+FilteringBacktrace()

View File

@ -1,7 +1,18 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-fedora-libncursesw.patch
;; Force libncursesw over libncurses to match the includes (RH BZ 1270534).
;;=push+jan
Fedora: Force libncursesw over libncurses to match the includes.
https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -9375,6 +9375,7 @@ if test x"$prefer_curses" = xyes; then @@ -9544,6 +9544,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A # search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such # default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation. # a situation.
@ -9,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; } $as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then : if ${ac_cv_search_waddstr+:} false; then :
@@ -9399,7 +9400,7 @@ return waddstr (); @@ -9568,7 +9569,7 @@ return waddstr ();
return 0; return 0;
} }
_ACEOF _ACEOF
@ -18,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then if test -z "$ac_lib"; then
ac_res="none required" ac_res="none required"
else else
@@ -9473,6 +9474,7 @@ case $host_os in @@ -9642,6 +9643,7 @@ case $host_os in
esac esac
# These are the libraries checked by Readline. # These are the libraries checked by Readline.
@ -26,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; } $as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then : if ${ac_cv_search_tgetent+:} false; then :
@@ -9497,7 +9499,7 @@ return tgetent (); @@ -9666,7 +9668,7 @@ return tgetent ();
return 0; return 0;
} }
_ACEOF _ACEOF
@ -38,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac --- a/gdb/configure.ac
+++ b/gdb/configure.ac +++ b/gdb/configure.ac
@@ -717,7 +717,8 @@ if test x"$prefer_curses" = xyes; then @@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A # search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such # default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation. # a situation.
@ -48,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then if test "$ac_cv_search_waddstr" != no; then
curses_found=yes curses_found=yes
@@ -759,7 +760,8 @@ case $host_os in @@ -778,7 +779,8 @@ case $host_os in
esac esac
# These are the libraries checked by Readline. # These are the libraries checked by Readline.

View File

@ -1,3 +1,33 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-fortran-frame-string.patch
;; Display Fortran strings in backtraces.
;;=fedoratest
http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
Hi,
for Fortran it fixes displaying normal strings also in frames/backtraces:
(gdb) frame
->
The patch is simple and I do not see why it should not be this way.
For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that
language is currently not really much supported in GDB anyway.
This was a part of my archer/jankratochvil/vla branch but it is not a part of
the Intel VLA patchset as it in fact is completely unrelated to "VLA".
No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.
Thanks,
Jan
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,8 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-glibc-strstr-workaround.patch
;; Workaround PR libc/14166 for inferior calls of strstr.
;;=fedoratest: Compatibility with RHELs (unchecked which ones).
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -0,0 +1,115 @@ @@ -0,0 +1,119 @@
+# Copyright (C) 2012 Free Software Foundation, Inc. +# Copyright (C) 2012 Free Software Foundation, Inc.
+ +
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -48,6 +56,10 @@ new file mode 100644
+ untested "$test (no DWARF)" + untested "$test (no DWARF)"
+ return 0 + return 0
+ } + }
+ -re "type = <unknown return type> \\(\\)\r\n$gdb_prompt $" {
+ untested "$test (no DWARF)"
+ return 0
+ }
+} +}
+ +
+set addr "" +set addr ""
@ -116,5 +128,5 @@ new file mode 100644
+ } + }
+} +}
+ +
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} +gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} +gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"}

View File

@ -1,195 +0,0 @@
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10657,6 +10657,13 @@ private:
static void
process_die (struct die_info *die, struct dwarf2_cu *cu)
{
+ if (die->in_process)
+ {
+ complaint (_("DIE at 0x%s attempted to be processed twice"),
+ sect_offset_str (die->sect_off));
+ return;
+ }
+
process_die_scope scope (die, cu);
switch (die->tag)
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -601,6 +601,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
target_pid_to_str (process_ptid).c_str ());
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* 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. */
+#endif
target_detach (parent_inf, 0);
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -189,6 +189,12 @@ struct linux_nat_target *linux_target;
/* Does the current host support PTRACE_GETREGSET? */
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
+#ifdef NEED_DETACH_SIGSTOP
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped;
+
+#endif
+
static unsigned int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -1030,6 +1036,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = ptid.pid ();
+#endif
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1361,6 +1370,25 @@ get_detach_signal (struct lwp_info *lp)
return gdb_signal_to_host (signo);
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
+ many TIDs are left unstopped). See RH Bug 496732. */
+ if (lp->ptid.pid () == pid_was_stopped)
+ {
+ int err;
+
+ errno = 0;
+ err = kill_lwp (lp->ptid.lwp (), SIGSTOP);
+ if (debug_linux_nat)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: lwp kill %d %s\n",
+ err,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
+ }
+ }
+
+#endif
return 0;
}
@@ -1509,6 +1537,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
detach_one_lwp (main_lwp, &signo);
detach_success (inf);
+
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = 0;
+#endif
}
}
@@ -1766,6 +1798,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
return;
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* 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 == lp->ptid.pid ())
+ pid_was_stopped = 0;
+
+#endif
if (resume_many)
iterate_over_lwps (ptid, [=] (struct lwp_info *info)
{
@@ -3770,6 +3812,10 @@ linux_nat_target::mourn_inferior ()
/* Let the arch-specific native code know this process is gone. */
linux_target->low_forget_process (pid);
+#ifdef NEED_DETACH_SIGSTOP
+
+ pid_was_stopped = 0;
+#endif
}
/* Convert a native/host siginfo object, into/from the siginfo in the
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -56,7 +56,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" {

View File

@ -1,38 +0,0 @@
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9694,10 +9694,12 @@ _ACEOF
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
- TARGET_PTR="unsigned long"
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
+# content is the same for multilib distributions.
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
TARGET_PTR="unsigned long long"
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
+ TARGET_PTR="unsigned long"
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
TARGET_PTR="unsigned __int128"
else
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -808,10 +808,12 @@ AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned __int128)
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
- TARGET_PTR="unsigned long"
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
+# content is the same for multilib distributions.
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
TARGET_PTR="unsigned long long"
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
+ TARGET_PTR="unsigned long"
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
TARGET_PTR="unsigned __int128"
else

View File

@ -1,3 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-libexec-add-index.patch
;; Fix gdb-headless /usr/bin/ executables (BZ 1390251).
;;
;; Also, make /usr/bin/gdb.minimal be the default GDB used, if it's
;; present. For rationale, see:
;;
;; https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
;;=fedora
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
--- a/gdb/contrib/gdb-add-index.sh --- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh +++ b/gdb/contrib/gdb-add-index.sh

View File

@ -1,3 +1,19 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-lineno-makeup-test.patch
;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
;;=fedoratest
New testcase for:
https://bugzilla.redhat.com/show_bug.cgi?id=466222
(for the first / customer recommended fix)
and the upstream fix:
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
[rfc] Do not make up line information
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,27 +1,11 @@
diff --git a/gdb/configure b/gdb/configure From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
--- a/gdb/configure From: Fedora GDB patches <invalid@email.com>
+++ b/gdb/configure Date: Fri, 27 Oct 2017 21:07:50 +0200
@@ -11905,7 +11905,7 @@ else Subject: gdb-linux_perf-bundle.patch
#include <linux/perf_event.h> ;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
#ifndef PERF_ATTR_SIZE_VER5 ;;=fedora
-# error
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
_ACEOF
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1414,7 +1414,7 @@ else
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
-# error
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
]])], [perf_event=yes], [perf_event=no])
if test "$perf_event" != yes; then
diff --git a/gdb/gdb.c b/gdb/gdb.c diff --git a/gdb/gdb.c b/gdb/gdb.c
--- a/gdb/gdb.c --- a/gdb/gdb.c
+++ b/gdb/gdb.c +++ b/gdb/gdb.c
@ -226,3 +210,15 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
struct target_ops; struct target_ops;
#if HAVE_LINUX_PERF_EVENT_H #if HAVE_LINUX_PERF_EVENT_H
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
- # error
+ // error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
]])], [perf_event=yes], [perf_event=no])
if test "$perf_event" != yes; then

View File

@ -1,12 +0,0 @@
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11904,6 +11904,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
traps we can no longer explain. */
old_loc->events_till_retirement = 3 * (thread_count () + 1);
+ /* Red Hat Bug 590623. */
+ old_loc->events_till_retirement *= 10;
old_loc->owner = NULL;
moribund_locations.push_back (old_loc);

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-opcodes-clflushopt-test.patch
;; Test clflushopt instruction decode (for RH BZ 1262471).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,8 +1,18 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-physname-pr11734-test.patch
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
;;=fedoratest
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-1.cc +++ b/gdb/testsuite/gdb.cp/pr11734-1.cc
@@ -0,0 +1,30 @@ @@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2010 Free Software Foundation, Inc. + Copyright 2010 Free Software Foundation, Inc.
@ -32,12 +42,11 @@ new file mode 100644
+ p->foo (); + p->foo ();
+ return 0; + return 0;
+} +}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-2.cc +++ b/gdb/testsuite/gdb.cp/pr11734-2.cc
@@ -0,0 +1,27 @@ @@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2010 Free Software Foundation, Inc. + Copyright 2010 Free Software Foundation, Inc.
@ -64,12 +73,11 @@ new file mode 100644
+pr11734::foo(void) +pr11734::foo(void)
+{ +{
+} +}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-3.cc +++ b/gdb/testsuite/gdb.cp/pr11734-3.cc
@@ -0,0 +1,27 @@ @@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2010 Free Software Foundation, Inc. + Copyright 2010 Free Software Foundation, Inc.
@ -96,12 +104,11 @@ new file mode 100644
+pr11734::foo (int a) +pr11734::foo (int a)
+{ +{
+} +}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-4.cc +++ b/gdb/testsuite/gdb.cp/pr11734-4.cc
@@ -0,0 +1,27 @@ @@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2010 Free Software Foundation, Inc. + Copyright 2010 Free Software Foundation, Inc.
@ -128,7 +135,6 @@ new file mode 100644
+pr11734::foo (char *a) +pr11734::foo (char *a)
+{ +{
+} +}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734.exp b/gdb/testsuite/gdb.cp/pr11734.exp diff --git a/gdb/testsuite/gdb.cp/pr11734.exp b/gdb/testsuite/gdb.cp/pr11734.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -193,7 +199,7 @@ diff --git a/gdb/testsuite/gdb.cp/pr11734.h b/gdb/testsuite/gdb.cp/pr11734.h
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734.h +++ b/gdb/testsuite/gdb.cp/pr11734.h
@@ -0,0 +1,28 @@ @@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
+ Copyright 2010 Free Software Foundation, Inc. + Copyright 2010 Free Software Foundation, Inc.
@ -221,4 +227,3 @@ new file mode 100644
+ void foo (int); + void foo (int);
+ void foo (char *); + void foo (char *);
+}; +};
+

View File

@ -1,3 +1,13 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-physname-pr12273-test.patch
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
;;=fedoratest
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-ppc-power7-test.patch
;; Test power7 ppc disassembly.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7rh.exp b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp diff --git a/gdb/testsuite/gdb.arch/powerpc-power7rh.exp b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -0,0 +1,258 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Bruno Larsen <blarsen@redhat.com>
Date: Tue, 9 Nov 2021 14:07:26 -0300
Subject: gdb-rhbz-853071-update-manpages.patch
;; Backport manpage update
[gdb/doc]: Updated manpages to be consistent with help
Updated manpages to be consistent with help information provided by the
binary. The main changes are:
* Making all long-form options have '--', instead of a single '-';
* added most of the missing options to the manpage;
* removed the information about using '+' instead of '-', since it
doesn't seem to be supported anymore.
This also fixes 2 upstream bugs:
* https://sourceware.org/bugzilla/show_bug.cgi?id=23965; by adding
--args to the manpage
* https://sourceware.org/bugzilla/show_bug.cgi?id=10619; by adding the
double dashes
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -47030,14 +47030,7 @@ switch (die->tag)
@c man title gdb The GNU Debugger
@c man begin SYNOPSIS gdb
-gdb [@option{-help}] [@option{-nh}] [@option{-nx}] [@option{-q}]
-[@option{-batch}] [@option{-cd=}@var{dir}] [@option{-f}]
-[@option{-b}@w{ }@var{bps}]
- [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}]
-[@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}]
-[@option{-c}@w{ }@var{core}] [@option{-p}@w{ }@var{procID}]
- [@option{-x}@w{ }@var{cmds}] [@option{-d}@w{ }@var{dir}]
-[@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}]
+gdb [OPTIONS] [@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}]
@c man end
@c man begin DESCRIPTION gdb
@@ -47101,8 +47094,8 @@ Here are some of the most frequently needed @value{GDBN} commands:
@c pod2man highlights the right hand side of the @item lines.
@table @env
-@item break [@var{file}:]@var{function}
-Set a breakpoint at @var{function} (in @var{file}).
+@item break [@var{file}:][@var{function}|@var{line}]
+Set a breakpoint at @var{function} or @var{line} (in @var{file}).
@item run [@var{arglist}]
Start your program (with @var{arglist}, if specified).
@@ -47150,72 +47143,91 @@ as the @code{gdb} entry in the @code{info} program.
Any arguments other than options specify an executable
file and core file (or process ID); that is, the first argument
encountered with no
-associated option flag is equivalent to a @option{-se} option, and the second,
+associated option flag is equivalent to a @option{--se} option, and the second,
if any, is equivalent to a @option{-c} option if it's the name of a file.
Many options have
-both long and short forms; both are shown here. The long forms are also
+both long and abbreviated forms; both are shown here. The long forms are also
recognized if you truncate them, so long as enough of the option is
-present to be unambiguous. (If you prefer, you can flag option
-arguments with @option{+} rather than @option{-}, though we illustrate the
-more usual convention.)
+present to be unambiguous.
+
+The abbreviated forms are shown here with @samp{-} and long forms are shown
+with @samp{--} to reflect how they are shown in @option{--help}. However,
+@value{GDBN} recognizes all of the following conventions for most options:
+
+@table @code
+@item --option=@var{value}
+@item --option @var{value}
+@item -option=@var{value}
+@item -option @var{value}
+@item --o=@var{value}
+@item --o @var{value}
+@item -o=@var{value}
+@item -o @var{value}
+@end table
All the options and command line arguments you give are processed
in sequential order. The order makes a difference when the @option{-x}
option is used.
@table @env
-@item -help
+@item --help
@itemx -h
List all options, with brief explanations.
-@item -symbols=@var{file}
+@item --symbols=@var{file}
@itemx -s @var{file}
-Read symbol table from file @var{file}.
+Read symbol table from @var{file}.
-@item -write
+@item --write
Enable writing into executable and core files.
-@item -exec=@var{file}
+@item --exec=@var{file}
@itemx -e @var{file}
-Use file @var{file} as the executable file to execute when
+Use @var{file} as the executable file to execute when
appropriate, and for examining pure data in conjunction with a core
dump.
-@item -se=@var{file}
-Read symbol table from file @var{file} and use it as the executable
+@item --se=@var{file}
+Read symbol table from @var{file} and use it as the executable
file.
-@item -core=@var{file}
+@item --core=@var{file}
@itemx -c @var{file}
-Use file @var{file} as a core dump to examine.
+Use @var{file} as a core dump to examine.
-@item -command=@var{file}
+@item --command=@var{file}
@itemx -x @var{file}
-Execute @value{GDBN} commands from file @var{file}.
+Execute @value{GDBN} commands from @var{file}.
+@item --eval-command=@var{command}
@item -ex @var{command}
Execute given @value{GDBN} @var{command}.
-@item -directory=@var{directory}
+@item --init-eval-command=@var{command}
+@item -iex
+Execute @value{GDBN} @var{command} before loading the inferior.
+
+@item --directory=@var{directory}
@itemx -d @var{directory}
Add @var{directory} to the path to search for source files.
-@item -nh
+@item --nh
Do not execute commands from @file{~/.config/gdb/gdbinit},
@file{~/.gdbinit}, @file{~/.config/gdb/gdbearlyinit}, or
@file{~/.gdbearlyinit}
-@item -nx
+@item --nx
@itemx -n
Do not execute commands from any @file{.gdbinit} or
@file{.gdbearlyinit} initialization files.
-@item -quiet
+@item --quiet
+@item --silent
@itemx -q
``Quiet''. Do not print the introductory and copyright messages. These
messages are also suppressed in batch mode.
-@item -batch
+@item --batch
Run in batch mode. Exit with status @code{0} after processing all the command
files specified with @option{-x} (and @file{.gdbinit}, if not inhibited).
Exit with nonzero status if an error occurs in executing the @value{GDBN}
@@ -47233,11 +47245,71 @@ Program exited normally.
(which is ordinarily issued whenever a program running under @value{GDBN} control
terminates) is not issued when running in batch mode.
-@item -cd=@var{directory}
+@item --batch-silent
+Run in batch mode, just like @option{--batch}, but totally silent. All @value{GDBN}
+output is supressed (stderr is unaffected). This is much quieter than
+@option{--silent} and would be useless for an interactive session.
+
+This is particularly useful when using targets that give @samp{Loading section}
+messages, for example.
+
+Note that targets that give their output via @value{GDBN}, as opposed to writing
+directly to @code{stdout}, will also be made silent.
+
+@item --args @var{prog} [@var{arglist}]
+Change interpretation of command line so that arguments following this
+option are passed as arguments to the inferior. As an example, take
+the following command:
+
+@smallexample
+gdb ./a.out -q
+@end smallexample
+
+@noindent
+It would start @value{GDBN} with @option{-q}, not printing the introductory message. On
+the other hand, using:
+
+@smallexample
+gdb --args ./a.out -q
+@end smallexample
+
+@noindent
+starts @value{GDBN} with the introductory message, and passes the option to the inferior.
+
+@item --pid=@var{pid}
+Attach @value{GDBN} to an already running program, with the PID @var{pid}.
+
+@item --tui
+Open the terminal user interface.
+
+@item --readnow
+Read all symbols from the given symfile on the first access.
+
+@item --readnever
+Do not read symbol files.
+
+@item --dbx
+Run in DBX compatibility mode.
+
+@item --return-child-result
+@value{GDBN}'s exit code will be the same as the child's exit code.
+
+@item --configuration
+Print details about GDB configuration and then exit.
+
+@item --version
+Print version information and then exit.
+
+@item --cd=@var{directory}
Run @value{GDBN} using @var{directory} as its working directory,
instead of the current directory.
-@item -fullname
+@item --data-directory=@var{directory}
+@item -D
+Run @value{GDBN} using @var{directory} as its data directory. The data
+directory is where @value{GDBN} searches for its auxiliary files.
+
+@item --fullname
@itemx -f
Emacs sets this option when it runs @value{GDBN} as a subprocess. It tells
@value{GDBN} to output the full file name and line number in a standard,
@@ -47248,11 +47320,14 @@ and character position separated by colons, and a newline. The
Emacs-to-@value{GDBN} interface program uses the two @samp{\032}
characters as a signal to display the source code for the frame.
-@item -b @var{bps}
+@item -b @var{baudrate}
Set the line speed (baud rate or bits per second) of any serial
interface used by @value{GDBN} for remote debugging.
-@item -tty=@var{device}
+@item -l @var{timeout}
+Set timeout, in seconds, for remote debugging.
+
+@item --tty=@var{device}
Run using @var{device} for your program's standard input and output.
@end table
@c man end

View File

@ -1,3 +1,33 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
;;=fedoratest
Original message by Tom Tromey:
<https://sourceware.org/ml/gdb-patches/2012-03/msg00955.html>
Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
Comment from Sergio Durigan Junior:
In order to correctly test this patch, I wrote a testcase based on Jan
Kratochvil's <gdb/testsuite/gdb.base/gcore-excessive-memory.exp>. The
testcase, which can be seen below, tests GDB in order to see if the
amount of memory being leaked is minimal, as requested in the bugzilla.
It is hard to define what "minimum" is, so I ran the testcase on all
supported RHEL architectures and came up with an average.
commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Mar 28 17:38:08 2012 +0000
* python/py-inferior.c (infpy_read_memory): Remove cleanups and
explicitly free 'buffer' on exit paths. Decref 'membuf_object'
before returning.
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,16 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
;; Kratochvil, RH BZ 1084404).
;;=fedoratest
These testcases have been created by compiling glibc-2.17-78 on
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
present at $builddir/misc/select.o.
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,47 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
;; (Philippe Waroquiers, RH BZ 1149205).
;;=fedoratest
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
Message-ID: <1368136582.30058.7.camel@soleil>
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
To: gdb-patches at sourceware dot org
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
Date: Thu, 09 May 2013 23:56:22 +0200
The attached patch fixes a gdb_assert caused by the combination of catch
signal and fork:
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
The fix consists in not detaching breakpoint locations of type bp_loc_other.
The patch introduces a new test.
Comments by Sergio Durigan Junior:
I addded a specific testcase for this patch, which tests exactly the
issue that the customer is facing. This patch does not solve the
whole problem of catching a syscall and forking (for more details,
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
specifically comment #3), but it solves the issue reported by the
customer.
I also removed the original testcase of this patch, because it
relied on "catch signal", which is a command that is not implemented
in this version of GDB.
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
Author: Philippe Waroquiers <philippe@sourceware.org>
Date: Tue May 21 18:47:05 2013 +0000
Fix internal error caused by interaction between catch signal and fork
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,12 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1156192-recursive-dlopen-test.patch
;; Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
;; crash.' (RH BZ 1156192).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
@ -72,7 +81,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/tes
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c +++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
@@ -0,0 +1,124 @@ @@ -0,0 +1,125 @@
+/* Testcase for recursive dlopen calls. +/* Testcase for recursive dlopen calls.
+ +
+ Copyright (C) 2014 Free Software Foundation, Inc. + Copyright (C) 2014 Free Software Foundation, Inc.
@ -169,6 +178,7 @@ new file mode 100644
+ /* Called recursively. */ + /* Called recursively. */
+ result = malloc (size); + result = malloc (size);
+ /* Restore new hooks. */ + /* Restore new hooks. */
+ old_malloc_hook = __malloc_hook;
+ __malloc_hook = custom_malloc_hook; + __malloc_hook = custom_malloc_hook;
+ return result; + return result;
+} +}
@ -201,7 +211,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/t
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp +++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
@@ -0,0 +1,137 @@ @@ -0,0 +1,157 @@
+# Copyright 2014 Free Software Foundation, Inc. +# Copyright 2014 Free Software Foundation, Inc.
+# +#
+# This program is free software; you can redistribute it and/or modify +# This program is free software; you can redistribute it and/or modify
@ -218,6 +228,10 @@ new file mode 100644
+# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>.
+ +
+if {[skip_shlib_tests]} { +if {[skip_shlib_tests]} {
+ untested "skipping shlib tests"
+ return 0
+} elseif {[use_gdb_stub]} {
+ untested "skipping tests because of stub"
+ return 0 + return 0
+} +}
+ +
@ -253,6 +267,21 @@ new file mode 100644
+ return -1 + return -1
+} +}
+ +
+set supported 0
+gdb_test_multiple "run" "initial trial run" {
+ -re -wrap "exited normally.*" {
+ set supported 1
+ pass $gdb_test_name
+ }
+ -re -wrap "exited with code.*" {
+ untested "failed at $gdb_test_name"
+ }
+}
+
+if { $supported == 0 } {
+ return -1
+}
+
+proc do_test { has_libfoo has_libbar } { +proc do_test { has_libfoo has_libbar } {
+ global hex binfile_lib2 binfile_lib1 gdb_prompt + global hex binfile_lib2 binfile_lib1 gdb_prompt
+ set libbar_match "[string_to_regexp $binfile_lib2]" + set libbar_match "[string_to_regexp $binfile_lib2]"
@ -305,6 +334,7 @@ new file mode 100644
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events" + gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
+ +
+ gdb_run_cmd + gdb_run_cmd
+ gdb_test "" "Wait for first prompt"
+ foreach l $solib_event_order { + foreach l $solib_event_order {
+ incr pass + incr pass
+ with_test_prefix "pass #$pass" { + with_test_prefix "pass #$pass" {

View File

@ -1,3 +1,24 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
;; description: 'C++ (and objc): Internal error on unqualified name
;; re-set', PR 11657] (RH BZ 1186476).
;;=fedoratest
Comments from Sergio Durigan Junior:
The "proper" fix for this whole problem would be to backport the
"ambiguous linespec" patch series. However, it is really not
recommended to do that for RHEL GDB, because the patch series is too
big and could introduce unwanted regressions. Instead, what we
chose to do was to replace the gdb_assert call by a warning (which
allows the user to continue the debugging session), and tell the
user that, although more than one location was found for his/her
breakpoint, only one will be used.
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
;; [aarch64] Fix hardware watchpoints (RH BZ 1261564).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1325795-framefilters-test.patch
;; New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.c b/gdb/testsuite/gdb.python/py-framefilter-thread.c diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.c b/gdb/testsuite/gdb.python/py-framefilter-thread.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,17 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1350436-type-printers-error.patch
;; Test 'info type-printers' Python error (RH BZ 1350436).
;;=fedoratest
Typo in Python support breaks info type-printers command
https://bugzilla.redhat.com/show_bug.cgi?id=1350436
[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
--- a/gdb/testsuite/gdb.python/py-typeprint.cc --- a/gdb/testsuite/gdb.python/py-typeprint.cc
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc +++ b/gdb/testsuite/gdb.python/py-typeprint.cc
@ -28,22 +42,24 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.pytho
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
--- a/gdb/testsuite/gdb.python/py-typeprint.py --- a/gdb/testsuite/gdb.python/py-typeprint.py
+++ b/gdb/testsuite/gdb.python/py-typeprint.py +++ b/gdb/testsuite/gdb.python/py-typeprint.py
@@ -15,7 +15,7 @@ @@ -15,8 +15,7 @@
import gdb import gdb
-
-class Recognizer(object): -class Recognizer(object):
+class StringRecognizer(object): +class StringRecognizer(object):
def __init__(self): def __init__(self):
self.enabled = True self.enabled = True
@@ -30,6 +30,26 @@ class StringTypePrinter(object): @@ -32,7 +31,27 @@ class StringTypePrinter(object):
self.enabled = True self.enabled = True
def instantiate(self): def instantiate(self):
- return Recognizer() - return Recognizer()
+ return StringRecognizer() + return StringRecognizer()
gdb.type_printers.append(StringTypePrinter()) gdb.type_printers.append(StringTypePrinter())
+ +
+class OtherRecognizer(object): +class OtherRecognizer(object):

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1398387-tab-crash-test.patch
;; New testcase for: Fix <tab>-completion crash (Gary Benson, RH BZ 1398387).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/tab-crash.bz2.uu b/gdb/testsuite/gdb.base/tab-crash.bz2.uu diff --git a/gdb/testsuite/gdb.base/tab-crash.bz2.uu b/gdb/testsuite/gdb.base/tab-crash.bz2.uu
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 23 Mar 2018 20:42:44 +0100
Subject: gdb-rhbz1553104-s390x-arch12-test.patch
;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
;; =fedoratest
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,12 +0,0 @@
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1937,7 +1937,7 @@ struct elf_obj_tdata
struct sdt_note *sdt_note_head;
Elf_Internal_Shdr **group_sect_ptr;
- int num_group;
+ unsigned int num_group;
/* Index into group_sect_ptr, updated by setup_group when finding a
section's group. Used to optimize subsequent group searches. */

View File

@ -1,16 +0,0 @@
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1618,7 +1618,12 @@ do_start_initialization ()
#endif
Py_Initialize ();
+#if PY_VERSION_HEX < 0x03090000
+ /* PyEval_InitThreads became deprecated in Python 3.9 and will
+ be removed in Python 3.11. Prior to Python 3.7, this call was
+ required to initialize the GIL. */
PyEval_InitThreads ();
+#endif
#ifdef IS_PY3K
gdb_module = PyImport_ImportModule ("_gdb");

View File

@ -1,94 +0,0 @@
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -234,6 +234,30 @@ gdbpy_enter::~gdbpy_enter ()
PyGILState_Release (m_state);
}
+/* A helper class to save and restore the GIL, but without touching
+ the other globals that are handled by gdbpy_enter. */
+
+class gdbpy_gil
+{
+public:
+
+ gdbpy_gil ()
+ : m_state (PyGILState_Ensure ())
+ {
+ }
+
+ ~gdbpy_gil ()
+ {
+ PyGILState_Release (m_state);
+ }
+
+ DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
+
+private:
+
+ PyGILState_STATE m_state;
+};
+
/* Set the quit flag. */
static void
@@ -247,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang)
static int
gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
{
+ if (!gdb_python_initialized)
+ return 0;
+
+ gdbpy_gil gil;
return PyOS_InterruptOccurred ();
}
@@ -924,30 +952,6 @@ gdbpy_source_script (const struct extension_language_defn *extlang,
/* Posting and handling events. */
-/* A helper class to save and restore the GIL, but without touching
- the other globals that are handled by gdbpy_enter. */
-
-class gdbpy_gil
-{
-public:
-
- gdbpy_gil ()
- : m_state (PyGILState_Ensure ())
- {
- }
-
- ~gdbpy_gil ()
- {
- PyGILState_Release (m_state);
- }
-
- DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
-
-private:
-
- PyGILState_STATE m_state;
-};
-
/* A single event. */
struct gdbpy_event
{
@@ -1548,6 +1552,7 @@ finalize_python (void *ignore)
Py_Finalize ();
+ gdb_python_initialized = false;
restore_active_ext_lang (previous_active);
}
@@ -1720,8 +1725,7 @@ do_start_initialization ()
return false;
/* Release the GIL while gdb runs. */
- PyThreadState_Swap (NULL);
- PyEval_ReleaseLock ();
+ PyEval_SaveThread ();
make_final_cleanup (finalize_python, NULL);

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1783,7 +1783,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
newline -- if chars_per_line is right, we
probably just overflowed anyway; if it's wrong,
let us keep going. */
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
}
else
{
@@ -1828,7 +1833,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
wrap_here ((char *) 0); /* Spit out chars, cancel
further wraps. */
lines_printed++;
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
lineptr++;
}
}
@@ -1923,10 +1933,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight,
int
putchar_unfiltered (int c)
{
- char buf = c;
-
- ui_file_write (gdb_stdout, &buf, 1);
- return c;
+ return fputc_unfiltered (c, gdb_stdout);
}
/* Write character C to gdb_stdout using GDB's paging mechanism and return C.
@@ -1941,9 +1948,11 @@ putchar_filtered (int c)
int
fputc_unfiltered (int c, struct ui_file *stream)
{
- char buf = c;
+ char buf[2];
- ui_file_write (stream, &buf, 1);
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, stream);
return c;
}

View File

@ -0,0 +1,30 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Wed, 29 Sep 2021 10:58:50 +0200
Subject: gdb-rhbz1976887-field-location-kind.patch
;;Backport upstream patch which fixes internal-error: Unexpected
;;type field location kind (RHBZ 1976887).
gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK
The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for
switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error
under some circumstances.
Fixes bug 28030.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile,
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
i)));
break;
+ case FIELD_LOC_KIND_DWARF_BLOCK:
+ SET_FIELD_DWARF_BLOCK (new_type->field (i),
+ TYPE_FIELD_DWARF_BLOCK (type, i));
+ break;
default:
internal_error (__FILE__, __LINE__,
_("Unexpected type field location kind: %d"),

View File

@ -0,0 +1,185 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Mon, 11 Oct 2021 11:22:04 -0700
Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
;; Backport gdb.fortran testsuite changes in order to avoid Fortran
;; lexical analyzer bug.
[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp
When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed
(with glibc 2.34) I run into:
...
(gdb) ^M
PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array
Expecting: ^(-var-create array \* array[^M
]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M
]+[(]gdb[)] ^M
[ ]*)
-var-create array * array^M
&"Attempt to use a type name as an expression.\n"^M
^error,msg="-var-create: unable to create variable object"^M
(gdb) ^M
FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output)
...
The problem is that the name array is used both:
- as the name for a local variable
- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included
by nss/nss_files/files-hosts.c.
Fix this by ignoring the shared lib symbols.
Likewise in a couple of other fortran tests.
Tested on x86_64-linux.
diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
--- a/gdb/testsuite/gdb.fortran/allocated.exp
+++ b/gdb/testsuite/gdb.fortran/allocated.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# Set all the breakpoints.
for { set i 1 } { $i < 6 } { incr i } {
gdb_breakpoint [gdb_get_line_number "Breakpoint $i"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Stop Here"]
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -55,11 +55,17 @@ proc run_test { repack } {
clean_restart ${binfile}
+ # Avoid shared lib symbols.
+ gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+ # Avoid libc symbols, in particular the 'array' type.
+ gdb_test_no_output "nosharedlibrary"
+
gdb_test_no_output "set fortran repack-array-slices $repack"
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
gdb_breakpoint [gdb_get_line_number "Test Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
if ![fortran_runto_main] then {
perror "couldn't run to main"
continue
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# Try to set breakpoint at the last write statement.
set bp_location [gdb_get_line_number "str(:)"]
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+# Avoid shared lib symbols.
+mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
+
mi_runto prog_array
+# Avoid libc symbols, in particular the 'array' type.
+mi_gdb_test "nosharedlibrary" ".*\\^done"
+
mi_create_varobj "array" "array" "create local variable array"

View File

@ -0,0 +1,315 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Wed, 10 Nov 2021 18:52:22 -0700
Subject: gdb-rhbz2022177-dprintf-1.patch
;; Backport fix for dprintf bug (RH BZ 2022177).
Fix PR 28308 - dprintf breakpoints not working when run from script
This commit fixes Bug 28308, titled "Strange interactions with
dprintf and break/commands":
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
Since creating that bug report, I've found a somewhat simpler way of
reproducing the problem. I've encapsulated it into the GDB test case
which I've created along with this bug fix. The name of the new test
is gdb.base/dprintf-execution-x-script.exp, I'll demonstrate the
problem using this test case, though for brevity, I've placed all
relevant files in the same directory and have renamed the files to all
start with 'dp-bug' instead of 'dprintf-execution-x-script'.
The script file, named dp-bug.gdb, consists of the following commands:
dprintf increment, "dprintf in increment(), vi=%d\n", vi
break inc_vi
commands
continue
end
run
Note that the final command in this script is 'run'. When 'run' is
instead issued interactively, the bug does not occur. So, let's look
at the interactive case first in order to see the correct/expected
output:
$ gdb -q -x dp-bug.gdb dp-bug
... eliding buggy output which I'll discuss later ...
(gdb) run
Starting program: /mesquite2/sourceware-git/f34-master/bld/gdb/tmp/dp-bug
vi=0
dprintf in increment(), vi=0
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 in dprintf-execution-x-script.c
vi=1
dprintf in increment(), vi=1
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 in dprintf-execution-x-script.c
vi=2
dprintf in increment(), vi=2
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 in dprintf-execution-x-script.c
vi=3
[Inferior 1 (process 1539210) exited normally]
In this run, in which 'run' was issued from the gdb prompt (instead
of at the end of the script), there are three dprintf messages along
with three 'Breakpoint 2' messages. This is the correct output.
Now let's look at the output that I snipped above; this is the output
when 'run' is issued from the script loaded via GDB's -x switch:
$ gdb -q -x dp-bug.gdb dp-bug
Reading symbols from dp-bug...
Dprintf 1 at 0x40116e: file dprintf-execution-x-script.c, line 38.
Breakpoint 2 at 0x40113a: file dprintf-execution-x-script.c, line 26.
vi=0
dprintf in increment(), vi=0
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 dprintf-execution-x-script.c: No such file or directory.
vi=1
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 in dprintf-execution-x-script.c
vi=2
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
26 in dprintf-execution-x-script.c
vi=3
[Inferior 1 (process 1539175) exited normally]
In the output shown above, only the first dprintf message is printed.
The 2nd and 3rd dprintf messages are missing! However, all three
'Breakpoint 2...' messages are still printed.
Why does this happen?
bpstat_do_actions_1() in gdb/breakpoint.c contains the following
comment and code near the start of the function:
/* Avoid endless recursion if a `source' command is contained
in bs->commands. */
if (executing_breakpoint_commands)
return 0;
scoped_restore save_executing
= make_scoped_restore (&executing_breakpoint_commands, 1);
Also, as described by this comment prior to the 'async' field
in 'struct ui' in top.h, the main UI starts off in sync mode
when processing command line arguments:
/* True if the UI is in async mode, false if in sync mode. If in
sync mode, a synchronous execution command (e.g, "next") does not
return until the command is finished. If in async mode, then
running a synchronous command returns right after resuming the
target. Waiting for the command's completion is later done on
the top event loop. For the main UI, this starts out disabled,
until all the explicit command line arguments (e.g., `gdb -ex
"start" -ex "next"') are processed. */
This combination of things, the state of the static global
'executing_breakpoint_commands' plus the state of the async
field in the main UI causes this behavior.
This is a backtrace after hitting the dprintf breakpoint for
the second time when doing 'run' from the script file, i.e.
non-interactively:
Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
4431 if (executing_breakpoint_commands)
#0 bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
at gdb/breakpoint.c:4431
#1 0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x1538090)
at gdb/breakpoint.c:13048
#2 0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x137f450, ws=0x7fffffffc718,
stop_chain=0x1538090) at gdb/breakpoint.c:5498
#3 0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffc6f0)
at gdb/infrun.c:6172
#4 0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffc6f0)
at gdb/infrun.c:5662
#5 0x0000000000763cd5 in fetch_inferior_event ()
at gdb/infrun.c:4060
#6 0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
at gdb/inf-loop.c:41
#7 0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
at gdb/linux-nat.c:4207
#8 0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
at gdbsupport/event-loop.cc:701
#9 0x0000000000b8d032 in gdb_wait_for_event (block=0)
at gdbsupport/event-loop.cc:597
#10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
#11 0x00000000009d19b6 in wait_sync_command_done ()
at gdb/top.c:528
#12 0x00000000009d1a3f in maybe_wait_sync_command_done (was_sync=0)
at gdb/top.c:545
#13 0x00000000009d2033 in execute_command (p=0x7fffffffcb18 "", from_tty=0)
at gdb/top.c:676
#14 0x0000000000560d5b in execute_control_command_1 (cmd=0x13b9bb0, from_tty=0)
at gdb/cli/cli-script.c:547
#15 0x000000000056134a in execute_control_command (cmd=0x13b9bb0, from_tty=0)
at gdb/cli/cli-script.c:717
#16 0x00000000004c3bbe in bpstat_do_actions_1 (bsp=0x137f530)
at gdb/breakpoint.c:4469
#17 0x00000000004c3d40 in bpstat_do_actions ()
at gdb/breakpoint.c:4533
#18 0x00000000006a473a in command_handler (command=0x1399ad0 "run")
at gdb/event-top.c:624
#19 0x00000000009d182e in read_command_file (stream=0x113e540)
at gdb/top.c:443
#20 0x0000000000563697 in script_from_file (stream=0x113e540, file=0x13bb0b0 "dp-bug.gdb")
at gdb/cli/cli-script.c:1642
#21 0x00000000006abd63 in source_gdb_script (extlang=0xc44e80 <extension_language_gdb>, stream=0x113e540,
file=0x13bb0b0 "dp-bug.gdb") at gdb/extension.c:188
#22 0x0000000000544400 in source_script_from_stream (stream=0x113e540, file=0x7fffffffd91a "dp-bug.gdb",
file_to_open=0x13bb0b0 "dp-bug.gdb")
at gdb/cli/cli-cmds.c:692
#23 0x0000000000544557 in source_script_with_search (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1, search_path=0)
at gdb/cli/cli-cmds.c:750
#24 0x00000000005445cf in source_script (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1)
at gdb/cli/cli-cmds.c:759
#25 0x00000000007cf6d9 in catch_command_errors (command=0x5445aa <source_script(char const*, int)>,
arg=0x7fffffffd91a "dp-bug.gdb", from_tty=1, do_bp_actions=false)
at gdb/main.c:523
#26 0x00000000007cf85d in execute_cmdargs (cmdarg_vec=0x7fffffffd1b0, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND,
ret=0x7fffffffd18c) at gdb/main.c:615
#27 0x00000000007d0c8e in captured_main_1 (context=0x7fffffffd3f0)
at gdb/main.c:1322
#28 0x00000000007d0eba in captured_main (data=0x7fffffffd3f0)
at gdb/main.c:1343
#29 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
at gdb/main.c:1368
#30 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
at gdb/gdb.c:32
There are two frames for bpstat_do_actions_1(), one at frame #16 and
the other at frame #0. The one at frame #16 is processing the actions
for Breakpoint 2, which is a 'continue'. The one at frame #0 is attempting
to process the dprintf breakpoint action. However, at this point,
the value of 'executing_breakpoint_commands' is 1, forcing an early
return, i.e. prior to executing the command(s) associated with the dprintf
breakpoint.
For the sake of comparison, this is what the stack looks like when hitting
the dprintf breakpoint for the second time when issuing the 'run'
command from the GDB prompt.
Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffccd8)
at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
4431 if (executing_breakpoint_commands)
#0 bpstat_do_actions_1 (bsp=0x7fffffffccd8)
at gdb/breakpoint.c:4431
#1 0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x16b0290)
at gdb/breakpoint.c:13048
#2 0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x13f0e60, ws=0x7fffffffd138,
stop_chain=0x16b0290) at gdb/breakpoint.c:5498
#3 0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffd110)
at gdb/infrun.c:6172
#4 0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffd110)
at gdb/infrun.c:5662
#5 0x0000000000763cd5 in fetch_inferior_event ()
at gdb/infrun.c:4060
#6 0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
at gdb/inf-loop.c:41
#7 0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
at gdb/linux-nat.c:4207
#8 0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
at gdbsupport/event-loop.cc:701
#9 0x0000000000b8d032 in gdb_wait_for_event (block=0)
at gdbsupport/event-loop.cc:597
#10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
#11 0x00000000007cf512 in start_event_loop ()
at gdb/main.c:421
#12 0x00000000007cf631 in captured_command_loop ()
at gdb/main.c:481
#13 0x00000000007d0ebf in captured_main (data=0x7fffffffd3f0)
at gdb/main.c:1353
#14 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
at gdb/main.c:1368
#15 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
at gdb/gdb.c:32
This relatively short backtrace is due to the current UI's async field
being set to 1.
Yet another thing to be aware of regarding this problem is the
difference in the way that commands associated to dprintf breakpoints
versus regular breakpoints are handled. While they both use a command
list associated with the breakpoint, regular breakpoints will place
the commands to be run on the bpstat chain constructed in
bp_stop_status(). These commands are run later on. For dprintf
breakpoints, commands are run via the 'after_condition_true' function
pointer directly from bpstat_stop_status(). (The 'commands' field in
the bpstat is cleared in dprintf_after_condition_true(). This
prevents the dprintf commands from being run again later on when other
commands on the bpstat chain are processed.)
Another thing that I noticed is that dprintf breakpoints are the only
type of breakpoint which use 'after_condition_true'. This suggests
that one possible way of fixing this problem, that of making dprintf
breakpoints work more like regular breakpoints, probably won't work.
(I must admit, however, that my understanding of this code isn't
complete enough to say why. I'll trust that whoever implemented it
had a good reason for doing it this way.)
The comment referenced earlier regarding 'executing_breakpoint_commands'
states that the reason for checking this variable is to avoid
potential endless recursion when a 'source' command appears in
bs->commands. We know that a dprintf command is constrained to either
1) execution of a GDB printf command, 2) an inferior function call of
a printf-like function, or 3) execution of an agent-printf command.
Therefore, infinite recursion due to a 'source' command cannot happen
when executing commands upon hitting a dprintf breakpoint.
I chose to fix this problem by having dprintf_after_condition_true()
directly call execute_control_commands(). This means that it no
longer attempts to go through bpstat_do_actions_1() avoiding the
infinite recursion check for potential 'source' commands on the
command chain. I think it simplifies this code a little bit too, a
definite bonus.
Summary:
* breakpoint.c (dprintf_after_condition_true): Don't call
bpstat_do_actions_1(). Call execute_control_commands()
instead.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13043,9 +13043,6 @@ dprintf_print_recreate (struct breakpoint *tp, struct ui_file *fp)
static void
dprintf_after_condition_true (struct bpstats *bs)
{
- struct bpstats tmp_bs;
- struct bpstats *tmp_bs_p = &tmp_bs;
-
/* dprintf's never cause a stop. This wasn't set in the
check_status hook instead because that would make the dprintf's
condition not be evaluated. */
@@ -13056,14 +13053,9 @@ dprintf_after_condition_true (struct bpstats *bs)
bpstat_do_actions, if a breakpoint that causes a stop happens to
be set at same address as this dprintf, or even if running the
commands here throws. */
- tmp_bs.commands = bs->commands;
- bs->commands = NULL;
-
- bpstat_do_actions_1 (&tmp_bs_p);
-
- /* 'tmp_bs.commands' will usually be NULL by now, but
- bpstat_do_actions_1 may return early without processing the whole
- list. */
+ counted_command_line cmds = std::move (bs->commands);
+ gdb_assert (cmds != nullptr);
+ execute_control_commands (cmds.get (), 0);
}
/* The breakpoint_ops structure to be used on static tracepoints with

View File

@ -0,0 +1,194 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Wed, 10 Nov 2021 18:55:43 -0700
Subject: gdb-rhbz2022177-dprintf-2.patch
;; Backport test case for dprintf bug (RH BZ 2022177).
Test case for Bug 28308
The purpose of this test is described in the comments in
dprintf-execution-x-script.exp.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
The name of this new test was based on that of an existing test,
bp-cmds-execution-x-script.exp. I started off by copying that test,
adding to it, and then rewriting almost all of it. It's different
enough that I decided that listing the copyright year as 2021
was sufficient.
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.c b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
@@ -0,0 +1,53 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2021 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General 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>
+#include <stdio.h>
+
+volatile int vi = 0;
+
+void
+inc_vi ()
+{
+ vi++;
+}
+
+void
+print_vi ()
+{
+ printf ("vi=%d\n", vi);
+}
+
+void
+increment ()
+{
+ inc_vi ();
+}
+
+int
+main (int argc, char **argv)
+{
+ print_vi ();
+ increment ();
+ print_vi ();
+ increment ();
+ print_vi ();
+ increment ();
+ print_vi ();
+
+ exit (0);
+}
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
@@ -0,0 +1,85 @@
+# Copyright 2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General 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/>. */
+
+# Test that commands in a GDB script file run via GDB's -x flag work
+# as expected. Specifically, the script creates a dprintf breakpoint
+# as well as a normal breakpoint that has "continue" in its command
+# list, and then does "run". Correct output from GDB is checked as
+# part of this test.
+
+# Bail out if the target can't use the 'run' command.
+if ![target_can_use_run_cmd] {
+ return 0
+}
+
+standard_testfile
+
+if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
+ return -1
+}
+
+# This is the name of the GDB script to load.
+set x_file ${srcdir}/${subdir}/$testfile.gdb
+
+# Create context in which the global, GDBFLAGS, will be restored at
+# the end of the block. All commands run within the block are
+# actually run in the outer context. (This is why 'res' is available
+# outside of the save_vars block.)
+save_vars { GDBFLAGS } {
+ # Set flags with which to start GDB.
+ append GDBFLAGS " -ex \"set height unlimited\""
+ append GDBFLAGS " -x \"$x_file\""
+ append GDBFLAGS " --args \"$binfile\""
+
+ # Start GDB with above flags.
+ set res [gdb_spawn]
+}
+
+set test "load and run script with -x"
+if { $res != 0} {
+ fail $test
+ return -1
+}
+
+# The script loaded via -x contains a run command; while running, GDB
+# is expected to print three messages from dprintf breakpoints along
+# with three interspersed messages from an ordinary breakpoint (which
+# was set up with a continue command). Set up pattern D to match
+# output from hitting the dprintf breakpoint and B for the ordinary
+# breakpoint. Then set PAT to contain the entire pattern of expected
+# output from the interspersed dprintf and ordinary breakpoints along
+# with some (additional) expected output from the dprintf breakpoints,
+# i.e. 0, 1, and 2.
+set d "dprintf in increment.., vi="
+set b "Breakpoint ., inc_vi"
+set pat "${d}0.*?$b.*?${d}1.*?$b.*?${d}2.*?$b.*?"
+
+proc do_test {cmd test} {
+ gdb_test $cmd "$::pat$::inferior_exited_re normally.*" $test
+}
+
+# Check output from running script with -x
+do_test "" $test
+
+# Restart GDB and 'source' the script; this will (still) run the program
+# due to the 'run' command in the script.
+clean_restart $binfile
+do_test "source $x_file" "load and run script using source command"
+
+# This should leave us at the gdb prompt; Run program again using
+# already established breakpoints, i.e. those loaded from the
+# script. Prior to fixing PR 28308, this was the only test that
+# would pass.
+do_test "run" "run again"
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
@@ -0,0 +1,21 @@
+# Copyright 2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General 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/>. */
+
+dprintf increment, "dprintf in increment(), vi=%d\n", vi
+break inc_vi
+commands
+ continue
+end
+run

View File

@ -1,3 +1,12 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
;; Import regression test for `gdb/findvar.c:417: internal-error:
;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,7 +1,31 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-runtest-pie-override.patch
;; Hack for proper PIE run of the testsuite.
;;=fedoratest
make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp
gcc -fpic -c -fPIE -pie -o x.o x.c
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
=> Change the order for overrides.
One has to also use -fPIC rather than -fPIE, -fPIC is stronger.
The correct way would be:
make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp'
But there is a problem with testsuite.unix non-unique subdir name and also
a problem with make -j parallelization of the testsuite.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
--- a/gdb/testsuite/lib/future.exp --- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp +++ b/gdb/testsuite/lib/future.exp
@@ -195,6 +195,10 @@ proc gdb_default_target_compile {source destfile type options} { @@ -197,6 +197,10 @@ proc gdb_default_target_compile_1 {source destfile type options} {
set ldflags "" set ldflags ""
set dest [target_info name] set dest [target_info name]
@ -12,7 +36,7 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
if {[info exists CFLAGS_FOR_TARGET]} { if {[info exists CFLAGS_FOR_TARGET]} {
append add_flags " $CFLAGS_FOR_TARGET" append add_flags " $CFLAGS_FOR_TARGET"
} }
@@ -529,10 +533,6 @@ proc gdb_default_target_compile {source destfile type options} { @@ -531,10 +535,6 @@ proc gdb_default_target_compile_1 {source destfile type options} {
} }
} }

View File

@ -1,3 +1,11 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-simultaneous-step-resume-breakpoint-test.patch
;; New test for step-resume breakpoint placed in multiple threads at once.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

View File

@ -1,3 +1,71 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-test-bt-cfi-without-die.patch
;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
;;=fedoratest
http://sourceware.org/ml/archer/2010-q3/msg00028.html
On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote:
> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5
>
> There was a regression on gdb.base/savedregs.exp.
>
> quick_addrmap/require_partial_symbols should be used even for the unwind debug
> info checking as its load has been also delayed by this branch.
[...]
> --- a/gdb/dwarf2-frame.c
> +++ b/gdb/dwarf2-frame.c
[...]
> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
> struct dwarf2_fde *fde;
> CORE_ADDR offset;
>
> + if (objfile->quick_addrmap)
> + {
> + if (!addrmap_find (objfile->quick_addrmap, *pc))
> + continue;
> + }
> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
> + require_partial_symbols (objfile);
> +
but this has caused a different regression (as discussed in the confcall).
QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing
built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have
DWARF at all while they can feature CFIs (.eh_frame or .debug_frame).
It has been described by Daniel Jacobowitz at:
Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs
http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html
Sorry for this regression by me (in that fix of a different regression).
Fixed it the "slow way" as this branch is now obsoleted by .gdb-index.
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
Checked-in.
Thanks,
Jan
eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb
Test CFI is parsed even for range (function) not described by any DIE.
https://bugzilla.redhat.com/show_bug.cgi?id=614028
gdb/
* dwarf2-frame.c (dwarf2_frame_find_fde): Remove the
OBJFILE->QUICK_ADDRMAP check. New comment why.
gdb/testsuite/
* gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c,
gdb.base/cfi-without-die-caller.c: New files.
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null

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