forked from Imagelibrary/binutils-gdb
We recently found a ARM kernel ptrace bug http://lists.infradead.org/pipermail/linux-arm-kernel/2016-May/431962.html Details can be found in the comment in gdb_skip_float_test. We can skip floating point tests if the kernel bug is detected. This patch adds more code in gdb_skip_float_test to detect the broken ptrace on arm-linux. Such detection should be done at the beginning of the test, because it starts a fresh GDB, so change the test cases to invoke gdb_skip_float_test at the beginning of test, and use its return value afterwards. Since gdb_skip_float_test becomes a gdb_caching_proc, so it can't have an argument, this patch also removes argument "msg", which isn't useful. gdb/testsuite: 2016-09-02 Yao Qi <yao.qi@linaro.org> * gdb.arch/arm-neon.exp: Skip it if gdb_skip_float_test returns true. * gdb.base/call-ar-st.exp: Invoke gdb_skip_float_test. * gdb.base/call-rt-st.exp: Likewise. * gdb.base/call-sc.exp: Invoke gdb_skip_float_test and use its return value instead of gdb,skip_float_test. * gdb.base/callfuncs.exp: Invoke gdb_skip_float_test. (do_function_calls): Use its return value instead of gdb,skip_float_test. * gdb.base/finish.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/return.exp: Likewise. * gdb.base/return2.exp: Likewise. * gdb.base/varargs.exp: Likewise. * lib/gdb.exp (gdb_skip_float_test): Change it to gdb_caching_proc. Detect the broken ptrace on arm-linux.
103 lines
3.1 KiB
Plaintext
103 lines
3.1 KiB
Plaintext
# Copyright (C) 1992-2016 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 was written by Jeff Law. (law@cs.utah.edu)
|
|
|
|
if { [prepare_for_testing return.exp "return"] } {
|
|
return -1
|
|
}
|
|
|
|
set skip_float_test [gdb_skip_float_test]
|
|
|
|
proc return_tests { } {
|
|
global gdb_prompt skip_float_test
|
|
|
|
|
|
if { ! [ runto func1 ] } then { return 0 }
|
|
|
|
gdb_test_multiple "return" "simple return" {
|
|
-re "Make .* return now.*y or n. $" {
|
|
send_gdb "y\n"
|
|
exp_continue
|
|
}
|
|
-re "func1 ..;.*$gdb_prompt $" {
|
|
send_gdb "step\n"
|
|
exp_continue
|
|
}
|
|
-re ".*in main after func1.*$gdb_prompt $" {
|
|
pass "simple return"
|
|
}
|
|
}
|
|
|
|
# Set breakpoints in other interesting functions.
|
|
gdb_test "break func2" ".*" "break func2"
|
|
gdb_test "break func3" ".*" "break func3"
|
|
|
|
gdb_test "continue" "return -5;" "continue to return of -5"
|
|
|
|
gdb_test_multiple "return 5" "return value 5" {
|
|
-re "Make .* return now.*y or n. $" {
|
|
send_gdb "y\n"
|
|
exp_continue
|
|
}
|
|
-re ".*tmp2 = func2.*$gdb_prompt $" {
|
|
# pass without comment
|
|
}
|
|
}
|
|
|
|
gdb_test "next" "tmp3 = func3.*" "next over call to func2"
|
|
|
|
gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
|
|
|
|
gdb_test "continue" "return -5.0;" "continue to return of -5.0"
|
|
|
|
# Return of a double does not work for 68hc11 (need struct return
|
|
# in memory).
|
|
setup_xfail "m6811-*-*"
|
|
|
|
gdb_test_multiple "return 5.0" "return value 5.0" {
|
|
-re "Make .* return now.*y or n. $" {
|
|
send_gdb "y\n"
|
|
exp_continue
|
|
}
|
|
-re ".*tmp3 = func3.*$gdb_prompt $" {
|
|
# pass without comment
|
|
}
|
|
}
|
|
|
|
setup_xfail "m6811-*-*"
|
|
gdb_test "next" "printf.*" "next over call to func3"
|
|
|
|
# This test also fails for sparc Solaris 2.3 & 2.4, but passes under 2.5
|
|
# At the time the `next' is issued, the floating point unit for the
|
|
# process is not yet initialized, and the storing of the floating
|
|
# point value to the floating point return register is ignored.
|
|
# Xfail it for current versions that are known to fail. Presumably
|
|
# if some future version does initialize the floating point unit at
|
|
# process start, making this test pass, it will be for a version that
|
|
# is not xfailed.
|
|
|
|
setup_xfail "sparc-*-solaris2.3*" "sparc-*-solaris2.4*" "m6811-*-*"
|
|
if {!$skip_float_test} {
|
|
gdb_test "p tmp3" ".* = 5.*" \
|
|
"correct value returned double test (known problem with sparc solaris)"
|
|
}
|
|
}
|
|
|
|
set prev_timeout $timeout
|
|
set timeout 30
|
|
return_tests
|
|
set timeout $prev_timeout
|