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