Revert use of autoconf 2.9, it was causing too many regressions.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / return.exp
CommitLineData
782445c7
FF
1# Copyright (C) 1992 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Jeff Law. (law@cs.utah.edu)
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29set testfile "return"
30set srcfile ${srcdir}/$subdir/${testfile}.c
31set binfile ${objdir}/${subdir}/${testfile}
32if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
33 perror "Couldn't compile ${srcfile}"
34 return -1
35}
36
37proc return_tests { } {
38 global prompt
39
40
41 if { ! [ runto func1 ] } then { return 0 }
42 send "return\n"
43 expect {
44 -re "Make .* return now.*y or n. $" {
45 send "y\n"
46 exp_continue
47 }
48 -re "func1 ..;.*$prompt $" {
49 send "step\n"
50 exp_continue
51 }
52 -re ".*in main after func1.*$prompt $" { pass "simple return" }
53 -re "$prompt $" { fail "simple return" }
54 timeout { fail "(timeout) simple return" }
55 }
56
57 # Set breakpoints in other interesting functions.
58 send "break func2\n" ; expect -re ".*$prompt $"
59 send "break func3\n" ; expect -re ".*$prompt $"
60
61 gdb_test "continue" "return -5;"
62 send "return 5\n"
63 expect {
64 -re "Make .* return now.*y or n. $" {
65 send "y\n"
66 exp_continue
67 }
68 -re ".*tmp2 = func2.*$prompt $" { }
69 -re "$prompt $" { fail "did not return (integer test)" }
70 timeout { fail "(timeout) did not return (integer test)" }
71 }
72 gdb_test "next" "tmp3 = func3.*" "next over call to func2"
73
74 gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
75
76 gdb_test "continue" "return -5.0;"
77 send "return 5.0\n"
78 expect {
79 -re "Make .* return now.*y or n. $" {
80 send "y\n"
81 exp_continue
82 }
83 -re ".*tmp3 = func3.*$prompt $" { }
84 -re "$prompt $" { fail "did not return (double test)" }
85 timeout { fail "(timeout) did not return (double test)" }
86 }
87
88 gdb_test "next" "printf.*" "next over call to func3"
89
90 # This test is going to fail on all i*86 systems using an i*87.
91 # When returning a floating point value from a function, all known
92 # compilers do this via a `fldl' instruction, which pushes the floating
93 # value on the i387 stack. This causes two problems:
94 # a) Most i*86 targets do not store (or cannot store, see comment in
95 # in i386v-nat.c:i386_register_u_addr) the floating point registers
96 # to the target.
97 # b) gdb would have to figure out if the `fldl' instruction (or variants
98 # of it) has already been executed. If not, it would have to simulate
99 # a push instruction, as it is not enough to write the register,
100 # the floating point `stack pointer' has to be updated too.
101 # Do not expect this to get fixed anytime soon.
102
103 # This test also fails for sparc Solaris 2.3 & 2.4, but passes under 2.5
104 # At the time the `next' is issued, the floating point unit for the
105 # process is not yet initialized, and the storing of the floating
106 # point value to the floating point return register is ignored.
107 # Xfail it for current versions that are known to fail. Presumably
108 # if some future version does initialize the floating point unit at
109 # process start, making this test pass, it will be for a version that
110 # is not xfailed.
111
112 setup_xfail "i*86-*-*" "sparc-*-solaris2.3*" "sparc-*-solaris2.4*"
113 gdb_test "p tmp3" ".* = 5" "correct value returned double test (known problem with i*86 and sparc solaris"
114}
115
116
117# Start with a fresh gdb.
118
119gdb_exit
120gdb_start
121gdb_reinitialize_dir $srcdir/$subdir
122gdb_load ${binfile}
123
124return_tests
This page took 0.043831 seconds and 4 git commands to generate.