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