mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
1d506c26d9
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
140 lines
4.0 KiB
Plaintext
140 lines
4.0 KiB
Plaintext
# Copyright 2008-2024 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 .cc
|
|
|
|
set opts {}
|
|
lappend opts debug
|
|
lappend opts c++
|
|
lappend opts additional_flags=-Wno-unused-comparison
|
|
lappend opts additional_flags=-std=c++11
|
|
|
|
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
|
|
return -1
|
|
}
|
|
|
|
############################################
|
|
|
|
if {![runto_main]} {
|
|
return
|
|
}
|
|
|
|
# Test that koenig lookup finds correct function
|
|
gdb_test "p first(c)" "= 11"
|
|
|
|
# Change the number of parameters and position of
|
|
# the qualifying parameter
|
|
gdb_test "p second(0,0,c,0,0)" "= 33"
|
|
|
|
# Test evaluating function under EVAL_SKIP
|
|
gdb_test "p true || second(0,0,c,0,0)" "= true"
|
|
|
|
# Test the name "entry" being used for `variablename@entry' entry values.
|
|
gdb_test "p entry (c)" " = 44"
|
|
|
|
# Test that koenig lookup finds correct function
|
|
# even if it is overloaded
|
|
gdb_test "p first(0,c)" "= 22"
|
|
|
|
# Test that koenig lookup finds correct function
|
|
# when the argument is an expression
|
|
gdb_test "p first(b.c)" "= 11"
|
|
|
|
# test that resolutions can be made across namespaces
|
|
gdb_test "p foo(eo)" "= 1"
|
|
gdb_test "p foo(eo, eo)" "= 2"
|
|
gdb_test "p foo(eo, eo, 1)" "= 3"
|
|
gdb_test "p foo(fo, eo)" "= 4"
|
|
gdb_test "p foo(1 ,fo, eo)" "= 5"
|
|
gdb_test "p foo(go, fo, eo)" "= 6"
|
|
|
|
#test that gdb fails gracefully
|
|
gdb_test "p fake(eo)" "No symbol \"fake\" in current context."
|
|
gdb_test "p foo (fake)" "No symbol \"fake\" in current context."
|
|
|
|
#test that namespaces of base classes are searched
|
|
gdb_test "p foo(io)" "= 7"
|
|
gdb_test "p foo(ix)" "Cannot resolve function foo to any overloaded instance"
|
|
|
|
#test for other types
|
|
gdb_test "p foo(ju)" "= 8"
|
|
gdb_test "p foo(js)" "= 9"
|
|
gdb_test "p foo(je)" "= 10"
|
|
|
|
#test for class members
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p foo(jab)" "= 11"
|
|
|
|
gdb_test "p foo(jap)" "= 12"
|
|
gdb_test "p foo(japp)" "= 13"
|
|
gdb_test "p foo(jca)" "= 14"
|
|
|
|
#test overload resolution
|
|
gdb_test "p foo(ko,1)" "= 15"
|
|
gdb_test "p foo(ko,1.0f)" "= 16"
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p bar(ko,1)" "= -1"
|
|
|
|
#test lookup of objects belonging to nested namespaces
|
|
gdb_test "p foo(labo)" "= 17"
|
|
|
|
#test koenig found function do not compete with qualified
|
|
#names
|
|
gdb_test "p ma.foo('a')" "= 18"
|
|
gdb_test "p foo(ma,'a')" "= 19"
|
|
gdb_test "p M::N::foo(ma,'a')" "= 20"
|
|
gdb_test "p M::FAKE::foo(ma,'a')" "No type \"FAKE\" within class or namespace \"M\"."
|
|
gdb_test "p M::N::fake(ma,'a')" "No symbol \"fake\" in namespace \"M::N\"."
|
|
|
|
gdb_test "p M::bar('a')" "= 21"
|
|
gdb_test "p M::N::bar('a')" "= 22"
|
|
|
|
#test that lookup supports typedef
|
|
gdb_test "p foo(ttoa, 'a')" "= 23"
|
|
|
|
#test that lookup is not thwarted by anonymous types
|
|
gdb_test "p foo (p_union)" \
|
|
"Cannot resolve function foo to any overloaded instance"
|
|
|
|
# test lookup of namespace user-defined operators
|
|
# and overload resolution:
|
|
|
|
# within class
|
|
gdb_test "p q == 5" "= 24"
|
|
gdb_test "p q == 5.0f" "= 25"
|
|
|
|
# within namespace
|
|
gdb_test "p q != 5" "= 27"
|
|
gdb_test "p q != 5.0f" "= 28"
|
|
|
|
# across namespace and class
|
|
gdb_test "p q + 5.0f" "= 26"
|
|
gdb_test "p q + 5" "= 29"
|
|
|
|
# some unary operators for good measure
|
|
# Cannot resolve function operator++ to any overloaded instance
|
|
gdb_test "p ++q" "= 30"
|
|
|
|
# Test that koening lookup does not affect
|
|
# member variable lookup.
|
|
gdb_test "p r.rfoo()" "= 31"
|
|
|
|
# Do the same from inside class R.
|
|
gdb_breakpoint [gdb_get_line_number "marker1"]
|
|
gdb_continue_to_breakpoint "marker1"
|
|
|
|
gdb_test "p rfoo()" "= 31"
|
|
gdb_test "p this->rfoo()" "= 31"
|