2018-01-01 05:43:02 +01:00
|
|
|
# Copyright 1998-2018 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02: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
|
2007-08-23 20:14:19 +02:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 03:35:26 +02:00
|
|
|
# (at your option) any later version.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# 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.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 20:14:19 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
|
|
|
|
|
|
|
|
# This file is part of the gdb testsuite
|
|
|
|
#
|
|
|
|
# tests for arithmetic, logical and relational operators
|
|
|
|
# with mixed types
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# test running programs
|
|
|
|
#
|
|
|
|
|
test suite update - gdb.base/[ab]
Convert files gdb.base/[ab]*.exp to use standard_output_file et al.
* a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
break-interp.exp, break-on-linker-gcd-function.exp,
breakpoint-shadow.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-27 20:47:53 +02:00
|
|
|
standard_testfile all-types.c
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2012-06-21 22:46:25 +02:00
|
|
|
if [get_compiler_info] {
|
1999-06-28 18:06:02 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
2016-12-23 17:52:18 +01:00
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
test suite update - gdb.base/[ab]
Convert files gdb.base/[ab]*.exp to use standard_output_file et al.
* a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
break-interp.exp, break-on-linker-gcd-function.exp,
breakpoint-shadow.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-27 20:47:53 +02:00
|
|
|
return -1
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# set it up at a breakpoint so we can play with the variable values
|
|
|
|
#
|
|
|
|
|
|
|
|
if ![runto_main] then {
|
|
|
|
perror "couldn't run to breakpoint"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test "next" "return 0;" "continuing after dummy()"
|
|
|
|
|
2010-05-26 20:05:25 +02:00
|
|
|
gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_signed_char" " = 72" \
|
|
|
|
"print value of v_int+v_signed_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_unsigned_char" " = 73" \
|
|
|
|
"print value of v_int+v_unsigned_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_signed_short" " = 10" \
|
|
|
|
"print value of v_int+v_signed_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_unsigned_short" " = 11" \
|
|
|
|
"print value of v_int+v_unsigned_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_signed_int" " = 13" \
|
|
|
|
"print value of v_int+v_signed_int"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_unsigned_int" " = 14" \
|
|
|
|
"print value of v_int+v_unsigned_int"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_signed_long" " = 16" \
|
|
|
|
"print value of v_int+v_signed_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_unsigned_long" " = 17" \
|
|
|
|
"print value of v_int+v_unsigned_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_float" " = 106.34343.*" \
|
|
|
|
"print value of v_int+v_float"
|
|
|
|
|
|
|
|
gdb_test "print v_int+v_double" " = 206.565.*" \
|
|
|
|
"print value of v_int+v_double"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# test the relational operators with mixed types
|
|
|
|
#
|
|
|
|
|
2010-05-26 20:05:25 +02:00
|
|
|
gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_short" " = $false" \
|
|
|
|
"print value of v_int<=v_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_signed_char" " = 1" \
|
|
|
|
"print value of v_int<=v_signed_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_unsigned_char" " = 1" \
|
|
|
|
"print value of v_int<=v_unsigned_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_signed_short" " = $false" \
|
|
|
|
"print value of v_int<=v_signed_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_unsigned_short" " = $false" \
|
|
|
|
"print value of v_int<=v_unsigned_short"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-05-26 20:05:25 +02:00
|
|
|
gdb_test "print v_int <= v_signed_int" " = $true" \
|
|
|
|
"print value of v_int<=v_signed_int"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2010-05-26 20:05:25 +02:00
|
|
|
gdb_test "print v_int <= v_unsigned_int" " = $true" \
|
|
|
|
"print value of v_int<=v_unsigned_int"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_signed_long" " = $true" \
|
|
|
|
"print value of v_int<=v_signed_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_unsigned_long" " = $true" \
|
|
|
|
"print value of v_int<=v_unsigned_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
|
|
|
|
|
|
|
|
gdb_test "print v_int <= v_double" " = $true" \
|
|
|
|
"print value of v_int<=v_double"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# test the logical operators with mixed types
|
|
|
|
#
|
|
|
|
|
2010-05-26 20:05:25 +02:00
|
|
|
gdb_test_no_output "set variable v_char=0" "set v_char=0"
|
|
|
|
gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
|
|
|
|
gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_signed_char" " = $true" \
|
|
|
|
"print value of v_int&&v_signed_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_unsigned_char" " = $true" \
|
|
|
|
"print value of v_int&&v_unsigned_char"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_signed_short" " = $true" \
|
|
|
|
"print value of v_int&&v_signed_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_unsigned_short" " = $true" \
|
|
|
|
"print value of v_int&&v_unsigned_short"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_signed_int" " = $true" \
|
|
|
|
"print value of v_int&&v_signed_int"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_unsigned_int" " = $true" \
|
|
|
|
"print value of v_int&&v_unsigned_int"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_signed_long" " = $true" \
|
|
|
|
"print value of v_int&&v_signed_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_unsigned_long" " = $false" \
|
|
|
|
"print value of v_int&&v_unsigned_long"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
|
|
|
|
|
|
|
|
gdb_test "print v_int && v_double" " = $false" \
|
|
|
|
"print value of v_int&&v_double"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|