mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-24 12:35:55 +08:00
cdd4206647
Many test cases had a few lines in the beginning that look like: if { condition } { continue } Where conditions varied, but were mostly in the form of ![runto_main] or [skip_*_tests], making it quite clear that this code block was supposed to finish the test if it entered the code block. This generates TCL errors, as most of these tests are not inside loops. All cases on which this was an obvious mistake are changed in this patch.
122 lines
4.5 KiB
Plaintext
122 lines
4.5 KiB
Plaintext
# Copyright 2016-2022 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. It is intended to test that
|
|
# gdb could correctly handle floating point constant with a suffix.
|
|
|
|
standard_testfile .c
|
|
|
|
proc do_compile { {opts {}} } {
|
|
global srcdir subdir srcfile binfile
|
|
set ccopts {debug quiet}
|
|
foreach opt $opts {lappend ccopts "additional_flags=$opt"}
|
|
gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" executable $ccopts
|
|
}
|
|
|
|
if { [do_compile] != "" && [do_compile {-mfloat128}] != "" } {
|
|
untested "compiler can't handle _FloatN/_FloatNx types?"
|
|
return -1
|
|
}
|
|
|
|
clean_restart ${binfile}
|
|
|
|
if ![runto_main] then {
|
|
perror "couldn't run to breakpoint"
|
|
return
|
|
}
|
|
|
|
# Run to the breakpoint at return.
|
|
gdb_breakpoint [gdb_get_line_number "return"]
|
|
gdb_continue_to_breakpoint "return"
|
|
|
|
# Print the original values of f32, f64, f128, f32x, f64x.
|
|
gdb_test "print f32" ".* = 1\\.5.*" "the original value of f32 is 1.5"
|
|
gdb_test "print f64" ".* = 2\\.25.*" "the original value of f64 is 2.25"
|
|
gdb_test "print f128" ".* = 3\\.375.*" "the original value of f128 is 3.375"
|
|
gdb_test "print f32x" ".* = 10\\.5.*" "the original value of f32x is 10.5"
|
|
gdb_test "print f64x" ".* = 20\\.25.*" "the original value of f64x is 20.25"
|
|
|
|
# Test that gdb could correctly recognize float constant expression with a suffix.
|
|
# FIXME: gdb does not yet recognize the suffix for _FloatN/_FloatNx types.
|
|
gdb_test "print f32=-1.5" ".* = -1\\.5.*" "try to change f32 to -1.5 with 'print f32=-1.5'"
|
|
gdb_test "print f64=-2.25" ".* = -2\\.25.*" "try to change f64 to -2.25 with 'print f64=-2.25'"
|
|
gdb_test "print f128=-3.375" ".* = -3\\.375.*" "try to change f128 to -3.375 with 'print f128=-3.375'"
|
|
gdb_test "print f32x=-10.5" ".* = -10\\.5.*" "try to change f32x to -10.5 with 'print f32=-1.5x'"
|
|
gdb_test "print f64x=-20.25" ".* = -20\\.25.*" "try to change f64x to -20.25 with 'print f64=-2.25x'"
|
|
|
|
# Test that gdb could handle the above correctly with "set var" command.
|
|
set test "set variable f32 = 10.5"
|
|
gdb_test_multiple "set var f32=10.5" "$test" {
|
|
-re "$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
-re "Invalid number.*$gdb_prompt $" {
|
|
fail "$test (do not recognize 10.5)"
|
|
}
|
|
}
|
|
|
|
set test "set variable f64 = 20.25"
|
|
gdb_test_multiple "set var f64=20.25" "$test" {
|
|
-re "$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
-re "Invalid number.*$gdb_prompt $" {
|
|
fail "$test (do not recognize 20.25)"
|
|
}
|
|
}
|
|
|
|
set test "set variable f128 = 30.375"
|
|
gdb_test_multiple "set var f128=30.375" "$test" {
|
|
-re "$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
-re "Invalid number.*$gdb_prompt $" {
|
|
fail "$test (do not recognize 30.375)"
|
|
}
|
|
}
|
|
|
|
set test "set variable f32x = 100.5"
|
|
gdb_test_multiple "set var f32x=100.5" "$test" {
|
|
-re "$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
-re "Invalid number.*$gdb_prompt $" {
|
|
fail "$test (do not recognize 100.5)"
|
|
}
|
|
}
|
|
|
|
set test "set variable f64x = 200.25"
|
|
gdb_test_multiple "set var f64x=200.25" "$test" {
|
|
-re "$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
-re "Invalid number.*$gdb_prompt $" {
|
|
fail "$test (do not recognize 200.25)"
|
|
}
|
|
}
|
|
|
|
gdb_test "print f32" ".* = 10\\.5.*" "the value of f32 is changed to 10.5"
|
|
gdb_test "print f64" ".* = 20\\.25.*" "the value of f64 is changed to 20.25"
|
|
gdb_test "print f128" ".* = 30\\.375.*" "the value of f128 is changed to 30.375"
|
|
gdb_test "print f32x" ".* = 100\\.5.*" "the value of f32x is changed to 100.5"
|
|
gdb_test "print f64x" ".* = 200\\.25.*" "the value of f64x is changed to 200.25"
|
|
|
|
# Print the original values of c32, c64, c128, c32x, c64x.
|
|
gdb_test "print c32" ".* = 1\\.5 \\+ 1i.*" "the original value of c32 is 1.5 + 1i"
|
|
gdb_test "print c64" ".* = 2\\.25 \\+ 1i.*" "the original value of c64 is 2.25 + 1i"
|
|
gdb_test "print c128" ".* = 3\\.375 \\+ 1i.*" "the original value of c128 is 3.375 + 1i"
|
|
gdb_test "print c32x" ".* = 10\\.5 \\+ 1i.*" "the original value of c32x is 10.5 + 1i"
|
|
gdb_test "print c64x" ".* = 20\\.25 \\+ 1i.*" "the original value of c64x is 20.25 + 1i"
|