OLD | NEW |
1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 proc do_test {type} { | 16 proc do_test {type} { |
17 set typenospace [string map {{ } -} $type] | 17 set typenospace [string map {{ } -} $type] |
18 | 18 |
19 global pf_prefix | 19 with_test_prefix "$typenospace" { |
20 set old_prefix $pf_prefix | 20 » if {[runto "func"]} { |
21 lappend pf_prefix "$typenospace:" | 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'. |
22 | 25 |
23 if {[runto "func"]} { | 26 » gdb_test "return -1" \ |
24 » # Verify that we do not crash when using "return" from a function with | 27 » » "Return value type not available for selected stack frame\\.\r\n
Please use an explicit cast of the value to return\\." \ |
25 » # no debugging info. Such function has no `struct symbol'. It may | 28 » » "return from function with no debug info without a cast" |
26 » # still have an associated `struct minimal_symbol'. | |
27 | 29 |
28 » gdb_test "return -1" \ | 30 » # Cast of the result to the proper width must be done explicitely. |
29 » » "Return value type not available for selected stack frame\\.\r\
nPlease use an explicit cast of the value to return\\." \ | 31 » gdb_test "return ($type) -1" "#0 .* main \\(.*" \ |
30 » » "return from function with no debug info without a cast" | 32 » » "return from function with no debug info with a cast" \ |
| 33 » » "Make selected stack frame return now\\? \\(y or n\\) " "y" |
31 | 34 |
32 » # Cast of the result to the proper width must be done explicitely. | 35 » gdb_test "advance marker" "marker \\(.*" \ |
33 » gdb_test "return ($type) -1" "#0 .* main \\(.*"»» » \ | 36 » » "advance to marker" |
34 » » "return from function with no debug info with a cast"» \ | |
35 » » "Make selected stack frame return now\\? \\(y or n\\) " "y" | |
36 | 37 |
37 » gdb_test "advance marker" "marker \\(.*" \ | 38 » # And if it returned the full width of the result. |
38 » » "advance to marker" | 39 » gdb_test "print /d t" " = -1" "full width of the returned result" |
39 | 40 » } |
40 » # And if it returned the full width of the result. | |
41 » gdb_test "print /d t" " = -1" "full width of the returned result" | |
42 } | 41 } |
43 | |
44 set pf_prefix $old_prefix | |
45 } | 42 } |
46 | 43 |
47 foreach type {{signed char} {short} {int} {long} {long long}} { | 44 foreach type {{signed char} {short} {int} {long} {long long} {float} {double}} { |
48 set typeesc [string map {{ } {\ }} $type] | 45 set typeesc [string map {{ } {\ }} $type] |
49 set typenospace [string map {{ } -} $type] | 46 set typenospace [string map {{ } -} $type] |
50 | 47 |
51 set testfile "return-nodebug" | 48 set testfile "return-nodebug" |
52 set srcfile ${testfile}.c | 49 set srcfile ${testfile}.c |
53 set srcfile1 ${testfile}1.c | 50 set srcfile1 ${testfile}1.c |
54 set binfile ${objdir}/${subdir}/${testfile}-${typenospace} | 51 set binfile ${objdir}/${subdir}/${testfile}-${typenospace} |
55 | 52 |
56 set additional_flags "additional_flags=-DTYPE=$typeesc" | 53 set additional_flags "additional_flags=-DTYPE=$typeesc" |
57 | 54 |
(...skipping 10 matching lines...) Expand all Loading... |
68 continue | 65 continue |
69 } | 66 } |
70 | 67 |
71 gdb_exit | 68 gdb_exit |
72 gdb_start | 69 gdb_start |
73 gdb_reinitialize_dir $srcdir/$subdir | 70 gdb_reinitialize_dir $srcdir/$subdir |
74 gdb_load ${binfile} | 71 gdb_load ${binfile} |
75 | 72 |
76 do_test $type | 73 do_test $type |
77 } | 74 } |
OLD | NEW |