]>
Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright 2008-2012 Free Software Foundation, Inc. |
28d41a99 MS |
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 | ||
16 | # This file is part of the GDB testsuite. It tests 'until' and | |
17 | # 'advance' in reverse debugging. | |
18 | ||
d3895d7d | 19 | if ![supports_reverse] { |
28d41a99 MS |
20 | return |
21 | } | |
22 | ||
23 | set testfile "until-reverse" | |
24 | set srcfile ${testfile}.c | |
25 | set srcfile1 ur1.c | |
26 | ||
27 | if { [prepare_for_testing $testfile.exp $testfile {until-reverse.c ur1.c} ] } { | |
28 | return -1 | |
29 | } | |
30 | ||
31 | set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] | |
32 | set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] | |
33 | set bp_location9 [gdb_get_line_number "set breakpoint 9 here" "$srcfile1"] | |
34 | set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] | |
35 | set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] | |
36 | set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] | |
37 | ||
38 | runto main | |
39 | ||
d3895d7d | 40 | if [supports_process_record] { |
28d41a99 | 41 | # Activate process record/replay |
bcd2dc50 | 42 | gdb_test_no_output "record" "Turn on process record" |
28d41a99 MS |
43 | } |
44 | ||
45 | # Verify that plain vanilla "until <location>" works. | |
46 | # | |
47 | gdb_test "until $bp_location1" \ | |
48 | "main .* at .*:$bp_location1.*" \ | |
49 | "until line number" | |
50 | ||
51 | # Advance up to factorial, outer invocation | |
52 | # | |
53 | gdb_test "advance factorial" \ | |
54 | "factorial .value=6..*$srcfile:$bp_location7.*" \ | |
55 | "advance to factorial" | |
56 | ||
57 | # At this point, 'until' should continue the inferior up to when all the | |
58 | # inner invocations of factorial() are completed and we are back at this | |
59 | # frame. | |
60 | # | |
61 | gdb_test "until $bp_location19" \ | |
62 | "factorial .value=720.*${srcfile}:$bp_location19.*" \ | |
63 | "until factorial, recursive function" | |
64 | ||
65 | # Finish out to main scope | |
66 | # | |
67 | gdb_test "finish" \ | |
68 | " in main .*$srcfile:$bp_location1.*" \ | |
69 | "finish to main" | |
70 | ||
71 | # Advance to a function called by main (marker2) | |
72 | # | |
73 | gdb_test "advance marker2" \ | |
74 | "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | |
75 | "advance to marker2" | |
76 | ||
77 | # 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 | |
79 | # stop at main, the caller, where we put the 'guard' breakpoint. | |
80 | # | |
81 | set test_msg "until func, not called by current frame" | |
82 | gdb_test_multiple "until marker3" "$test_msg" { | |
83 | -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { | |
84 | pass "$test_msg" | |
85 | } | |
86 | -re "main .*at .*${srcfile}:$bp_location21.*$gdb_prompt $" { | |
87 | pass "$test_msg" | |
88 | } | |
89 | } | |
90 | ||
91 | ### | |
92 | ### | |
93 | ### | |
94 | ||
95 | # Set reverse execution direction | |
28d41a99 | 96 | |
bcd2dc50 | 97 | gdb_test_no_output "set exec-dir reverse" "set reverse execution" |
28d41a99 MS |
98 | |
99 | # | |
100 | # We should now be at main, after the return from marker2. | |
101 | # "Advance" backward into marker2. | |
102 | # | |
103 | ||
104 | gdb_test "advance marker2" \ | |
105 | "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | |
106 | "reverse-advance to marker2" | |
107 | ||
108 | # Finish out to main scope (backward) | |
109 | ||
110 | gdb_test "finish" \ | |
111 | " in main .*$srcfile:$bp_location20.*" \ | |
112 | "reverse-finish from marker2" | |
113 | ||
114 | # Advance backward to last line of factorial (outer invocation) | |
115 | ||
116 | gdb_test "advance $bp_location19" \ | |
117 | "factorial .value=720.*${srcfile}:$bp_location19.*" \ | |
118 | "reverse-advance to final return of factorial" | |
119 | ||
120 | # Now do "until" across the recursive calls, | |
121 | # ending up in the same frame where we are now. | |
122 | ||
123 | gdb_test "until $bp_location7" \ | |
124 | "factorial .value=6..*$srcfile:$bp_location7.*" \ | |
125 | "reverse-until to entry of factorial" |