OLD | NEW |
1 # This testcase is part of GDB, the GNU debugger. | 1 # This testcase is part of GDB, the GNU debugger. |
2 | 2 |
3 # Copyright 2002-2004, 2007-2012 Free Software Foundation, Inc. | 3 # Copyright 2002-2004, 2007-2012 Free Software Foundation, Inc. |
4 | 4 |
5 # This program is free software; you can redistribute it and/or modify | 5 # This program is free software; you can redistribute it and/or modify |
6 # it under the terms of the GNU General Public License as published by | 6 # it under the terms of the GNU General Public License as published by |
7 # the Free Software Foundation; either version 3 of the License, or | 7 # the Free Software Foundation; either version 3 of the License, or |
8 # (at your option) any later version. | 8 # (at your option) any later version. |
9 # | 9 # |
10 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
18 if $tracelevel { | |
19 strace $tracelevel | |
20 } | |
21 | |
22 # | 18 # |
23 # test running programs | 19 # test running programs |
24 # | 20 # |
25 | 21 |
26 set testfile "store" | 22 set testfile "store" |
27 set srcfile ${testfile}.c | 23 set srcfile ${testfile}.c |
28 set binfile ${objdir}/${subdir}/${testfile} | 24 set binfile ${objdir}/${subdir}/${testfile} |
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { | 25 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
30 untested store.exp | 26 untested store.exp |
31 return -1 | 27 return -1 |
32 } | 28 } |
33 | 29 |
34 if [get_compiler_info ${binfile}] { | 30 if [get_compiler_info] { |
35 return -1; | 31 return -1; |
36 } | 32 } |
37 | 33 |
38 gdb_exit | 34 gdb_exit |
39 gdb_start | 35 gdb_start |
40 gdb_reinitialize_dir $srcdir/$subdir | 36 gdb_reinitialize_dir $srcdir/$subdir |
41 gdb_load ${binfile} | 37 gdb_load ${binfile} |
42 | 38 |
43 # | 39 # |
44 # set it up at a breakpoint so we can play with the variable values | 40 # set it up at a breakpoint so we can play with the variable values |
45 # | 41 # |
46 | 42 |
47 if ![runto_main] then { | 43 if ![runto_main] then { |
48 perror "couldn't run to breakpoint" | 44 perror "couldn't run to breakpoint" |
49 continue | 45 continue |
50 } | 46 } |
51 | 47 |
52 # | 48 # |
53 | 49 |
54 proc check_set { t l r new add } { | 50 proc check_set { t l r new add } { |
| 51 global gdb_prompt |
| 52 |
55 set prefix "var ${t} l" | 53 set prefix "var ${t} l" |
56 gdb_test "tbreak wack_${t}" | 54 gdb_test "tbreak wack_${t}" |
57 gdb_test "continue" "register ${t} l = u, r = v;" \ | 55 |
58 » "continue to wack_${t}" | 56 set test "continue to wack_${t}" |
59 gdb_test "next" "l = add_${t} .l, r.;" \ | 57 gdb_test_multiple "continue" $test { |
60 » "${prefix}; next ${t}" | 58 » -re "register ${t} l = u, r = v;\r\n$gdb_prompt $" { |
| 59 » # See GCC PR debug/53948. |
| 60 » send_gdb "next\n" |
| 61 » exp_continue |
| 62 » } |
| 63 » -re "l = add_${t} .l, r.;\r\n$gdb_prompt $" { |
| 64 » pass $test |
| 65 » } |
| 66 } |
| 67 |
61 gdb_test "print l" " = ${l}" \ | 68 gdb_test "print l" " = ${l}" \ |
62 "${prefix}; print old l, expecting ${l}" | 69 "${prefix}; print old l, expecting ${l}" |
63 gdb_test "print r" " = ${r}" \ | 70 gdb_test "print r" " = ${r}" \ |
64 "${prefix}; print old r, expecting ${r}" | 71 "${prefix}; print old r, expecting ${r}" |
65 gdb_test_no_output "set variable l = 4" \ | 72 gdb_test_no_output "set variable l = 4" \ |
66 "${prefix}; setting l to 4" | 73 "${prefix}; setting l to 4" |
67 gdb_test "print l" " = ${new}" \ | 74 gdb_test "print l" " = ${new}" \ |
68 "${prefix}; print new l, expecting ${new}" | 75 "${prefix}; print new l, expecting ${new}" |
69 gdb_test "next" "return l \\+ r;" \ | 76 gdb_test "next" "return l \\+ r;" \ |
70 "${prefix}; next over add call" | 77 "${prefix}; next over add call" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 check_field 1 | 198 check_field 1 |
192 check_field 2 | 199 check_field 2 |
193 check_field 3 | 200 check_field 3 |
194 check_field 4 | 201 check_field 4 |
195 | 202 |
196 # | 203 # |
197 | 204 |
198 # WANTED: A fairly portable way of convincing the compiler to split a | 205 # WANTED: A fairly portable way of convincing the compiler to split a |
199 # value across memory and registers. | 206 # value across memory and registers. |
200 | 207 |
OLD | NEW |