]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
- updated to 14.1 + rebased Fedora buildid patches set
[packages/gdb.git] / gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
CommitLineData
4b0e5c1b
AM
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
4b0e5c1b
AM
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
321e94d6
BS
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
4b0e5c1b
AM
28diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
29new file mode 100644
4b0e5c1b
AM
30--- /dev/null
31+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
321e94d6
BS
32@@ -0,0 +1,97 @@
33+# Copyright (C) 2014 Free Software Foundation, Inc.
34+
35+# This program is free software; you can redistribute it and/or modify
36+# it under the terms of the GNU General Public License as published by
37+# the Free Software Foundation; either version 3 of the License, or
38+# (at your option) any later version.
39+#
40+# This program is distributed in the hope that it will be useful,
41+# but WITHOUT ANY WARRANTY; without even the implied warranty of
42+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43+# GNU General Public License for more details.
44+#
45+# You should have received a copy of the GNU General Public License
46+# along with this program. If not, see <http://www.gnu.org/licenses/>.
47+
48+standard_testfile "normal.c"
49+
50+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
51+ return -1
52+}
53+
54+# Get the build-id of the file
55+set build_id_debug_file [build_id_debug_filename_get $binfile]
56+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
57+
58+# Run to main
59+if { ![runto_main] } {
60+ return -1
61+}
62+
63+# We first need to generate a corefile
28b292e9 64+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
321e94d6 65+set core_supported 0
28b292e9 66+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
321e94d6
BS
67+ "save a corefile" \
68+{
69+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
70+ pass "save a corefile"
71+ global core_supported
72+ set core_supported 1
73+ }
74+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
75+ unsupported "save a corefile"
76+ global core_supported
77+ set core_supported 0
78+ }
79+}
80+
81+if {!$core_supported} {
82+ return -1
83+}
84+
85+# Move the binfile to a temporary name
86+remote_exec build "mv $binfile ${binfile}.old"
87+
324d13e1 88+# Reinitialize GDB and see if we get a yum/dnf warning
321e94d6
BS
89+gdb_exit
90+gdb_start
91+gdb_reinitialize_dir $srcdir/$subdir
92+
93+with_test_prefix "first run:" {
94+ gdb_test "set build-id-verbose 1" "" \
95+ "set build-id-verbose"
96+
28b292e9 97+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
321e94d6
BS
98+ "set debug-file-directory"
99+
28b292e9
AM
100+ gdb_test "core-file [standard_output_file gcore.test]" \
101+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install [standard_output_file $build_id_without_debug]\r\n.*" \
324d13e1 102+ "test first yum/dnf warning"
321e94d6
BS
103+}
104+
105+# Now we define and create our .build-id
28b292e9 106+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
321e94d6
BS
107+# Cannot use "file link" (from TCL) because it requires the target file to
108+# exist.
28b292e9 109+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
321e94d6 110+
324d13e1 111+# Reinitialize GDB to get the second yum/dnf warning
321e94d6
BS
112+gdb_exit
113+gdb_start
114+gdb_reinitialize_dir $srcdir/$subdir
115+
116+with_test_prefix "second run:" {
117+ gdb_test "set build-id-verbose 1" "" \
118+ "set build-id-verbose"
119+
28b292e9 120+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
321e94d6
BS
121+ "set debug-file-directory"
122+
28b292e9 123+ gdb_test "core-file [standard_output_file gcore.test]" \
324d13e1
JR
124+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
125+ "test second yum/dnf warning"
321e94d6
BS
126+}
127+
128+# Leaving the link there will cause breakage in the next run.
28b292e9 129+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
This page took 0.087654 seconds and 4 git commands to generate.