]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
- fix build on x32
[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
140f8057 18Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
321e94d6 19===================================================================
324d13e1 20--- /dev/null 1970-01-01 00:00:00.000000000 +0000
140f8057 21+++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp 2017-02-26 19:14:58.492609659 +0100
321e94d6
BS
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
28b292e9 54+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
321e94d6 55+set core_supported 0
28b292e9 56+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
321e94d6
BS
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+
324d13e1 78+# Reinitialize GDB and see if we get a yum/dnf warning
321e94d6
BS
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+
28b292e9 87+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
321e94d6
BS
88+ "set debug-file-directory"
89+
28b292e9
AM
90+ gdb_test "core-file [standard_output_file gcore.test]" \
91+ "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 92+ "test first yum/dnf warning"
321e94d6
BS
93+}
94+
95+# Now we define and create our .build-id
28b292e9 96+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
321e94d6
BS
97+# Cannot use "file link" (from TCL) because it requires the target file to
98+# exist.
28b292e9 99+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
321e94d6 100+
324d13e1 101+# Reinitialize GDB to get the second yum/dnf warning
321e94d6
BS
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+
28b292e9 110+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
321e94d6
BS
111+ "set debug-file-directory"
112+
28b292e9 113+ gdb_test "core-file [standard_output_file gcore.test]" \
324d13e1
JR
114+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
115+ "test second yum/dnf warning"
321e94d6
BS
116+}
117+
118+# Leaving the link there will cause breakage in the next run.
28b292e9 119+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
140f8057 120Index: gdb-7.12.50.20170207/gdb/build-id.c
321e94d6 121===================================================================
140f8057
JR
122--- gdb-7.12.50.20170207.orig/gdb/build-id.c 2017-02-26 19:14:51.943562799 +0100
123+++ gdb-7.12.50.20170207/gdb/build-id.c 2017-02-26 19:14:58.492609659 +0100
28b292e9 124@@ -589,7 +589,10 @@
324d13e1
JR
125 do_cleanups (inner);
126
321e94d6 127 if (abfd == NULL)
324d13e1
JR
128- continue;
129+ {
321e94d6 130+ filename = NULL;
324d13e1
JR
131+ continue;
132+ }
321e94d6 133
140f8057 134 if (build_id_verify (abfd.get(), build_id_len, build_id))
324d13e1 135 break;
This page took 0.050462 seconds and 4 git commands to generate.