gdb/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Michael Matz b288fe5a9a - Rebase to gdb version 7.11 as of version in Fedora 24:
* Per-inferior thread numbers. 
  * Breakpoint "explicit locations" (via CLI and GDB/MI). 
  * New convenience variables ($_gthread, $_inferior). 
  * Record btrace now supports non-stop mode. 
  * Various improvements on AArch64 GNU/Linux: 
    - Multi-architecture debugging support. 
    - displaced stepping. 
    - tracepoint support added in GDBserver. 
  * In Ada, the overloads selection menu provides the parameter
    types and return types for the matching overloaded subprograms. 
  * Various remote protocol improvements, including several
    new packets which can be used to support features such as
    follow-exec-mode, exec catchpoints, syscall catchpoints, etc. 
  * Some minor improvements in the Python API for extending GDB. 
- Added new patches from Fedora:
    gdb-fedora-libncursesw.patch
    gdb-fortran-stride-intel-1of6.patch
    gdb-fortran-stride-intel-2of6.patch
    gdb-fortran-stride-intel-3of6.patch
    gdb-fortran-stride-intel-4of6.patch
    gdb-fortran-stride-intel-5of6.patch
    gdb-fortran-stride-intel-6of6-nokfail.patch
    gdb-fortran-stride-intel-6of6.patch
    gdb-opcodes-clflushopt-test.patch
    gdb-testsuite-readline63-sigint.patch
- Removed obsolete patches:
    gdb-6.3-bz231832-obstack-2gb.patch
    gdb-pahole-python2.patch
    gdb-probes-based-interface-robust-1of2.patch

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=132
2016-02-29 19:38:18 +00:00

136 lines
4.7 KiB
Diff

Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
This is the fix for RH BZ #981154
It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
file was also needed.
gdb/build-id.c was added by:
commit dc294be54c96414035eed7d53dafdea0a6f31a72
Author: Tom Tromey <tromey@redhat.com>
Date: Tue Oct 8 19:56:15 2013 +0000
and had a little thinko there. The variable 'filename' needs to be set to
NULL after it is free'd, otherwise the code below thinks that it is still
valid and doesn't print the necessary warning ("Try: yum install ...").
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp 2016-02-15 23:31:06.327941085 +0100
@@ -0,0 +1,97 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "normal.c"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Get the build-id of the file
+set build_id_debug_file [build_id_debug_filename_get $binfile]
+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
+
+# Run to main
+if { ![runto_main] } {
+ return -1
+}
+
+# We first need to generate a corefile
+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
+set core_supported 0
+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
+ "save a corefile" \
+{
+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
+ pass "save a corefile"
+ global core_supported
+ set core_supported 1
+ }
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
+ unsupported "save a corefile"
+ global core_supported
+ set core_supported 0
+ }
+}
+
+if {!$core_supported} {
+ return -1
+}
+
+# Move the binfile to a temporary name
+remote_exec build "mv $binfile ${binfile}.old"
+
+# Reinitialize GDB and see if we get a yum/dnf warning
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+with_test_prefix "first run:" {
+ gdb_test "set build-id-verbose 1" "" \
+ "set build-id-verbose"
+
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
+ "set debug-file-directory"
+
+ gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install [standard_output_file $build_id_without_debug]\r\n.*" \
+ "test first yum/dnf warning"
+}
+
+# Now we define and create our .build-id
+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
+# Cannot use "file link" (from TCL) because it requires the target file to
+# exist.
+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
+
+# Reinitialize GDB to get the second yum/dnf warning
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+with_test_prefix "second run:" {
+ gdb_test "set build-id-verbose 1" "" \
+ "set build-id-verbose"
+
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
+ "set debug-file-directory"
+
+ gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
+ "test second yum/dnf warning"
+}
+
+# Leaving the link there will cause breakage in the next run.
+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
Index: gdb-7.10.90.20160211/gdb/build-id.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/build-id.c 2016-02-15 23:30:55.389863424 +0100
+++ gdb-7.10.90.20160211/gdb/build-id.c 2016-02-15 23:30:55.778866186 +0100
@@ -589,7 +589,10 @@
do_cleanups (inner);
if (abfd == NULL)
- continue;
+ {
+ filename = NULL;
+ continue;
+ }
if (build_id_verify (abfd, build_id_len, build_id))
break;