]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/return-nodebug.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / return-nodebug.exp
CommitLineData
32d0add0 1# Copyright (C) 2009-2015 Free Software Foundation, Inc.
61ff14c6
JK
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 3 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, see <http://www.gnu.org/licenses/>.
15
16proc do_test {type} {
17 set typenospace [string map {{ } -} $type]
18
78afebb4
PA
19 with_test_prefix "$typenospace" {
20 if {[runto "func"]} {
21 # Verify that we do not crash when using "return" from a
22 # function with no debugging info. Such function has no
23 # `struct symbol'. It may still have an associated
24 # `struct minimal_symbol'.
25
26 gdb_test "return -1" \
27 "Return value type not available for selected stack frame\\.\r\nPlease use an explicit cast of the value to return\\." \
28 "return from function with no debug info without a cast"
29
30 # Cast of the result to the proper width must be done explicitely.
31 gdb_test "return ($type) -1" "#0 .* main \\(.*" \
32 "return from function with no debug info with a cast" \
33 "Make selected stack frame return now\\? \\(y or n\\) " "y"
34
35 gdb_test "advance marker" "marker \\(.*" \
36 "advance to marker"
37
38 # And if it returned the full width of the result.
39 gdb_test "print /d t" " = -1" "full width of the returned result"
40 }
61ff14c6 41 }
61ff14c6
JK
42}
43
6a3a010b 44foreach type {{signed char} {short} {int} {long} {long long} {float} {double}} {
61ff14c6
JK
45 set typeesc [string map {{ } {\ }} $type]
46 set typenospace [string map {{ } -} $type]
47
822bd149 48 standard_testfile .c return-nodebug1.c
51272cf2
PA
49
50 set additional_flags "additional_flags=-DTYPE=$typeesc"
51
822bd149
TT
52 if {[prepare_for_testing_full $testfile.exp \
53 [list ${testfile}-${typenospace} debug \
54 $srcfile [list debug $additional_flags] \
55 $srcfile2 [list $additional_flags]]]} {
51272cf2
PA
56 continue
57 }
58
51272cf2 59 do_test $type
61ff14c6 60}