]> git.pld-linux.org Git - packages/gdb.git/blob - 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
1 Comments 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
18 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
19 ===================================================================
20 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
21 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp   2017-02-26 19:14:58.492609659 +0100
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 [standard_output_file gcore.test]]
55 +set core_supported 0
56 +gdb_test_multiple "gcore [standard_output_file 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/dnf 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 [file dirname [standard_output_file gcore.test]]" "" \
88 +       "set debug-file-directory"
89 +
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.*" \
92 +       "test first yum/dnf warning"
93 +}
94 +
95 +# Now we define and create our .build-id
96 +file mkdir [file dirname [standard_output_file ${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 [standard_output_file ${build_id_without_debug}]"
100 +
101 +# Reinitialize GDB to get the second yum/dnf 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 [file dirname [standard_output_file gcore.test]]" "" \
111 +       "set debug-file-directory"
112 +
113 +    gdb_test "core-file [standard_output_file gcore.test]" \
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"
116 +}
117 +
118 +# Leaving the link there will cause breakage in the next run.
119 +remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
120 Index: gdb-7.12.50.20170207/gdb/build-id.c
121 ===================================================================
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
124 @@ -589,7 +589,10 @@
125           do_cleanups (inner);
126  
127           if (abfd == NULL)
128 -           continue;
129 +           {
130 +             filename = NULL;
131 +             continue;
132 +           }
133  
134           if (build_id_verify (abfd.get(), build_id_len, build_id))
135             break;
This page took 0.065216 seconds and 3 git commands to generate.