From: Fedora GDB patches Date: Fri, 27 Oct 2017 21:07:50 +0200 Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch FileName: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch Comments from Sergio Durigan Junior: The "proper" fix for this whole problem would be to backport the "ambiguous linespec" patch series. However, it is really not recommended to do that for RHEL GDB, because the patch series is too big and could introduce unwanted regressions. Instead, what we chose to do was to replace the gdb_assert call by a warning (which allows the user to continue the debugging session), and tell the user that, although more than one location was found for his/her breakpoint, only one will be used. Index: gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc 2016-10-20 21:06:31.849854180 +0200 @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 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 . */ + +int +main (int argc, char *argv[]) +{ + return 0; +} Index: gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc 2016-10-20 21:06:31.850854188 +0200 @@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 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 . */ + +class C + { + public: + C () {} + C (int x) {} + }; + +C a; +C b (1); Index: gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.12/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp 2016-10-20 21:09:33.408270526 +0200 @@ -0,0 +1,51 @@ +# Copyright 2015 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 . + +if { [skip_cplus_tests] } { continue } +if { [skip_shlib_tests] } { continue } +if { [is_remote target] } { continue } +if { [target_info exists use_gdb_stub] } { continue } + +set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main +set srcfile $testfile.cc +set executable $testfile +set binfile [standard_output_file $executable] + +set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set +set libsrcfile $libtestfile.cc +set sofile [standard_output_file lib$libtestfile.so] + +# Create and source the file that provides information about the compiler +# used to compile the test case. +if [get_compiler_info "c++"] { + return -1 +} + +if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != "" + || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} { + untested $libtestfile.exp + return -1 +} + +clean_restart $executable + +gdb_test_no_output "set breakpoint pending on" +# gdb_breakpoint would print a failure because of some warning messages +gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending." + +#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*" +gdb_test "run" + +gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"