2007-01-09 17:59:20 +00:00
|
|
|
# Copyright 1998, 1999, 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
|
1999-08-02 23:48:37 +00:00
|
|
|
|
|
|
|
# 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 2 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, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
# This file is part of the gdb testsuite
|
|
|
|
# file written by Elena Zannoni (ezannoni@cygnus.com)
|
2004-01-08 02:13:57 +00:00
|
|
|
# rewritten by Michael Chastain (mec.gnu@mindspring.com)
|
1999-08-02 23:48:37 +00:00
|
|
|
#
|
|
|
|
# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
|
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
# Call to template instantiations.
|
1999-08-02 23:48:37 +00:00
|
|
|
|
|
|
|
if $tracelevel then {
|
2004-01-08 02:13:57 +00:00
|
|
|
strace $tracelevel
|
1999-08-02 23:48:37 +00:00
|
|
|
}
|
|
|
|
|
2001-03-08 21:09:23 +00:00
|
|
|
if { [skip_cplus_tests] } { continue }
|
2000-06-06 00:38:10 +00:00
|
|
|
|
1999-08-02 23:48:37 +00:00
|
|
|
set testfile "cttiadd"
|
2004-08-15 09:17:30 +00:00
|
|
|
set srcfile "${testfile}.cc"
|
|
|
|
set srcfile1 "${testfile}1.cc"
|
|
|
|
set srcfile2 "${testfile}2.cc"
|
|
|
|
set srcfile3 "${testfile}3.cc"
|
|
|
|
set objfile "${testfile}.o"
|
|
|
|
set objfile1 "${testfile}1.o"
|
|
|
|
set objfile2 "${testfile}2.o"
|
|
|
|
set objfile3 "${testfile}3.o"
|
2004-01-08 02:13:57 +00:00
|
|
|
set binfile "${objdir}/${subdir}/${testfile}"
|
|
|
|
|
2004-08-15 09:17:30 +00:00
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested ctti.exp
|
|
|
|
return -1
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-08-15 09:17:30 +00:00
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested ctti.exp
|
|
|
|
return -1
|
1999-08-02 23:48:37 +00:00
|
|
|
}
|
|
|
|
|
2004-08-15 09:17:30 +00:00
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested ctti.exp
|
|
|
|
return -1
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-08-15 09:17:30 +00:00
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile3" "$objdir/$subdir/$objfile3" object {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested ctti.exp
|
|
|
|
return -1
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-08-15 09:17:30 +00:00
|
|
|
if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2 $objdir/$subdir/$objfile3" "${binfile}" executable {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested ctti.exp
|
|
|
|
return -1
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
if [get_compiler_info ${binfile} "c++"] {
|
|
|
|
return -1;
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
gdb_load ${binfile}
|
|
|
|
|
|
|
|
if ![runto_main] then {
|
|
|
|
perror "couldn't run to breakpoint"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2004-01-08 06:35:15 +00:00
|
|
|
gdb_breakpoint [gdb_get_line_number "marker add1"]
|
|
|
|
gdb_continue_to_breakpoint "marker add1"
|
2004-01-08 02:13:57 +00:00
|
|
|
|
2004-02-29 22:29:15 +00:00
|
|
|
gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
|
2004-01-08 02:13:57 +00:00
|
|
|
gdb_test "print f" "\\$\[0-9\]+ = 9"
|
|
|
|
gdb_test "print i" "\\$\[0-9\]+ = 4"
|
|
|
|
|
2004-01-08 06:35:15 +00:00
|
|
|
# TODO: this needs more work before actually deploying it.
|
|
|
|
# So bail out here.
|
|
|
|
|
|
|
|
if { [ test_compiler_info gcc-*] } then { continue }
|
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add<int>(2,2)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
# 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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add<float>(2.25,2.25)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-02-29 22:29:15 +00:00
|
|
|
gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
|
2004-01-08 02:13:57 +00:00
|
|
|
-re "\\$\[0-9\]+ = -126 .*\r\n$gdb_prompt $" {
|
2004-02-29 22:29:15 +00:00
|
|
|
pass "print add<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
2004-02-29 22:29:15 +00:00
|
|
|
-re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
2004-01-08 02:13:57 +00:00
|
|
|
# TODO: kfail or xfail this
|
2004-02-29 22:29:15 +00:00
|
|
|
fail "print add<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add2<int>(2,2)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add2<float>(2.25,2.25)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-02-29 22:29:15 +00:00
|
|
|
gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
|
2004-01-08 02:13:57 +00:00
|
|
|
-re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
|
2004-02-29 22:29:15 +00:00
|
|
|
pass "print add2<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
2004-02-29 22:29:15 +00:00
|
|
|
-re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
2004-01-08 02:13:57 +00:00
|
|
|
# TODO: kfail or xfail this
|
2004-02-29 22:29:15 +00:00
|
|
|
fail "print add2<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add3<int>(2,2)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add3<float>(2.25,2.25)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-02-29 22:29:15 +00:00
|
|
|
gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
|
2004-01-08 02:13:57 +00:00
|
|
|
-re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
|
2004-02-29 22:29:15 +00:00
|
|
|
pass "print add3<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
2004-02-29 22:29:15 +00:00
|
|
|
-re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
2004-01-08 02:13:57 +00:00
|
|
|
# TODO: kfail or xfail this
|
2004-02-29 22:29:15 +00:00
|
|
|
fail "print add3<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add4<int>(2,2)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-01-08 02:13:57 +00:00
|
|
|
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 $" {
|
|
|
|
# TODO: kfail or xfail this
|
|
|
|
fail "print add4<float>(2.25,2.25)"
|
|
|
|
}
|
|
|
|
}
|
1999-08-02 23:48:37 +00:00
|
|
|
|
2004-02-29 22:29:15 +00:00
|
|
|
gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
|
2004-01-08 02:13:57 +00:00
|
|
|
-re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
|
2004-02-29 22:29:15 +00:00
|
|
|
pass "print add4<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
2004-02-29 22:29:15 +00:00
|
|
|
-re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
|
2004-01-08 02:13:57 +00:00
|
|
|
# TODO: kfail or xfail this
|
2004-02-29 22:29:15 +00:00
|
|
|
fail "print add4<unsigned char>('A','A')"
|
2004-01-08 02:13:57 +00:00
|
|
|
}
|
|
|
|
}
|