2017-01-01 07:50:51 +01:00
|
|
|
# Copyright 2005-2017 Free Software Foundation, Inc.
|
2005-09-20 11:01:14 +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
|
2005-09-20 11:01:14 +02:00
|
|
|
# (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
|
2007-08-23 20:14:19 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-09-20 11:01:14 +02:00
|
|
|
|
|
|
|
# This file is part of the gdb testsuite. It is intended to test that
|
|
|
|
# gdb could correctly handle floating point constant with a suffix.
|
|
|
|
|
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 .c
|
|
|
|
|
2005-09-20 11:01:14 +02:00
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
2016-12-01 21:47:50 +01:00
|
|
|
untested "failed to compile"
|
2005-09-20 11:01:14 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
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
|
|
|
clean_restart ${binfile}
|
2005-09-20 11:01:14 +02:00
|
|
|
|
|
|
|
if ![runto_main] then {
|
|
|
|
perror "couldn't run to breakpoint"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run to the breakpoint at return.
|
|
|
|
gdb_breakpoint [gdb_get_line_number "return"]
|
|
|
|
gdb_continue_to_breakpoint "return"
|
|
|
|
|
|
|
|
# Print the original value of b32, b64 and b128.
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "print b32" ".*1 = 1\.5.*" "the original value of b32 is 1.5"
|
|
|
|
gdb_test "print b64" ".*2 = 2\.25.*" "the original value of b64 is 2.25"
|
|
|
|
gdb_test "print b128" ".*3 = 3\.375.*" "the original value of b128 is 3.375"
|
2005-09-20 11:01:14 +02:00
|
|
|
|
|
|
|
# Test that gdb could correctly recognize float constant expression with a suffix.
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "print b32=-1.5f" ".*4 = -1\.5.*" "try to change b32 to -1.5 with 'print b32=-1.5f'"
|
|
|
|
gdb_test "print b64=-2.25f" ".*5 = -2\.25.*" "try to change b64 to -2.25 with 'print b64=-2.25f'"
|
|
|
|
gdb_test "print b128=-3.375l" ".*6 = -3\.375.*" "try to change b128 to -3.375 with 'print b128=-3.375l'"
|
2005-09-20 11:01:14 +02:00
|
|
|
|
|
|
|
# Test that gdb could handle the above correctly with "set var" command.
|
|
|
|
set test "set variable b32 = 10.5f"
|
|
|
|
gdb_test_multiple "set var b32=10.5f" "$test" {
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
fail "$test (do not recognize 10.5f)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set test "set variable b64 = 20.25f"
|
|
|
|
gdb_test_multiple "set var b64=20.25f" "$test" {
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
fail "$test (do not recognize 20.25f)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set test "set variable b128 = 30.375l"
|
|
|
|
gdb_test_multiple "set var b128=30.375l" "$test" {
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
pass "$test"
|
|
|
|
}
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
fail "$test (do not recognize 30.375l)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "print b32" ".*7 = 10\.5.*" "the value of b32 is changed to 10.5"
|
|
|
|
gdb_test "print b64" ".*8 = 20\.25.*" "the value of b64 is changed to 20.25"
|
|
|
|
gdb_test "print b128" ".*9 = 30\.375.*" "the value of b128 is changed to 30.375"
|
2005-09-20 11:01:14 +02:00
|
|
|
|
|
|
|
# Test that gdb could handle invalid suffix correctly.
|
|
|
|
|
|
|
|
set test "set variable b32 = 100.5a"
|
|
|
|
gdb_test_multiple "set var b32=100.5a" "$test" {
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
fail "$test (do not report error on invalid suffix)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set test "set variable b64 = 200.25x"
|
|
|
|
gdb_test_multiple "set var b64=200.25x" "$test" {
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
fail "$test (do not report error on invalid suffix)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set test "set variable b128 = 300.375fl"
|
|
|
|
gdb_test_multiple "set var b128=300.375fl" "$test" {
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
fail "$test (do not report error on invalid suffix)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set test "set variable b128 = 300.375fff"
|
|
|
|
gdb_test_multiple "set var b128=300.375fff" "$test" {
|
2005-10-31 17:00:46 +01:00
|
|
|
-re "Invalid number.*$gdb_prompt $" {
|
2005-09-20 11:01:14 +02:00
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
fail "$test (do not report error on invalid suffix)"
|
|
|
|
}
|
|
|
|
}
|