update to 12.1

This commit is contained in:
yaowenbin 2022-11-18 01:35:29 +00:00
parent eb0f8c8cbe
commit 55385b5a23
25 changed files with 1817 additions and 2954 deletions

View File

@ -1,45 +0,0 @@
From cb9f257adb210ad1f1e9abea1b8e8675a96077df Mon Sep 17 00:00:00 2001
From: Christian Biesinger <cbiesinger@google.com>
Date: Fri, 8 Oct 2021 16:09:46 -0400
Subject: [PATCH 1/1] Make c-exp.y work with Bison 3.8+
When using Bison 3.8, we get this error:
../../gdb/c-exp.y:3455:1: error: 'void c_print_token(FILE*, int, YYSTYPE)' defined but not used [-Werror=unused-function]
That's because bison 3.8 removed YYPRINT support:
https://savannah.gnu.org/forum/forum.php?forum_id=10047
Accordingly, this patch only defines that function for Bison < 3.8.
Change-Id: I3cbf2f317630bb72810b00f2d9b2c4b99fa812ad
---
gdb/c-exp.y | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 93b10f0..396bd6a 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -167,7 +167,7 @@ static struct stoken operator_stoken (const char *);
static struct stoken typename_stoken (const char *);
static void check_parameter_typelist (std::vector<struct type *> *);
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
static void c_print_token (FILE *file, int type, YYSTYPE value);
#define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
#endif
@@ -3446,7 +3446,7 @@ c_parse (struct parser_state *par_state)
return result;
}
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
/* This is called via the YYPRINT macro when parser debugging is
enabled. It prints a token's value. */
--
2.30.0

Binary file not shown.

View File

@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
@@ -1767,7 +1767,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -1802,7 +1802,25 @@ install-guile:
@@ -1816,7 +1816,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -52,8 +52,8 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@@ -1847,6 +1865,18 @@ uninstall: force $(CONFIG_UNINSTALL)
rm -f $(DESTDIR)$(bindir)/$$transformed_name
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+.PHONY: uninstall-gstack

View File

@ -1,324 +0,0 @@
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
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.c
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
+ is exited when & if the variable 'should_exit' is non-zero. (It
+ is initialized to zero in this program, so the loop will never
+ exit unless/until gdb sets the variable to non-zero.)
+ */
+#include <stdio.h>
+
+int should_exit = 0;
+
+int main ()
+{
+ int local_i = 0;
+
+ while (! should_exit)
+ {
+ local_i++;
+ }
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.exp
@@ -0,0 +1,246 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */
+
+# On HP-UX 11.0, this test is causing a process running the program
+# "attach" to be left around spinning. Until we figure out why, I am
+# commenting out the test to avoid polluting tiamat (our 11.0 nightly
+# test machine) with these processes. RT
+#
+# Setting the magic bit in the target app should work. I added a
+# "kill", and also a test for the R3 register warning. JB
+if { ![istarget "x86_64*-*linux*"]
+ && ![istarget "powerpc64*-*linux*"]} {
+ return 0
+}
+
+# are we on a target board
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile "attach-32"
+set srcfile ${testfile}.c
+set srcfile2 ${testfile}b.c
+set binfile [standard_output_file ${testfile}]
+set binfile2 [standard_output_file ${testfile}b]
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
+
+#execute_anywhere "rm -f ${binfile} ${binfile2}"
+remote_exec build "rm -f ${binfile} ${binfile2}"
+# For debugging this test
+#
+#log_user 1
+
+# build the first test case
+#
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the in-system-call test
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+proc do_attach_tests {} {
+ global gdb_prompt
+ global binfile
+ global escapedbinfile
+ global srcfile
+ global testfile
+ global objdir
+ global subdir
+ global timeout
+ global testpid
+
+ # Verify that we can "see" the variable "should_exit" in the
+ # program, and that it is zero.
+
+ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit"
+
+ # Verify that we can modify the variable "should_exit" in the
+ # program.
+
+ gdb_test "set should_exit=1" "" "after attach-32, set should_exit"
+
+ # Verify that the modification really happened.
+
+ send_gdb "tbreak 19\n"
+ gdb_expect {
+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
+ pass "after attach-32, set tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach-32, set tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach-32, set tbreak postloop"
+ }
+ }
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" {
+ pass "after attach-32, reach tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach-32, reach tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach-32, reach tbreak postloop"
+ }
+ }
+
+ # Allow the test process to exit, to cleanup after ourselves.
+
+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit"
+
+ # Make sure we don't leave a process around to confuse
+ # the next test run (and prevent the compile by keeping
+ # the text file busy), in case the "set should_exit" didn't
+ # work.
+
+ remote_exec build "kill -9 ${testpid}"
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
+
+ set testpid [eval exec $binfile &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ # Verify that we can attach to the process, and find its a.out
+ # when we're cd'd to some directory that doesn't contain the
+ # a.out. (We use the source path set by the "dir" command.)
+
+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
+ "set source path"
+
+ gdb_test "cd /tmp" "Working directory /tmp." \
+ "cd away from process working directory"
+
+ # Explicitly flush out any knowledge of the previous attachment.
+
+ set test "before attach-32-3, flush symbols"
+ gdb_test_multiple "symbol" "$test" {
+ -re "Discard symbol table from.*y or n. $" {
+ gdb_test "y" "No symbol file now." \
+ "$test"
+ }
+ -re "No symbol file now.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ gdb_test "exec" "No executable file now." \
+ "before attach-32-3, flush exec"
+
+ gdb_test "attach $testpid" \
+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \
+ "attach-32 when process' a.out not in cwd"
+
+ set test "after attach-32-3, exit"
+ gdb_test_multiple "kill" "$test" {
+ -re "Kill the program being debugged.*y or n. $" {
+ gdb_test "y" "" "$test"
+ }
+ }
+
+ # Another "don't leave a process around"
+ remote_exec build "kill -9 ${testpid}"
+}
+
+proc do_call_attach_tests {} {
+ global gdb_prompt
+ global binfile2
+ global testpid
+
+ # See if other registers are problems
+
+ set test "info other register"
+ gdb_test_multiple "i r r3" "$test" {
+ -re "warning: reading register.*$gdb_prompt $" {
+ fail "$test"
+ }
+ -re "r3.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # Get rid of the process
+
+ gdb_test "p should_exit = 1"
+ gdb_test "c" {\[Inferior .* exited normally\]}
+
+ # Be paranoid
+
+ remote_exec build "kill -9 ${testpid}"
+}
+
+
+# Start with a fresh gdb
+
+gdb_exit
+set testpid [eval exec $binfile &]
+exec sleep 3
+if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+
+# This is a test of gdb's ability to attach to a running process.
+
+do_attach_tests
+
+# Test attaching when the target is inside a system call
+
+gdb_exit
+set testpid [eval exec $binfile2 &]
+exec sleep 3
+if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+do_call_attach_tests
+
+return 0
diff --git a/gdb/testsuite/gdb.base/attach-32b.c b/gdb/testsuite/gdb.base/attach-32b.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32b.c
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
+ is exited when & if the variable 'should_exit' is non-zero. (It
+ is initialized to zero in this program, so the loop will never
+ exit unless/until gdb sets the variable to non-zero.)
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int should_exit = 0;
+
+int main ()
+{
+ int local_i = 0;
+
+ sleep( 10 ); /* System call causes register fetch to fail */
+ /* This is a known HPUX "feature" */
+ while (! should_exit)
+ {
+ local_i++;
+ }
+ return (0);
+}

View File

@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest
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)
@@ -2234,7 +2234,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;

View File

@ -1,247 +0,0 @@
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
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/constructortest.cc
@@ -0,0 +1,99 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+class A
+{
+ public:
+ A();
+ ~A();
+ int k;
+ private:
+ int x;
+};
+
+class B: public A
+{
+ public:
+ B();
+ private:
+ int y;
+};
+
+/* C and D are for the $delete destructor. */
+
+class C
+{
+ public:
+ C();
+ virtual ~C();
+ private:
+ int x;
+};
+
+class D: public C
+{
+ public:
+ D();
+ private:
+ int y;
+};
+
+int main(int argc, char *argv[])
+{
+ A* a = new A;
+ B* b = new B;
+ D* d = new D;
+ delete a;
+ delete b;
+ delete d;
+ return 0;
+}
+
+A::A() /* Constructor A */
+{
+ x = 1; /* First line A */
+ k = 4; /* Second line A */
+}
+
+A::~A() /* Destructor A */
+{
+ x = 3; /* First line ~A */
+ k = 6; /* Second line ~A */
+}
+
+B::B()
+{
+ y = 2; /* First line B */
+ k = 5;
+}
+
+C::C() /* Constructor C */
+{
+ x = 1; /* First line C */
+}
+
+C::~C() /* Destructor C */
+{
+ x = 3; /* First line ~C */
+}
+
+D::D()
+{
+ y = 2; /* First line D */
+}
diff --git a/gdb/testsuite/gdb.cp/constructortest.exp b/gdb/testsuite/gdb.cp/constructortest.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/constructortest.exp
@@ -0,0 +1,130 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can break at multiple forms of constructors.
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile [standard_output_file ${testfile}]
+# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC
+# breakpoints.
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor.
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A"
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
+
+# Now do the same for destructors
+gdb_test "break 'A::~A()'" ""
+
+# Verify that we break for the A destructor two times
+# Once for delete a and once for delete b
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
+
+
+# Verify that we can break by line number in a constructor and find
+# both occurrences
+runto_main
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
+
+# Verify that we can break by line number in a destructor and find
+# both occurrences
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+# FIXME: Analyse this case better.
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
+
+
+# Test now the $delete destructors.
+
+gdb_load ${binfile}
+runto_main
+
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+set define_line_dtor [gdb_get_line_number "Destructor C"]
+# Break on the various forms of the C::~C destructor
+# " ([23] locations)" is displayed depending on G++ version.
+gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C"
+gdb_continue_to_breakpoint "First line ~C"
+
+# Verify that we can break by line number in a destructor and find
+# the $delete occurence
+
+gdb_load ${binfile}
+delete_breakpoints
+
+# " (3 locations)" is displayed depending on G++ version.
+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor"
+
+# Run to `main' where we begin our tests.
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
+# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS.
+
+if ![gdb_breakpoint main] {
+ gdb_suppress_tests
+}
+gdb_run_cmd
+set test "running to main"
+gdb_test_multiple "" $test {
+ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_continue_to_breakpoint "First line ~C"

View File

@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
@@ -1301,6 +1301,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
if (exp != nullptr && *exp)
{

View File

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

View File

@ -9,96 +9,10 @@ Subject: gdb-6.6-buildid-locate-rpm-scl.patch
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
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
/* Returns the count of newly added rpms. */
static int
+#ifndef GDB_INDEX_VERIFY_VENDOR
missing_rpm_enlist (const char *filename)
+#else
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
+#endif
{
static int rpm_init_done = 0;
rpmts ts;
@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
if (mi != NULL)
{
+#ifndef GDB_INDEX_VERIFY_VENDOR
for (;;)
+#else
+ if (!verify_vendor) for (;;)
+#endif
{
Header h;
char *debuginfo, **slot, *s, *s2;
@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
xfree (debuginfo);
count++;
}
+#ifdef GDB_INDEX_VERIFY_VENDOR
+ else /* verify_vendor */
+ {
+ int vendor_pass = 0, vendor_fail = 0;
+
+ for (;;)
+ {
+ Header h;
+ errmsg_t err;
+ char *vendor;
+
+ h = rpmdbNextIterator_p (mi);
+ if (h == NULL)
+ break;
+
+ vendor = headerFormat_p (h, "%{vendor}", &err);
+ if (!vendor)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
+ vendor_pass = 1;
+ else
+ vendor_fail = 1;
+ xfree (vendor);
+ }
+ count = vendor_pass != 0 && vendor_fail == 0;
+ }
+#endif
rpmdbFreeIterator_p (mi);
}
@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
return count;
}
+#ifdef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 0);
+}
+
+extern int rpm_verify_vendor (const char *filename);
+int
+rpm_verify_vendor (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 1);
+}
+#endif
+
static bool
missing_rpm_list_compar (const char *ap, const char *bp)
{
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
@@ -2797,6 +2797,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok)
{
@ -115,7 +29,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
static int warning_printed = 0;
if (!warning_printed)
{
@@ -2812,6 +2822,10 @@ to use the section anyway."),
@@ -2808,6 +2818,10 @@ to use the section anyway."),
warning_printed = 1;
}
return 0;

View File

@ -232,457 +232,6 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -33,6 +33,7 @@
#include "gdb_bfd.h"
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
#include "objfiles.h"
#include "observable.h"
#include "symfile.h"
@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
+#ifdef HAVE_LIBRPM
+
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
+#include <rpm/header.h>
+#ifdef DLOPEN_LIBRPM
+#include <dlfcn.h>
+#endif
+
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
+ and avoid their duplicities during a single inferior run. */
+
+static struct htab *missing_rpm_hash;
+
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
+ all the rpms right before the nearest GDB prompt. It gets cleared after
+ each such print (it is questionable if we should clear it after the print).
+ */
+
+struct missing_rpm
+ {
+ struct missing_rpm *next;
+ char rpm[1];
+ };
+static struct missing_rpm *missing_rpm_list;
+static int missing_rpm_list_entries;
+
+/* Returns the count of newly added rpms. */
+
+static int
+missing_rpm_enlist (const char *filename)
+{
+ static int rpm_init_done = 0;
+ rpmts ts;
+ rpmdbMatchIterator mi;
+ int count = 0;
+
+#ifdef DLOPEN_LIBRPM
+ /* Duplicate here the declarations to verify they match. The same sanity
+ check is present also in `configure.ac'. */
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
+ extern int rpmReadConfigFiles(const char * file, const char * target);
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
+ extern rpmts rpmtsCreate(void);
+ static rpmts (*rpmtsCreate_p) (void);
+ extern rpmts rpmtsFree(rpmts ts);
+ static rpmts (*rpmtsFree_p) (rpmts ts);
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
+ const void * keyp, size_t keylen);
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
+ rpmTag rpmtag,
+ const void *keyp,
+ size_t keylen);
+#else /* !DLOPEN_LIBRPM */
+# define headerFormat_p headerFormat
+# define rpmReadConfigFiles_p rpmReadConfigFiles
+# define rpmdbFreeIterator_p rpmdbFreeIterator
+# define rpmdbNextIterator_p rpmdbNextIterator
+# define rpmtsCreate_p rpmtsCreate
+# define rpmtsFree_p rpmtsFree
+# define rpmtsInitIterator_p rpmtsInitIterator
+#endif /* !DLOPEN_LIBRPM */
+
+ gdb_assert (filename != NULL);
+
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
+ return 0;
+
+ if (is_target_filename (filename))
+ return 0;
+
+ if (filename[0] != '/')
+ {
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
+ return 0;
+ }
+
+ if (!rpm_init_done)
+ {
+ static int init_tried;
+
+ /* Already failed the initialization before? */
+ if (init_tried)
+ return 0;
+ init_tried = 1;
+
+#ifdef DLOPEN_LIBRPM
+ {
+ void *h;
+
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
+ if (!h)
+ {
+ warning (_("Unable to open \"%s\" (%s), "
+ "missing debuginfos notifications will not be displayed"),
+ DLOPEN_LIBRPM, dlerror ());
+ return 0;
+ }
+
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
+ {
+ warning (_("Opened library \"%s\" is incompatible (%s), "
+ "missing debuginfos notifications will not be displayed"),
+ DLOPEN_LIBRPM, dlerror ());
+ if (dlclose (h))
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
+ dlerror ());
+ return 0;
+ }
+ }
+#endif /* DLOPEN_LIBRPM */
+
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
+ {
+ warning (_("Error reading the rpm configuration files"));
+ return 0;
+ }
+
+ rpm_init_done = 1;
+ }
+
+ ts = rpmtsCreate_p ();
+
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
+ if (mi != NULL)
+ {
+ for (;;)
+ {
+ Header h;
+ char *debuginfo, **slot, *s, *s2;
+ errmsg_t err;
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
+ rpmdbMatchIterator mi_debuginfo;
+
+ h = rpmdbNextIterator_p (mi);
+ if (h == NULL)
+ break;
+
+ /* Verify the debuginfo file is not already installed. */
+
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
+ &err);
+ if (!debuginfo)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+ /* s = `.src.rpm-debuginfo.%{arch}' */
+ s = strrchr (debuginfo, '-') - srcrpmlen;
+ s2 = NULL;
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
+ {
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
+ }
+ if (s2)
+ {
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
+ }
+ if (!s2)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ debuginfo);
+ xfree (debuginfo);
+ continue;
+ }
+ /* s = `.src.rpm-debuginfo.%{arch}' */
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
+ memmove (s2 + debuginfolen, s2, s - s2);
+ memcpy (s2, "-debuginfo", debuginfolen);
+ /* s = `XXXX.%{arch}' */
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
+ /* strlen ("XX") == srcrpmlen */
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
+ strlen (s + srcrpmlen + debuginfolen) + 1);
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
+
+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
+ xfree (debuginfo);
+ if (mi_debuginfo)
+ {
+ rpmdbFreeIterator_p (mi_debuginfo);
+ count = 0;
+ break;
+ }
+
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
+ debuginfo = headerFormat_p (h,
+ "%{name}-%{version}-%{release}.%{arch}",
+ &err);
+ if (!debuginfo)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+
+ /* Base package name for `debuginfo-install'. We do not use the
+ `yum' command directly as the line
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
+ would be more complicated than just:
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
+ Do not supply the rpm base name (derived from .src.rpm name) as
+ debuginfo-install is unable to install the debuginfo package if
+ the base name PKG binary rpm is not installed while for example
+ PKG-libs would be installed (RH Bug 467901).
+ FUTURE: After multiple debuginfo versions simultaneously installed
+ get supported the support for the VERSION-RELEASE tags handling
+ may need an update. */
+
+ if (missing_rpm_hash == NULL)
+ {
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
+ should not deallocate the entries. */
+
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
+ (int (*) (const void *, const void *)) streq,
+ NULL, xcalloc, xfree);
+ }
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
+ /* XCALLOC never returns NULL. */
+ gdb_assert (slot != NULL);
+ if (*slot == NULL)
+ {
+ struct missing_rpm *missing_rpm;
+
+ *slot = debuginfo;
+
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
+ strcpy (missing_rpm->rpm, debuginfo);
+ missing_rpm->next = missing_rpm_list;
+ missing_rpm_list = missing_rpm;
+ missing_rpm_list_entries++;
+ }
+ else
+ xfree (debuginfo);
+ count++;
+ }
+
+ rpmdbFreeIterator_p (mi);
+ }
+
+ rpmtsFree_p (ts);
+
+ return count;
+}
+
+static bool
+missing_rpm_list_compar (const char *ap, const char *bp)
+{
+ return strcoll (ap, bp) < 0;
+}
+
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
+ also return only NULL. */
+
+static void
+missing_rpm_list_print (void)
+{
+ struct missing_rpm *list_iter;
+
+ if (missing_rpm_list_entries == 0)
+ return;
+
+ std::vector<const char *> array (missing_rpm_list_entries);
+ size_t idx = 0;
+
+ for (list_iter = missing_rpm_list; list_iter != NULL;
+ list_iter = list_iter->next)
+ {
+ array[idx++] = list_iter->rpm;
+ }
+ gdb_assert (idx == missing_rpm_list_entries);
+
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
+ /* We zero out the number of missing RPMs here because of a nasty
+ bug (see RHBZ 1801974).
+
+ When we call 'puts_unfiltered' below, if pagination is on and if
+ the number of missing RPMs is big enough to trigger pagination,
+ we will end up in an infinite recursion. The call chain looks
+ like this:
+
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
+ -> prompt_for_continue -> display_gdb_prompt ->
+ debug_flush_missing -> missing_rpm_list_print ...
+
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
+ *before* calling any print function. */
+ missing_rpm_list_entries = 0;
+
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+#endif
+ "debuginfo-install");
+ for (const char *el : array)
+ {
+ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
+ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
+ list_iter = missing_rpm_list;
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
+}
+
+static void
+missing_rpm_change (void)
+{
+ debug_flush_missing ();
+
+ gdb_assert (missing_rpm_list == NULL);
+ if (missing_rpm_hash != NULL)
+ {
+ htab_delete (missing_rpm_hash);
+ missing_rpm_hash = NULL;
+ }
+}
+
+enum missing_exec
+ {
+ /* Init state. EXEC_BFD also still could be NULL. */
+ MISSING_EXEC_NOT_TRIED,
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
+ MISSING_EXEC_NOT_FOUND,
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
+ or separate) or the main executable's RPM is now contained in
+ MISSING_RPM_HASH. */
+ MISSING_EXEC_ENLISTED
+ };
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
+
+#endif /* HAVE_LIBRPM */
+
+void
+debug_flush_missing (void)
+{
+#ifdef HAVE_LIBRPM
+ missing_rpm_list_print ();
+#endif
+}
+
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
- Try to install the hash file ...
+ yum --enablerepo='*debug*' install ...
avoidance. */
struct missing_filepair
@@ -752,11 +1119,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
+#ifdef HAVE_LIBRPM
+ missing_exec = MISSING_EXEC_NOT_TRIED;
+#endif
}
static void
debug_print_executable_changed (void)
{
+#ifdef HAVE_LIBRPM
+ missing_rpm_change ();
+#endif
missing_filepair_change ();
}
@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;
- /* We do not collect and flush these messages as each such message
- already requires its own separate lines. */
+#ifdef HAVE_LIBRPM
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
+ {
+ const char *execfilename = get_exec_file (0);
- fprintf_unfiltered (gdb_stdlog,
- _("Missing separate debuginfo for %s\n"), binary);
- if (debug != NULL)
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
- debug);
+ if (execfilename != NULL)
+ {
+ if (missing_rpm_enlist (execfilename) == 0)
+ missing_exec = MISSING_EXEC_NOT_FOUND;
+ else
+ missing_exec = MISSING_EXEC_ENLISTED;
+ }
+ }
+ if (missing_exec != MISSING_EXEC_ENLISTED)
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
+#endif /* HAVE_LIBRPM */
+ {
+ /* We do not collect and flush these messages as each such message
+ already requires its own separate lines. */
+
+ fprintf_unfiltered (gdb_stdlog,
+ _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf"
+#else
+ "yum"
+#endif
+ " --enablerepo='*debug*' install", debug);
+ }
}
/* See build-id.h. */
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@ -696,7 +245,7 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -246,6 +249,9 @@
@@ -259,6 +262,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
@ -709,9 +258,9 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -771,6 +771,11 @@ PKG_CONFIG
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
@@ -775,6 +775,11 @@ TARGET_OBS
ENABLE_BFD_64_BIT_FALSE
ENABLE_BFD_64_BIT_TRUE
subdirs
+RPM_LIBS
+RPM_CFLAGS
@ -721,7 +270,7 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -876,6 +881,7 @@ with_gdb_datadir
@@ -880,6 +885,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
@ -729,7 +278,7 @@ diff --git a/gdb/configure b/gdb/configure
enable_targets
enable_64_bit_bfd
enable_gdbmi
@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
@@ -959,6 +965,8 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
@ -738,7 +287,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1625,6 +1633,8 @@ Optional Packages:
@@ -1635,6 +1643,8 @@ Optional Packages:
do not restrict auto-loaded files locations
--with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no)
@ -747,7 +296,7 @@ diff --git a/gdb/configure b/gdb/configure
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1705,6 +1715,8 @@ Some influential environment variables:
@@ -1715,6 +1725,8 @@ Some influential environment variables:
C compiler flags for DEBUGINFOD, overriding pkg-config
DEBUGINFOD_LIBS
linker flags for DEBUGINFOD, overriding pkg-config
@ -756,7 +305,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
@@ -6616,6 +6628,494 @@ _ACEOF
@@ -6634,6 +6646,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -1457,15 +1006,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -41,6 +41,7 @@
#include "gdbsupport/gdb_select.h"
@@ -42,6 +42,7 @@
#include "gdbsupport/gdb-sigmask.h"
#include "async-event.h"
#include "bt-utils.h"
+#include "symfile.h"
/* readline include files. */
#include "readline/readline.h"
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
@@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
@ -1474,7 +1023,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
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
@@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd);
if (ui->prompt_state != PROMPTED)

View File

@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1250,14 +1250,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
{
@ -45,7 +45,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
if (build_id != NULL)
{
char *name, *build_id_filename;
@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name);
}
else

View File

@ -33,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
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -24,13 +24,70 @@
@@ -24,13 +24,71 @@
#include "gdbsupport/gdb_vecs.h"
#include "symfile.h"
#include "objfiles.h"
@ -46,6 +46,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+#include "gdb_bfd.h"
+#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
+#include "objfiles.h"
+#include "observable.h"
+#include "symfile.h"
@ -105,7 +106,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
if (!bfd_check_format (abfd, bfd_object)
&& !bfd_check_format (abfd, bfd_core))
@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd)
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
return NULL;
}
@ -454,7 +455,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* See build-id.h. */
int
@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
const struct bfd_build_id *found;
int retval = 0;
@ -463,14 +464,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"),
@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
return retval;
}
+static char *
+link_resolve (const char *symlink, int level)
+{
+ char buf[PATH_MAX + 1], *target, *retval;
+ char buf[PATH_MAX + 1], *retval;
+ gdb::unique_xmalloc_ptr<char> target;
+ ssize_t got;
+
+ if (level > 10)
@ -482,7 +484,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ buf[got] = '\0';
+
+ if (IS_ABSOLUTE_PATH (buf))
+ target = xstrdup (buf);
+ target = make_unique_xstrdup (buf);
+ else
+ {
+ const std::string dir (ldirname (symlink));
@ -496,8 +498,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ "%s", dir.c_str(), buf);
+ }
+
+ retval = link_resolve (target, level + 1);
+ xfree (target);
+ retval = link_resolve (target.get (), level + 1);
+ return retval;
+}
+
@ -516,42 +517,49 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
if (separate_debug_file_debug)
{
- printf_unfiltered (_(" Trying %s..."), link.c_str ());
+ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ());
gdb_flush (gdb_stdout);
- fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), link.c_str ());
- gdb_flush (gdb_stdlog);
+ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ());
+ gdb_flush (gdb_stdout);
}
- /* lrealpath() is expensive even for the usually non-existent files. */
- gdb::unique_xmalloc_ptr<char> filename;
- if (access (link.c_str (), F_OK) == 0)
- filename.reset (lrealpath (link.c_str ()));
-
- if (filename == NULL)
- gdb::unique_xmalloc_ptr<char> filename_holder;
- const char *filename = nullptr;
- if (startswith (link, TARGET_SYSROOT_PREFIX))
- filename = link.c_str ();
- else if (access (link.c_str (), F_OK) == 0)
+ for (unsigned seqno = 0;; seqno++)
{
- if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to compute real path\n"));
- filename_holder.reset (lrealpath (link.c_str ()));
- filename = filename_holder.get ();
- }
+ std::string link = orig_link;
- return {};
- }
- if (filename == NULL)
- {
- if (separate_debug_file_debug)
- fprintf_unfiltered (gdb_stdlog,
- _(" no, unable to compute real path\n"));
+ if (seqno > 0)
+ {
+ /* There can be multiple build-id symlinks pointing to real files
+ with the same build-id (such as hard links). Some of the real
+ files may not be installed. */
+
- return {};
- }
+ 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);
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
+ ret_link = link;
- if (debug_bfd == NULL)
- {
- if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to open.\n"));
- fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
+ struct stat statbuf_trash;
+
+ /* `access' automatically dereferences LINK. */
@ -562,35 +570,42 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ }
+
+ /* lrealpath() is expensive even for the usually non-existent files. */
+ gdb::unique_xmalloc_ptr<char> filename;
+
+ if (access (link.c_str (), F_OK) == 0)
+ filename.reset (lrealpath (link.c_str ()));
+ gdb::unique_xmalloc_ptr<char> filename_holder;
+ const char *filename = nullptr;
+ if (startswith (link, TARGET_SYSROOT_PREFIX))
+ filename = link.c_str ();
+ else if (access (link.c_str (), F_OK) == 0)
+ {
+ filename_holder.reset (lrealpath (link.c_str ()));
+ filename = filename_holder.get ();
+ }
+
+ if (filename == NULL)
+ {
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" no, unable to compute real path\n"));
+ fprintf_unfiltered (gdb_stdlog,
+ _(" no, unable to compute real path\n"));
+
+ continue;
+ }
+
+ /* We expect to be silent on the non-existing files. */
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
- return {};
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
+
+ if (debug_bfd == NULL)
+ {
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" no, unable to open.\n"));
+
+ fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
- return {};
+ continue;
+ }
+
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
+ {
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" no, build-id does not match.\n"));
+ fprintf_unfiltered (gdb_stdlog,
+ _(" no, build-id does not match.\n"));
+
+ continue;
+ }
@ -605,17 +620,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ if (ret_bfd != NULL)
{
if (separate_debug_file_debug)
- printf_unfiltered (_(" no, build-id does not match.\n"));
-
- return {};
+ printf_unfiltered (_(" yes!\n"));
- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n"));
+ fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
+ }
+ else
+ {
+ /* If none of the real files is found report as missing file
+ always the non-.%u-suffixed file. */
+ std::string link0 = orig_link;
+
- return {};
+ /* If the symlink has target request to install the target.
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
@ -632,7 +646,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
}
- if (separate_debug_file_debug)
- printf_unfiltered (_(" yes!\n"));
- fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
+ if (link_return != NULL)
+ {
+ if (ret_bfd != NULL)
@ -650,7 +664,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
@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
static gdb_bfd_ref_ptr
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@ -659,7 +673,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (size > 0)
{
size--;
@ -680,17 +694,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL)
return debug_bfd;
@@ -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)
@@ -174,7 +678,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (!gdb_sysroot.empty ())
{
link = gdb_sysroot + link;
- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
+ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id,
+ link_return);
+ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, NULL);
if (debug_bfd != NULL)
return debug_bfd;
}
@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -183,30 +687,649 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {};
}
@ -708,8 +721,440 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ return result;
+}
+
+#ifdef HAVE_LIBRPM
+
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
+#include <rpm/header.h>
+#ifdef DLOPEN_LIBRPM
+#include <dlfcn.h>
+#endif
+
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
+ librpm must not exit() an application on SIGINT
+
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
+int
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
+{
+ return 0;
+}
+
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
+ and avoid their duplicities during a single inferior run. */
+
+static struct htab *missing_rpm_hash;
+
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
+ all the rpms right before the nearest GDB prompt. It gets cleared after
+ each such print (it is questionable if we should clear it after the print).
+ */
+
+struct missing_rpm
+ {
+ struct missing_rpm *next;
+ char rpm[1];
+ };
+static struct missing_rpm *missing_rpm_list;
+static int missing_rpm_list_entries;
+
+/* Returns the count of newly added rpms. */
+
+static int
+#ifndef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename)
+#else
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
+#endif
+{
+ static int rpm_init_done = 0;
+ rpmts ts;
+ rpmdbMatchIterator mi;
+ int count = 0;
+
+#ifdef DLOPEN_LIBRPM
+ /* Duplicate here the declarations to verify they match. The same sanity
+ check is present also in `configure.ac'. */
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
+ extern int rpmReadConfigFiles(const char * file, const char * target);
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
+ extern rpmts rpmtsCreate(void);
+ static rpmts (*rpmtsCreate_p) (void);
+ extern rpmts rpmtsFree(rpmts ts);
+ static rpmts (*rpmtsFree_p) (rpmts ts);
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
+ const void * keyp, size_t keylen);
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
+ rpmTag rpmtag,
+ const void *keyp,
+ size_t keylen);
+#else /* !DLOPEN_LIBRPM */
+# define headerFormat_p headerFormat
+# define rpmReadConfigFiles_p rpmReadConfigFiles
+# define rpmdbFreeIterator_p rpmdbFreeIterator
+# define rpmdbNextIterator_p rpmdbNextIterator
+# define rpmtsCreate_p rpmtsCreate
+# define rpmtsFree_p rpmtsFree
+# define rpmtsInitIterator_p rpmtsInitIterator
+#endif /* !DLOPEN_LIBRPM */
+
+ gdb_assert (filename != NULL);
+
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
+ return 0;
+
+ if (is_target_filename (filename))
+ return 0;
+
+ if (filename[0] != '/')
+ {
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
+ return 0;
+ }
+
+ if (!rpm_init_done)
+ {
+ static int init_tried;
+
+ /* Already failed the initialization before? */
+ if (init_tried)
+ return 0;
+ init_tried = 1;
+
+#ifdef DLOPEN_LIBRPM
+ {
+ void *h;
+
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
+ if (!h)
+ {
+ warning (_("Unable to open \"%s\" (%s), "
+ "missing debuginfos notifications will not be displayed"),
+ DLOPEN_LIBRPM, dlerror ());
+ return 0;
+ }
+
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
+ {
+ warning (_("Opened library \"%s\" is incompatible (%s), "
+ "missing debuginfos notifications will not be displayed"),
+ DLOPEN_LIBRPM, dlerror ());
+ if (dlclose (h))
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
+ dlerror ());
+ return 0;
+ }
+ }
+#endif /* DLOPEN_LIBRPM */
+
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
+ {
+ warning (_("Error reading the rpm configuration files"));
+ return 0;
+ }
+
+ rpm_init_done = 1;
+ }
+
+ ts = rpmtsCreate_p ();
+
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
+ if (mi != NULL)
+ {
+#ifndef GDB_INDEX_VERIFY_VENDOR
+ for (;;)
+#else
+ if (!verify_vendor) for (;;)
+#endif
+ {
+ Header h;
+ char *debuginfo, **slot, *s, *s2;
+ errmsg_t err;
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
+ rpmdbMatchIterator mi_debuginfo;
+
+ h = rpmdbNextIterator_p (mi);
+ if (h == NULL)
+ break;
+
+ /* Verify the debuginfo file is not already installed. */
+
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
+ &err);
+ if (!debuginfo)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+ /* s = `.src.rpm-debuginfo.%{arch}' */
+ s = strrchr (debuginfo, '-') - srcrpmlen;
+ s2 = NULL;
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
+ {
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
+ }
+ if (s2)
+ {
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
+ }
+ if (!s2)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ debuginfo);
+ xfree (debuginfo);
+ continue;
+ }
+ /* s = `.src.rpm-debuginfo.%{arch}' */
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
+ memmove (s2 + debuginfolen, s2, s - s2);
+ memcpy (s2, "-debuginfo", debuginfolen);
+ /* s = `XXXX.%{arch}' */
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
+ /* strlen ("XX") == srcrpmlen */
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
+ strlen (s + srcrpmlen + debuginfolen) + 1);
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
+
+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
+ xfree (debuginfo);
+ if (mi_debuginfo)
+ {
+ rpmdbFreeIterator_p (mi_debuginfo);
+ count = 0;
+ break;
+ }
+
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
+ debuginfo = headerFormat_p (h,
+ "%{name}-%{version}-%{release}.%{arch}",
+ &err);
+ if (!debuginfo)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+
+ /* Base package name for `debuginfo-install'. We do not use the
+ `yum' command directly as the line
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
+ would be more complicated than just:
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
+ Do not supply the rpm base name (derived from .src.rpm name) as
+ debuginfo-install is unable to install the debuginfo package if
+ the base name PKG binary rpm is not installed while for example
+ PKG-libs would be installed (RH Bug 467901).
+ FUTURE: After multiple debuginfo versions simultaneously installed
+ get supported the support for the VERSION-RELEASE tags handling
+ may need an update. */
+
+ if (missing_rpm_hash == NULL)
+ {
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
+ should not deallocate the entries. */
+
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
+ (int (*) (const void *, const void *)) streq,
+ NULL, xcalloc, xfree);
+ }
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
+ /* XCALLOC never returns NULL. */
+ gdb_assert (slot != NULL);
+ if (*slot == NULL)
+ {
+ struct missing_rpm *missing_rpm;
+
+ *slot = debuginfo;
+
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
+ strcpy (missing_rpm->rpm, debuginfo);
+ missing_rpm->next = missing_rpm_list;
+ missing_rpm_list = missing_rpm;
+ missing_rpm_list_entries++;
+ }
+ else
+ xfree (debuginfo);
+ count++;
+ }
+#ifdef GDB_INDEX_VERIFY_VENDOR
+ else /* verify_vendor */
+ {
+ int vendor_pass = 0, vendor_fail = 0;
+
+ for (;;)
+ {
+ Header h;
+ errmsg_t err;
+ char *vendor;
+
+ h = rpmdbNextIterator_p (mi);
+ if (h == NULL)
+ break;
+
+ vendor = headerFormat_p (h, "%{vendor}", &err);
+ if (!vendor)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
+ vendor_pass = 1;
+ else
+ vendor_fail = 1;
+ xfree (vendor);
+ }
+ count = vendor_pass != 0 && vendor_fail == 0;
+ }
+#endif
+
+ rpmdbFreeIterator_p (mi);
+ }
+
+ rpmtsFree_p (ts);
+
+ return count;
+}
+
+#ifdef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 0);
+}
+
+extern int rpm_verify_vendor (const char *filename);
+int
+rpm_verify_vendor (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 1);
+}
+#endif
+
+static bool
+missing_rpm_list_compar (const char *ap, const char *bp)
+{
+ return strcoll (ap, bp) < 0;
+}
+
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
+ also return only NULL. */
+
+static void
+missing_rpm_list_print (void)
+{
+ struct missing_rpm *list_iter;
+
+ if (missing_rpm_list_entries == 0)
+ return;
+
+ std::vector<const char *> array (missing_rpm_list_entries);
+ size_t idx = 0;
+
+ for (list_iter = missing_rpm_list; list_iter != NULL;
+ list_iter = list_iter->next)
+ {
+ array[idx++] = list_iter->rpm;
+ }
+ gdb_assert (idx == missing_rpm_list_entries);
+
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
+ /* We zero out the number of missing RPMs here because of a nasty
+ bug (see RHBZ 1801974).
+
+ When we call 'puts_unfiltered' below, if pagination is on and if
+ the number of missing RPMs is big enough to trigger pagination,
+ we will end up in an infinite recursion. The call chain looks
+ like this:
+
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
+ -> prompt_for_continue -> display_gdb_prompt ->
+ debug_flush_missing -> missing_rpm_list_print ...
+
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
+ *before* calling any print function. */
+ missing_rpm_list_entries = 0;
+
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+#endif
+ "debuginfo-install");
+ for (const char *el : array)
+ {
+ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
+ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
+ list_iter = missing_rpm_list;
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
+}
+
+static void
+missing_rpm_change (void)
+{
+ debug_flush_missing ();
+
+ gdb_assert (missing_rpm_list == NULL);
+ if (missing_rpm_hash != NULL)
+ {
+ htab_delete (missing_rpm_hash);
+ missing_rpm_hash = NULL;
+ }
+}
+
+enum missing_exec
+ {
+ /* Init state. EXEC_BFD also still could be NULL. */
+ MISSING_EXEC_NOT_TRIED,
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
+ MISSING_EXEC_NOT_FOUND,
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
+ or separate) or the main executable's RPM is now contained in
+ MISSING_RPM_HASH. */
+ MISSING_EXEC_ENLISTED
+ };
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
+
+#endif /* HAVE_LIBRPM */
+
+void
+debug_flush_missing (void)
+{
+#ifdef HAVE_LIBRPM
+ missing_rpm_list_print ();
+#endif
+}
+
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ...
+ yum --enablerepo='*debug*' install ...
+ avoidance. */
+
+struct missing_filepair
@ -763,11 +1208,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* All their memory came just from missing_filepair_OBSTACK. */
+ missing_filepair_hash = NULL;
+ }
+#ifdef HAVE_LIBRPM
+ missing_exec = MISSING_EXEC_NOT_TRIED;
+#endif
+}
+
+static void
+debug_print_executable_changed (void)
+{
+#ifdef HAVE_LIBRPM
+ missing_rpm_change ();
+#endif
+ missing_filepair_change ();
+}
+
@ -834,14 +1285,38 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ *slot = missing_filepair;
+
+#ifdef HAVE_LIBRPM
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
+ {
+ const char *execfilename = get_exec_file (0);
+
+ if (execfilename != NULL)
+ {
+ if (missing_rpm_enlist (execfilename) == 0)
+ missing_exec = MISSING_EXEC_NOT_FOUND;
+ else
+ missing_exec = MISSING_EXEC_ENLISTED;
+ }
+ }
+ if (missing_exec != MISSING_EXEC_ENLISTED)
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
+#endif /* HAVE_LIBRPM */
+ {
+ /* We do not collect and flush these messages as each such message
+ already requires its own separate lines. */
+
+ fprintf_unfiltered (gdb_stdlog,
+ _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
+ debug);
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf"
+#else
+ "yum"
+#endif
+ " --enablerepo='*debug*' install", debug);
+ }
+}
+
/* See build-id.h. */
@ -884,7 +1359,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (build_id != NULL)
{
if (separate_debug_file_debug)
printf_unfiltered (_("\nLooking for separate debug info (build-id) for "
@@ -214,8 +1337,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
_("\nLooking for separate debug info (build-id) for "
"%s\n"), objfile_name (objfile));
+ char *build_id_filename_cstr = NULL;
@ -906,7 +1382,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -228,3 +1364,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string ();
}
@ -1056,7 +1532,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21415,6 +21415,27 @@ information files.
@@ -21524,6 +21524,27 @@ information files.
@end table
@ -1087,7 +1563,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
return;
/* Get build id of objfile. */
@ -1095,8 +1571,8 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
if (build_id == nullptr)
{
if (debug_index_cache)
@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
index_cache_debug ("objfile %s has no build id",
@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (dwz != nullptr)
{
@ -1109,7 +1585,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
@@ -5476,7 +5476,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{
@ -1118,7 +1594,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
if (build_id == nullptr)
return {};
@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
@@ -5489,7 +5489,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{
@ -1130,7 +1606,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
{
@ -1141,7 +1617,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
else
{
has_dwarf2 = false;
@ -1150,7 +1626,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (build_id != nullptr)
{
@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
has_dwarf2 = true;
}
}
@ -1164,7 +1640,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
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)
@@ -238,7 +238,7 @@ validate_exec_file (int from_tty)
current_exec_file = get_exec_file (0);
const bfd_build_id *exec_file_build_id
@ -1173,7 +1649,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
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)
@@ -251,7 +251,7 @@ validate_exec_file (int from_tty)
if (abfd != nullptr)
{
const bfd_build_id *target_exec_file_build_id
@ -1185,7 +1661,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -812,6 +812,10 @@ struct objfile
@@ -769,6 +769,10 @@ struct objfile
bool skip_jit_symbol_lookup = false;
};
@ -1228,7 +1704,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 int svr4_have_link_map_offsets (void);
@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1248,9 +1249,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue;
}
@ -1286,7 +1762,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
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)
@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s)
srcpath += s->filename;
}
@ -1381,7 +1857,7 @@ 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
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -130,7 +130,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
@@ -141,7 +141,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nx" \
"-data-directory $BUILD_DATA_DIRECTORY" \
{-iex "set height 0"} \
@ -1391,7 +1867,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
}
# The variable gdb_prompt is a regexp which matches the gdb prompt.
@@ -2130,6 +2131,17 @@ proc default_gdb_start { } {
@@ -2200,6 +2201,17 @@ proc default_gdb_start { } {
}
}

View File

@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid)
@@ -14343,7 +14343,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)

View File

@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
if [get_compiler_info] {
return -1
@@ -71,8 +72,26 @@ gdb_test "br foo2" \
@@ -70,8 +71,26 @@ gdb_test "br foo2" \
"Breakpoint.*: foo2. .2 locations..*" \
"foo2 in mdlib"

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9544,6 +9544,7 @@ if test x"$prefer_curses" = xyes; then
@@ -9567,6 +9567,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -20,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_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then :
@@ -9568,7 +9569,7 @@ return waddstr ();
@@ -9591,7 +9592,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -9642,6 +9643,7 @@ case $host_os in
@@ -9665,6 +9666,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,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_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then :
@@ -9666,7 +9668,7 @@ return tgetent ();
@@ -9689,7 +9691,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then
@@ -713,7 +713,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -778,7 +779,8 @@ case $host_os in
@@ -755,7 +756,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -213,7 +213,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.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], [
@@ -156,7 +156,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5

View File

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

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

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

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

File diff suppressed because it is too large Load Diff

View File

@ -1,592 +0,0 @@
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 11:14:51 +0200
Subject: gdb-test-for-rhbz1976887.patch
;; Backport test for RHBZ 1976887 (Kevin Buettner).
Test case reproducing PR28030 bug
The original reproducer for PR28030 required use of a specific
compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR,
though it seems probable that other gcc versions might also be able to
reproduce the bug as well. This commit introduces a test case which,
using the DWARF assembler, provides a reproducer which is independent
of the compiler version. (Well, it'll work with whatever compilers
the DWARF assembler works with.)
To the best of my knowledge, it's also the first test case which uses
the DWARF assembler to provide debug info for a shared object. That
being the case, I provided more than the usual commentary which should
allow this case to be used as a template when a combo shared
library / DWARF assembler test case is required in the future.
I provide some details regarding the bug in a comment near the
beginning of locexpr-dml.exp.
This problem was difficult to reproduce; I found myself constantly
referring to the backtrace while trying to figure out what (else) I
might be missing while trying to create a reproducer. Below is a
partial backtrace which I include for posterity.
#0 internal_error (
file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575,
fmt=0xc520c0 "Unexpected type field location kind: %d")
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51
#1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930,
type=0x274c260, copied_types=0x30bb290)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575
#2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930,
type=0x274ca10, copied_types=0x30bb290)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602
#3 0x0000000000a7409a in preserve_one_value (value=0x24269f0,
objfile=0x1635930, copied_types=0x30bb290)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529
#4 0x000000000072012a in gdbscm_preserve_values (
extlang=0xc55720 <extension_language_guile>, objfile=0x1635930,
copied_types=0x30bb290)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94
#5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930,
copied_types=0x30bb290)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568
#6 0x0000000000a7428d in preserve_values (objfile=0x1635930)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579
#7 0x000000000082d514 in objfile::~objfile (this=0x1635930,
__in_chrg=<optimized out>)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549
#8 0x0000000000831cc8 in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x1654580)
at /usr/include/c++/11/bits/shared_ptr_base.h:348
#9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168
#10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=<optimized out>)
at /usr/include/c++/11/bits/shared_ptr_base.h:705
#11 0x000000000082feee in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x190bb80, __in_chrg=<optimized out>)
at /usr/include/c++/11/bits/shared_ptr_base.h:1154
#12 0x000000000082ff0a in std::shared_ptr<objfile>::~shared_ptr (
this=0x190bb80, __in_chrg=<optimized out>)
at /usr/include/c++/11/bits/shared_ptr.h:122
#13 0x000000000085ed7e in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x114bc00,
__p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168
#14 0x000000000085e88d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=...,
__p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531
#15 0x000000000085e50c in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x114bc00, __position=
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
at /usr/include/c++/11/bits/stl_list.h:1925
#16 0x000000000085df0e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x114bc00, __position=
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
at /usr/include/c++/11/bits/list.tcc:158
#17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0,
objfile=0x1635930)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210
#18 0x000000000082d3ae in objfile::unlink (this=0x1635930)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487
#19 0x000000000082e68c in objfile_purge_solibs ()
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875
#20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236
#21 0x00000000009a37fe in target_pre_inferior (from_tty=1)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496
#22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1,
run_how=RUN_NORMAL)
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437
I'll note a few points regarding this backtrace:
Frame #1 is where the internal error occurs. It's caused by an
unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug
adds support for this case.
Frame #22 - it's a partial backtrace - shows that GDB is attempting to
(re)run the program. You can see the exact command sequence that was
used for reproducing this problem in the PR (at
https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a
nutshell, after starting the program and advancing to the appropriate
source line, GDB was asked to step into libstdc++; a "finish" command
was issued, returning a value. The fact that a value was returned is
very important. GDB was then used to step back into libstdc++. A
breakpoint was set on a source line in the library after which a "run"
command was issued.
Frame #19 shows a call to objfile_purge_solibs. It's aptly named.
Frame #7 is a call to the destructor for one of the objfile solibs; it
turned out to be the one for libstdc++.
Frames #6 thru #3 show various value preservation frames. If you look
at preserve_values() in gdb/value.c, the value history is preserved
first, followed by internal variables, followed by values for the
extension languages (python and guile).
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "locexpr-data-member-location.h"
+
+struct A g_A = {3, 4};
+struct B g_B = { {8, 9}, 10, 11 };
+
+B *
+foo ()
+{ /* foo prologue */
+ asm ("foo_label: .globl foo_label");
+ return &g_B; /* foo return */
+} /* foo end */
+
+B *
+bar (B *v)
+{ /* bar prologue */
+ asm ("bar_label: .globl bar_label");
+ return v; /* bar return */
+} /* bar end */
+
+/* Some of the DWARF assembler procs (e.g. function_range) compile
+ this file, expecting it to be a complete program with a main()
+ function. When IS_SHAREDLIB is NOT defined, we have main() as
+ defined below. */
+
+#ifndef IS_SHAREDLIB
+int
+main ()
+{
+ B *b = foo ();
+}
+#endif
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "locexpr-data-member-location.h"
+
+int
+main (void)
+{
+ B *v1;
+ v1 = bar (foo ());
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -0,0 +1,349 @@
+# 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/>.
+
+# This test case uses the DWARF assembler to reproduce the problem
+# described by PR28030. The bug turned out to be that
+# FIELD_LOC_KIND_DWARF_BLOCK was not handled when recursively copying
+# a value's type when preserving the value history during the freeing
+# up of objfiles associated with a shared object. (Yes, figuring out
+# how to make this happen in a concise test case turned out to be
+# challenging.)
+#
+# The following elements proved to be necessary for reproducing the
+# problem:
+#
+# 1) A location expression needed to be used with
+# DW_AT_data_member_location rather than a simple offset.
+# Moreover, this location expression needed to use opcodes
+# which GDB's DWARF reader could not convert to a simple
+# offset. (Note, however, that GDB could probably be improved
+# to handle the opcodes chosen for this test; if decode_locdesc()
+# in dwarf2/read.c is ever updated to handle both DW_OP_pick and
+# DW_OP_drop, then this test could end up passing even if
+# the bug it's intended to test has not been fixed.)
+#
+# 2) The debug info containing the above DWARF info needed
+# to be associated with a shared object since the problem
+# occurred while GDB was preserving values during the
+# purging of shared objects.
+#
+# 3) After performing some simple gdb commands, the program is
+# run again. In the course of running the objfile destructor
+# associated with the shared object, values are preserved
+# along with their types. As noted earlier, it was during
+# the recursive type copy that the bug was observed.
+#
+# Therefore, due to #2 above, this test case creates debug info
+# which is then used by a shared object.
+
+# This test can't be run on targets lacking shared library support.
+if [skip_shlib_tests] {
+ return 0
+}
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if ![dwarf2_support] {
+ return 0
+}
+
+# gdb_test_file_name is the name of this file without the .exp
+# extension. Use it to form basenames for the main program
+# and shared object.
+set main_basename ${::gdb_test_file_name}-main
+set lib_basename ${::gdb_test_file_name}-lib
+
+# We're generating DWARF assembly for the shared object; therefore,
+# the source file for the library / shared object must be listed first
+# (in the standard_testfile invocation) since ${srcfile} is used by
+# get_func_info (for determining the start, end, and length of a
+# function).
+#
+# The output of Dwarf::assemble will be placed in $lib_basename.S
+# which will be ${srcfile3} after the execution of standard_testfile.
+
+standard_testfile $lib_basename.c $main_basename.c $lib_basename.S
+
+set libsrc "${::srcdir}/${::subdir}/${::srcfile}"
+set lib_so [standard_output_file ${lib_basename}.so]
+set asm_file [standard_output_file ${::srcfile3}]
+
+# We need to know the size of some types in order to write some of the
+# debugging info that we're about to generate. For that, we ask GDB
+# by debugging the shared object associated with this test case.
+
+# Compile the shared library: -DIS_SHAREDLIB prevents main() from
+# being defined. Note that debugging symbols will be present for
+# this compilation.
+if {[gdb_compile_shlib $libsrc $lib_so \
+ {additional_flags=-DIS_SHAREDLIB debug}] != ""} {
+ untested "failed to compile shared library"
+ return
+}
+
+# Start a fresh GDB and load the shared library.
+clean_restart $lib_so
+
+# Using our running GDB session, determine sizes of several types.
+set long_size [get_sizeof "long" -1]
+set addr_size [get_sizeof "void *" -1]
+set struct_A_size [get_sizeof "g_A" -1]
+set struct_B_size [get_sizeof "g_B" -1]
+
+if { $long_size == -1 || $addr_size == -1 \
+ || $struct_A_size == -1 || $struct_B_size == -1} {
+ perror "Can't determine type sizes"
+ return
+}
+
+# Retrieve struct offset of MBR in struct TP
+proc get_offsetof { tp mbr } {
+ return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1]
+}
+
+# Use running GDB session to get struct offsets
+set A_a [get_offsetof A a]
+set A_x [get_offsetof A x]
+set B_a [get_offsetof B a]
+set B_b [get_offsetof B b]
+set B_x2 [get_offsetof B x2]
+
+# Create the DWARF.
+Dwarf::assemble ${asm_file} {
+ declare_labels L
+
+ # Find start, end, and length of functions foo and bar.
+ # These calls to get_func_info will create and set variables
+ # foo_start, bar_start, foo_end, bar_end, foo_len, and
+ # bar_len.
+ #
+ # In order to get the right answers, get_func_info (and,
+ # underneath, function_range) should use the same compiler flags
+ # as those used to make a shared object. For any targets that get
+ # this far, -fpic is probably correct.
+ #
+ # Also, it should be noted that IS_SHAREDLIB is NOT defined as one
+ # of the additional flags. Not defining IS_SHAREDLIB will cause a
+ # main() to be defined for the compilation of the shared library
+ # source file which happens as a result of using get_func_info;
+ # this is currently required in order to this facility.
+ set flags {additional_flags=-fpic debug}
+ get_func_info foo $flags
+ get_func_info bar $flags
+
+ cu {} {
+ DW_TAG_compile_unit {
+ {DW_AT_language @DW_LANG_C_plus_plus}
+ {name ${::srcfile}}
+ {stmt_list $L DW_FORM_sec_offset}
+ } {
+ declare_labels int_label class_A_label class_B_label \
+ B_ptr_label
+
+ int_label: DW_TAG_base_type {
+ {DW_AT_byte_size ${::long_size} DW_FORM_udata}
+ {DW_AT_encoding @DW_ATE_signed}
+ {DW_AT_name "int"}
+ }
+
+ class_A_label: DW_TAG_class_type {
+ {DW_AT_name "A"}
+ {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata}
+ } {
+ DW_TAG_member {
+ {DW_AT_name "a"}
+ {DW_AT_type :$int_label}
+ {DW_AT_data_member_location ${::A_a} DW_FORM_udata}
+ }
+ DW_TAG_member {
+ {DW_AT_name "x"}
+ {DW_AT_type :$int_label}
+ {DW_AT_data_member_location ${::A_x} DW_FORM_udata}
+ }
+ }
+
+ class_B_label: DW_TAG_class_type {
+ {DW_AT_name "B"}
+ {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata}
+ } {
+ # While there are easier / better ways to specify an
+ # offset used by DW_AT_data_member_location than that
+ # used below, we need a location expression here in
+ # order to reproduce the bug. Moreover, this location
+ # expression needs to use opcodes that aren't handled
+ # by decode_locdesc() in dwarf2/read.c; if we use
+ # opcodes that _are_ handled by that function, the
+ # location expression will be converted into a simple
+ # offset - which will then (again) not reproduce the
+ # bug. At the time that this test was written,
+ # neither DW_OP_pick nor DW_OP_drop were being handled
+ # by decode_locdesc(); this is why those opcodes were
+ # chosen.
+ DW_TAG_inheritance {
+ {DW_AT_type :$class_A_label}
+ {DW_AT_data_member_location {
+ DW_OP_constu ${::B_a}
+ DW_OP_plus
+ DW_OP_pick 0
+ DW_OP_drop} SPECIAL_expr}
+ {DW_AT_accessibility 1 DW_FORM_data1}
+ }
+ DW_TAG_member {
+ {DW_AT_name "b"}
+ {DW_AT_type :$int_label}
+ {DW_AT_data_member_location ${::B_b} DW_FORM_udata}
+ }
+ DW_TAG_member {
+ {DW_AT_name "x2"}
+ {DW_AT_type :$int_label}
+ {DW_AT_data_member_location ${::B_x2} DW_FORM_udata}
+ }
+ }
+
+ B_ptr_label: DW_TAG_pointer_type {
+ {DW_AT_type :$class_B_label}
+ {DW_AT_byte_size ${::addr_size} DW_FORM_sdata}
+ }
+
+ DW_TAG_variable {
+ {DW_AT_name "g_A"}
+ {DW_AT_type :$class_A_label}
+ {DW_AT_external 1 flag}
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \
+ SPECIAL_expr}
+ }
+
+ DW_TAG_variable {
+ {DW_AT_name "g_B"}
+ {DW_AT_type :$class_B_label}
+ {DW_AT_external 1 flag}
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \
+ SPECIAL_expr}
+ }
+
+ # We can't use MACRO_AT for the definitions of foo and bar
+ # because it doesn't provide a way to pass the appropriate
+ # flags. Therefore, we list the name, low_pc, and high_pc
+ # explicitly.
+ DW_TAG_subprogram {
+ {DW_AT_name foo}
+ {DW_AT_low_pc $foo_start DW_FORM_addr}
+ {DW_AT_high_pc $foo_end DW_FORM_addr}
+ {DW_AT_type :${B_ptr_label}}
+ {DW_AT_external 1 flag}
+ }
+
+ DW_TAG_subprogram {
+ {DW_AT_name bar}
+ {DW_AT_low_pc $bar_start DW_FORM_addr}
+ {DW_AT_high_pc $bar_end DW_FORM_addr}
+ {DW_AT_type :${B_ptr_label}}
+ {DW_AT_external 1 flag}
+ } {
+ DW_TAG_formal_parameter {
+ {DW_AT_name v}
+ {DW_AT_type :${B_ptr_label}}
+ }
+ }
+ }
+ }
+
+ lines {version 2} L {
+ include_dir "${::srcdir}/${::subdir}"
+ file_name "${::srcfile}" 1
+
+ # Generate a line table program.
+ program {
+ {DW_LNE_set_address $foo_start}
+ {line [gdb_get_line_number "foo prologue"]}
+ {DW_LNS_copy}
+ {DW_LNE_set_address foo_label}
+ {line [gdb_get_line_number "foo return"]}
+ {DW_LNS_copy}
+ {line [gdb_get_line_number "foo end"]}
+ {DW_LNS_copy}
+ {DW_LNE_set_address $foo_end}
+ {DW_LNS_advance_line 1}
+ {DW_LNS_copy}
+ {DW_LNE_end_sequence}
+
+ {DW_LNE_set_address $bar_start}
+ {line [gdb_get_line_number "bar prologue"]}
+ {DW_LNS_copy}
+ {DW_LNE_set_address bar_label}
+ {line [gdb_get_line_number "bar return"]}
+ {DW_LNS_copy}
+ {line [gdb_get_line_number "bar end"]}
+ {DW_LNS_copy}
+ {DW_LNE_set_address $bar_end}
+ {DW_LNS_advance_line 1}
+ {DW_LNS_copy}
+ {DW_LNE_end_sequence}
+ }
+ }
+}
+
+# Compile the shared object again, but this time include / use the
+# DWARF info that we've created above. Note that (again)
+# -DIS_SHAREDLIB is used to prevent inclusion of main() in the shared
+# object. Also note the use of the "nodebug" option. Any debugging
+# information that we need will be provided by the DWARF info created
+# above.
+if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \
+ {additional_flags=-DIS_SHAREDLIB nodebug}] != ""} {
+ untested "failed to compile shared library"
+ return
+}
+
+# Compile the main program for use with the shared object.
+if [prepare_for_testing "failed to prepare" ${testfile} \
+ ${::srcfile2} [list debug shlib=$lib_so]] {
+ return -1
+}
+
+# Do whatever is necessary to make sure that the shared library is
+# loaded for remote targets.
+gdb_load_shlib ${lib_so}
+
+if ![runto_main] then {
+ fail "can't run to main"
+ return
+}
+
+# Step into foo so that we can finish out of it.
+gdb_test "step" "foo .. at .* foo end.*" "step into foo"
+
+# Finishing out of foo will create a value that will later need to
+# be preserved when restarting the program.
+gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo"
+
+# Dereferencing and printing the return value isn't necessary
+# for reproducing the bug, but we should make sure that the
+# return value is what we expect it to be.
+gdb_test "p *$" { = {<A> = {a = 8, x = 9}, b = 10, x2 = 11}} \
+ "dereference return value"
+
+# The original PR28030 reproducer stepped back into the shared object,
+# so we'll do the same here:
+gdb_test "step" "bar \\(.*" "step into bar"
+
+# We don't want a clean restart here since that will be too clean.
+# The original reproducer for PR28030 set a breakpoint in the shared
+# library and then restarted via "run". The command below does roughly
+# the same thing. It's at this step that an internal error would
+# occur for PR28030. The "message" argument tells runto to turn on
+# the printing of PASSes while runto is doing its job.
+runto "bar" message
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+typedef struct A {
+ long a;
+ long x;
+} A;
+
+typedef struct B {
+ A a;
+ long b;
+ long x2;
+} B;
+
+extern B *foo ();
+extern B *bar (B *v);

167
gdb.spec
View File

@ -1,9 +1,9 @@
Name: gdb
Version: 11.1
Release: 4
Version: 12.1
Release: 1
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL-1.3
Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.xz
Source: https://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.xz
URL: http://gnu.org/software/gdb/
Source1: gdb-gstack.man
@ -12,88 +12,80 @@ Source2: gdbinit
# patch from Fedora
Patch1: gdb-6.3-rh-testversion-20041202.patch
Patch2: gdb-6.3-gstack-20050411.patch
Patch3: gdb-6.3-test-dtorfix-20050121.patch
Patch4: gdb-6.3-test-movedir-20050125.patch
Patch5: gdb-6.3-threaded-watchpoints2-20050225.patch
Patch6: gdb-6.3-inferior-notification-20050721.patch
Patch7: gdb-6.3-inheritancetest-20050726.patch
Patch8: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Patch9: gdb-6.5-sharedlibrary-path.patch
Patch10: gdb-6.5-BEA-testsuite.patch
Patch11: gdb-6.5-last-address-space-byte-test.patch
Patch12: gdb-6.5-readline-long-line-crash-test.patch
Patch13: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch14: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch15: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch16: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch17: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch18: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch19: gdb-6.6-testsuite-timeouts.patch
Patch20: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch21: gdb-6.3-attach-see-vdso-test.patch
Patch22: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch23: gdb-6.6-buildid-locate.patch
Patch24: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch25: gdb-6.6-buildid-locate-rpm.patch
Patch26: gdb-6.7-charsign-test.patch
Patch27: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch28: gdb-6.7-testsuite-stable-results.patch
Patch29: gdb-6.5-ia64-libunwind-leak-test.patch
Patch30: gdb-6.5-missed-trap-on-step-test.patch
Patch31: gdb-6.5-gcore-buffer-limit-test.patch
Patch32: gdb-6.3-mapping-zero-inode-test.patch
Patch33: gdb-6.3-focus-cmd-prev-test.patch
Patch34: gdb-6.8-bz442765-threaded-exec-test.patch
Patch35: gdb-6.5-section-num-fixup-test.patch
Patch36: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch37: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch38: gdb-core-open-vdso-warning.patch
Patch39: gdb-ccache-workaround.patch
Patch40: gdb-lineno-makeup-test.patch
Patch41: gdb-ppc-power7-test.patch
Patch42: gdb-archer-next-over-throw-cxx-exec.patch
Patch43: gdb-bz601887-dwarf4-rh-test.patch
Patch44: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch45: gdb-test-bt-cfi-without-die.patch
Patch46: gdb-bz634108-solib_address.patch
Patch47: gdb-test-pid0-core.patch
Patch48: gdb-test-dw2-aranges.patch
Patch49: gdb-test-expr-cumulative-archer.patch
Patch50: gdb-physname-pr11734-test.patch
Patch51: gdb-physname-pr12273-test.patch
Patch52: gdb-test-ivy-bridge.patch
Patch53: gdb-runtest-pie-override.patch
Patch54: gdb-glibc-strstr-workaround.patch
Patch55: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch56: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch57: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch58: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch59: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch60: gdb-fortran-frame-string.patch
Patch61: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch62: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch63: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch64: gdb-rhbz1350436-type-printers-error.patch
Patch65: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch66: gdb-fedora-libncursesw.patch
Patch67: gdb-opcodes-clflushopt-test.patch
Patch68: gdb-6.6-buildid-locate-rpm-scl.patch
Patch69: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch70: gdb-container-rh-pkg.patch
Patch71: gdb-rhbz1325795-framefilters-test.patch
Patch72: gdb-linux_perf-bundle.patch
Patch73: gdb-libexec-add-index.patch
Patch74: gdb-rhbz1398387-tab-crash-test.patch
Patch75: gdb-rhbz1553104-s390x-arch12-test.patch
Patch76: gdb-rhbz1976887-field-location-kind.patch
Patch77: gdb-test-for-rhbz1976887.patch
Patch78: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
Patch79: gdb-rhbz-853071-update-manpages.patch
Patch80: gdb-rhbz2022177-dprintf-1.patch
Patch81: gdb-rhbz2022177-dprintf-2.patch
Patch3: gdb-6.3-test-movedir-20050125.patch
Patch4: gdb-6.3-threaded-watchpoints2-20050225.patch
Patch5: gdb-6.3-inheritancetest-20050726.patch
Patch6: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Patch7: gdb-6.5-sharedlibrary-path.patch
Patch8: gdb-6.5-BEA-testsuite.patch
Patch9: gdb-6.5-last-address-space-byte-test.patch
Patch10: gdb-6.5-readline-long-line-crash-test.patch
Patch11: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch12: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch13: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch14: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch15: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch16: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch17: gdb-6.6-testsuite-timeouts.patch
Patch18: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch19: gdb-6.3-attach-see-vdso-test.patch
Patch20: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch21: gdb-6.6-buildid-locate.patch
Patch22: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch23: gdb-6.6-buildid-locate-rpm.patch
Patch24: gdb-6.7-charsign-test.patch
Patch25: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch26: gdb-6.7-testsuite-stable-results.patch
Patch27: gdb-6.5-ia64-libunwind-leak-test.patch
Patch28: gdb-6.5-missed-trap-on-step-test.patch
Patch29: gdb-6.5-gcore-buffer-limit-test.patch
Patch30: gdb-6.3-mapping-zero-inode-test.patch
Patch31: gdb-6.3-focus-cmd-prev-test.patch
Patch32: gdb-6.8-bz442765-threaded-exec-test.patch
Patch33: gdb-6.5-section-num-fixup-test.patch
Patch34: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch35: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch36: gdb-core-open-vdso-warning.patch
Patch37: gdb-ccache-workaround.patch
Patch38: gdb-lineno-makeup-test.patch
Patch39: gdb-ppc-power7-test.patch
Patch40: gdb-archer-next-over-throw-cxx-exec.patch
Patch41: gdb-bz601887-dwarf4-rh-test.patch
Patch42: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch43: gdb-test-bt-cfi-without-die.patch
Patch44: gdb-bz634108-solib_address.patch
Patch45: gdb-test-pid0-core.patch
Patch46: gdb-test-dw2-aranges.patch
Patch47: gdb-test-expr-cumulative-archer.patch
Patch48: gdb-physname-pr11734-test.patch
Patch49: gdb-physname-pr12273-test.patch
Patch50: gdb-test-ivy-bridge.patch
Patch51: gdb-runtest-pie-override.patch
Patch52: gdb-glibc-strstr-workaround.patch
Patch53: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch54: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch55: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch56: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch57: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch58: gdb-fortran-frame-string.patch
Patch59: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch60: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch61: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch62: gdb-rhbz1350436-type-printers-error.patch
Patch63: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch64: gdb-fedora-libncursesw.patch
Patch65: gdb-opcodes-clflushopt-test.patch
Patch66: gdb-6.6-buildid-locate-rpm-scl.patch
Patch67: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch68: gdb-container-rh-pkg.patch
Patch69: gdb-rhbz1325795-framefilters-test.patch
Patch70: gdb-linux_perf-bundle.patch
Patch71: gdb-libexec-add-index.patch
Patch72: gdb-rhbz1398387-tab-crash-test.patch
Patch73: gdb-rhbz1553104-s390x-arch12-test.patch
Patch76: gdb-sw22395-constify-target_desc.patch
# Fedra patch end
Patch82: 0001-Make-c-exp.y-work-with-Bison-3.8.patch
Patch83: 0002-set-entry-point-when-text-segment-is-missing.patch
%global gdb_src gdb-%{version}
@ -278,7 +270,7 @@ touch -r %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"`
do
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
done
%if 0%{?_enable_debug_packages:1}
@ -294,8 +286,9 @@ for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do
ln -s $(echo %{_prefix}|sed 's#^/*##')/$i \
$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/$i
done
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb -name "*.py"`; do
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
done
# Remove part of binutils files
@ -366,8 +359,12 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py
%doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf}
%{_infodir}/annotate.info*
%{_infodir}/gdb.info*
%{_infodir}/ctf-spec.info.gz
%changelog
* Fri Nov 18 2022 yaowenbin <yaowenbin1@huawei.com> - 12.1-1
- upgrade GDB version to 12.1
* Mon Aug 15 2022 laokz <laokz@foxmail.com> - 11.1-4
- fix riscv64 relevant config

View File

@ -1,13 +0,0 @@
Index: processor-trace-2.0/libipt/src/posix/init.c
===================================================================
--- processor-trace-2.0.orig/libipt/src/posix/init.c
+++ processor-trace-2.0/libipt/src/posix/init.c
@@ -29,7 +29,7 @@
#include "pt_ild.h"
-static void __attribute__((constructor)) init(void)
+void __libipt_init(void)
{
/* Initialize the Intel(R) Processor Trace instruction decoder. */
pt_ild_init();