OLD | NEW |
1 # Copyright 2008-2012 Free Software Foundation, Inc. | 1 # Copyright 2008-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 # This file is part of the GDB testsuite. It tests 'until' and | 16 # This file is part of the GDB testsuite. It tests 'until' and |
17 # 'advance' in reverse debugging. | 17 # 'advance' in reverse debugging. |
18 | 18 |
19 if ![supports_reverse] { | 19 if ![supports_reverse] { |
20 return | 20 return |
21 } | 21 } |
22 | 22 |
23 set testfile "until-reverse" | 23 standard_testfile .c ur1.c |
24 set srcfile ${testfile}.c | |
25 set srcfile1 ur1.c | |
26 | 24 |
27 if { [prepare_for_testing $testfile.exp $testfile {until-reverse.c ur1.c} ] } { | 25 if { [prepare_for_testing $testfile.exp $testfile \ |
| 26 » [list $srcfile $srcfile2]] } { |
28 return -1 | 27 return -1 |
29 } | 28 } |
30 | 29 |
31 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] | 30 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] |
32 set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] | 31 set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] |
33 set bp_location9 [gdb_get_line_number "set breakpoint 9 here" "$srcfile1"] | 32 set bp_location9 [gdb_get_line_number "set breakpoint 9 here" "$srcfile2"] |
34 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] | 33 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] |
35 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] | 34 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] |
36 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] | 35 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] |
37 | 36 |
38 runto main | 37 runto main |
39 | 38 |
40 if [supports_process_record] { | 39 if [supports_process_record] { |
41 # Activate process record/replay | 40 # Activate process record/replay |
42 gdb_test_no_output "record" "Turn on process record" | 41 gdb_test_no_output "record" "Turn on process record" |
43 } | 42 } |
(...skipping 20 matching lines...) Expand all Loading... |
64 | 63 |
65 # Finish out to main scope | 64 # Finish out to main scope |
66 # | 65 # |
67 gdb_test "finish" \ | 66 gdb_test "finish" \ |
68 " in main .*$srcfile:$bp_location1.*" \ | 67 " in main .*$srcfile:$bp_location1.*" \ |
69 "finish to main" | 68 "finish to main" |
70 | 69 |
71 # Advance to a function called by main (marker2) | 70 # Advance to a function called by main (marker2) |
72 # | 71 # |
73 gdb_test "advance marker2" \ | 72 gdb_test "advance marker2" \ |
74 "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | 73 "marker2 .a=43.*$srcfile2:$bp_location9.*" \ |
75 "advance to marker2" | 74 "advance to marker2" |
76 | 75 |
77 # Now issue an until with another function, not called by the current | 76 # Now issue an until with another function, not called by the current |
78 # frame, as argument. This should not work, i.e. the program should | 77 # frame, as argument. This should not work, i.e. the program should |
79 # stop at main, the caller, where we put the 'guard' breakpoint. | 78 # stop at main, the caller, where we put the 'guard' breakpoint. |
80 # | 79 # |
81 set test_msg "until func, not called by current frame" | 80 set test_msg "until func, not called by current frame" |
82 gdb_test_multiple "until marker3" "$test_msg" { | 81 gdb_test_multiple "until marker3" "$test_msg" { |
83 -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { | 82 -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { |
84 pass "$test_msg" | 83 pass "$test_msg" |
(...skipping 10 matching lines...) Expand all Loading... |
95 # Set reverse execution direction | 94 # Set reverse execution direction |
96 | 95 |
97 gdb_test_no_output "set exec-dir reverse" "set reverse execution" | 96 gdb_test_no_output "set exec-dir reverse" "set reverse execution" |
98 | 97 |
99 # | 98 # |
100 # We should now be at main, after the return from marker2. | 99 # We should now be at main, after the return from marker2. |
101 # "Advance" backward into marker2. | 100 # "Advance" backward into marker2. |
102 # | 101 # |
103 | 102 |
104 gdb_test "advance marker2" \ | 103 gdb_test "advance marker2" \ |
105 "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | 104 "marker2 .a=43.*$srcfile2:$bp_location9.*" \ |
106 "reverse-advance to marker2" | 105 "reverse-advance to marker2" |
107 | 106 |
108 # Finish out to main scope (backward) | 107 # Finish out to main scope (backward) |
109 | 108 |
110 gdb_test "finish" \ | 109 gdb_test "finish" \ |
111 " in main .*$srcfile:$bp_location20.*" \ | 110 " in main .*$srcfile:$bp_location20.*" \ |
112 "reverse-finish from marker2" | 111 "reverse-finish from marker2" |
113 | 112 |
114 # Advance backward to last line of factorial (outer invocation) | 113 # Advance backward to last line of factorial (outer invocation) |
115 | 114 |
116 gdb_test "advance $bp_location19" \ | 115 gdb_test "advance $bp_location19" \ |
117 "factorial .value=720.*${srcfile}:$bp_location19.*" \ | 116 "factorial .value=720.*${srcfile}:$bp_location19.*" \ |
118 "reverse-advance to final return of factorial" | 117 "reverse-advance to final return of factorial" |
119 | 118 |
120 # Now do "until" across the recursive calls, | 119 # Now do "until" across the recursive calls, |
121 # ending up in the same frame where we are now. | 120 # ending up in the same frame where we are now. |
122 | 121 |
123 gdb_test "until $bp_location7" \ | 122 gdb_test "until $bp_location7" \ |
124 "factorial .value=6..*$srcfile:$bp_location7.*" \ | 123 "factorial .value=6..*$srcfile:$bp_location7.*" \ |
125 "reverse-until to entry of factorial" | 124 "reverse-until to entry of factorial" |
OLD | NEW |