]> git.pld-linux.org Git - packages/gdb.git/blame_incremental - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
- release 2 (by relup.sh)
[packages/gdb.git] / gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
... / ...
CommitLineData
1From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2From: Fedora GDB patches <invalid@email.com>
3Date: Fri, 27 Oct 2017 21:07:50 +0200
4Subject:
5 gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
6
7;; Fix 'gdb gives highly misleading error when debuginfo pkg is present,
8;; but not corresponding binary pkg' (RH BZ 981154).
9;;=push+jan
10
11Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
12
13 This is the fix for RH BZ #981154
14
15 It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
16 file was also needed.
17
18 gdb/build-id.c was added by:
19
20 commit dc294be54c96414035eed7d53dafdea0a6f31a72
21 Author: Tom Tromey <tromey@redhat.com>
22 Date: Tue Oct 8 19:56:15 2013 +0000
23
24 and had a little thinko there. The variable 'filename' needs to be set to
25 NULL after it is free'd, otherwise the code below thinks that it is still
26 valid and doesn't print the necessary warning ("Try: yum install ...").
27
28diff --git a/gdb/build-id.c b/gdb/build-id.c
29--- a/gdb/build-id.c
30+++ b/gdb/build-id.c
31@@ -581,7 +581,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
32 do_cleanups (inner);
33
34 if (abfd == NULL)
35- continue;
36+ {
37+ filename = NULL;
38+ continue;
39+ }
40
41 if (build_id_verify (abfd.get(), build_id_len, build_id))
42 break;
43diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
44new file mode 100644
45--- /dev/null
46+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
47@@ -0,0 +1,97 @@
48+# Copyright (C) 2014 Free Software Foundation, Inc.
49+
50+# This program is free software; you can redistribute it and/or modify
51+# it under the terms of the GNU General Public License as published by
52+# the Free Software Foundation; either version 3 of the License, or
53+# (at your option) any later version.
54+#
55+# This program is distributed in the hope that it will be useful,
56+# but WITHOUT ANY WARRANTY; without even the implied warranty of
57+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+# GNU General Public License for more details.
59+#
60+# You should have received a copy of the GNU General Public License
61+# along with this program. If not, see <http://www.gnu.org/licenses/>.
62+
63+standard_testfile "normal.c"
64+
65+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
66+ return -1
67+}
68+
69+# Get the build-id of the file
70+set build_id_debug_file [build_id_debug_filename_get $binfile]
71+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
72+
73+# Run to main
74+if { ![runto_main] } {
75+ return -1
76+}
77+
78+# We first need to generate a corefile
79+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
80+set core_supported 0
81+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
82+ "save a corefile" \
83+{
84+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
85+ pass "save a corefile"
86+ global core_supported
87+ set core_supported 1
88+ }
89+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
90+ unsupported "save a corefile"
91+ global core_supported
92+ set core_supported 0
93+ }
94+}
95+
96+if {!$core_supported} {
97+ return -1
98+}
99+
100+# Move the binfile to a temporary name
101+remote_exec build "mv $binfile ${binfile}.old"
102+
103+# Reinitialize GDB and see if we get a yum/dnf warning
104+gdb_exit
105+gdb_start
106+gdb_reinitialize_dir $srcdir/$subdir
107+
108+with_test_prefix "first run:" {
109+ gdb_test "set build-id-verbose 1" "" \
110+ "set build-id-verbose"
111+
112+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
113+ "set debug-file-directory"
114+
115+ gdb_test "core-file [standard_output_file gcore.test]" \
116+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install [standard_output_file $build_id_without_debug]\r\n.*" \
117+ "test first yum/dnf warning"
118+}
119+
120+# Now we define and create our .build-id
121+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
122+# Cannot use "file link" (from TCL) because it requires the target file to
123+# exist.
124+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
125+
126+# Reinitialize GDB to get the second yum/dnf warning
127+gdb_exit
128+gdb_start
129+gdb_reinitialize_dir $srcdir/$subdir
130+
131+with_test_prefix "second run:" {
132+ gdb_test "set build-id-verbose 1" "" \
133+ "set build-id-verbose"
134+
135+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
136+ "set debug-file-directory"
137+
138+ gdb_test "core-file [standard_output_file gcore.test]" \
139+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
140+ "test second yum/dnf warning"
141+}
142+
143+# Leaving the link there will cause breakage in the next run.
144+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
This page took 0.050517 seconds and 4 git commands to generate.