forked from Imagelibrary/binutils-gdb
This patch removes many TODOs from the gdb.cp tests. Going through the patch: * bs15503.exp - these have been commented out forever and rely on libstdc++ debuginfo. It's better to just remove these. * classes.exp - the test is wrong, I think, according to the C++ ABI that gdb understands; and the test can be fixed and comments removed with a simple change to the code. * ctti.exp - there's no need to bail out any more, as the test works. * exception.exp - the code relying on the line numbers can't work, because gdb never prints that message anyway. Reviewed-By: Bruno Larsen <blarsen@redhat.com>
152 lines
4.9 KiB
Plaintext
152 lines
4.9 KiB
Plaintext
# Copyright 1998-2023 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/>.
|
|
|
|
# This file is part of the gdb testsuite
|
|
# file written by Elena Zannoni (ezannoni@cygnus.com)
|
|
# rewritten by Michael Chastain (mec.gnu@mindspring.com)
|
|
#
|
|
# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
|
|
|
|
# Call to template instantiations.
|
|
|
|
require allow_cplus_tests
|
|
|
|
standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc
|
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile \
|
|
[list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} {
|
|
return -1
|
|
}
|
|
|
|
if {![runto_main]} {
|
|
return
|
|
}
|
|
|
|
gdb_breakpoint [gdb_get_line_number "marker add1"]
|
|
gdb_continue_to_breakpoint "marker add1"
|
|
|
|
gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
|
|
gdb_test "print f" "\\$\[0-9\]+ = 9"
|
|
gdb_test "print i" "\\$\[0-9\]+ = 4"
|
|
|
|
gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
|
|
-re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
|
|
pass "print add<int>(2,2)"
|
|
}
|
|
-re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add<int>(2,2)"
|
|
}
|
|
}
|
|
|
|
# Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
|
|
gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
|
|
-re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
|
|
pass "print add<float>(2.25,2.25)"
|
|
}
|
|
-re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add<float>(2.25,2.25)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
|
|
-re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" {
|
|
pass "print add<unsigned char>('A','A')"
|
|
}
|
|
-re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add<unsigned char>('A','A')"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
|
|
-re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
|
|
pass "print add2<int>(2,2)"
|
|
}
|
|
-re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add2<int>(2,2)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
|
|
-re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
|
|
pass "print add2<float>(2.25,2.25)"
|
|
}
|
|
-re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add2<float>(2.25,2.25)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
|
|
-re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
|
|
pass "print add2<unsigned char>('A','A')"
|
|
}
|
|
-re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add2<unsigned char>('A','A')"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
|
|
-re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
|
|
pass "print add3<int>(2,2)"
|
|
}
|
|
-re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add3<int>(2,2)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
|
|
-re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
|
|
pass "print add3<float>(2.25,2.25)"
|
|
}
|
|
-re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add3<float>(2.25,2.25)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
|
|
-re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
|
|
pass "print add3<unsigned char>('A','A')"
|
|
}
|
|
-re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add3<unsigned char>('A','A')"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
|
|
-re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
|
|
pass "print add4<int>(2,2)"
|
|
}
|
|
-re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add4<int>(2,2)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
|
|
-re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
|
|
pass "print add4<float>(2.25,2.25)"
|
|
}
|
|
-re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add4<float>(2.25,2.25)"
|
|
}
|
|
}
|
|
|
|
gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
|
|
-re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
|
|
pass "print add4<unsigned char>('A','A')"
|
|
}
|
|
-re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
|
fail "print add4<unsigned char>('A','A')"
|
|
}
|
|
}
|