Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
02506ff1 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 reverse debugging | |
17 | # with breakpoints in a process record logfile. | |
18 | ||
19 | # This test suitable only for process record-replay | |
20 | if ![target_info exists gdb,use_precord] { | |
21 | return | |
22 | } | |
23 | ||
24 | set testfile "break-reverse" | |
25 | set srcfile ${testfile}.c | |
26 | ||
27 | if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { | |
28 | return -1 | |
29 | } | |
30 | ||
31 | set foo_location [gdb_get_line_number "break in foo" ] | |
32 | set bar_location [gdb_get_line_number "break in bar" ] | |
33 | set main_location [gdb_get_line_number "break in main"] | |
34 | set end_location [gdb_get_line_number "end of main" ] | |
35 | ||
36 | runto main | |
37 | ||
38 | if [target_info exists gdb,use_precord] { | |
39 | # Activate process record/replay | |
bcd2dc50 | 40 | gdb_test_no_output "record" "Turn on process record" |
02506ff1 MS |
41 | } |
42 | ||
43 | gdb_test "break $end_location" \ | |
44 | "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ | |
45 | "BP at end of main" | |
46 | ||
47 | gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" | |
48 | ||
49 | gdb_test "record save break.precsave" \ | |
50 | "Saved core file break.precsave with execution log\." \ | |
51 | "save process recfile" | |
52 | ||
53 | gdb_test "kill" "" "Kill process, prepare to debug log file" \ | |
54 | "Kill the program being debugged\\? \\(y or n\\) " "y" | |
55 | ||
56 | gdb_test "record restore break.precsave" \ | |
57 | "Program terminated with signal .*" \ | |
58 | "reload precord save file" | |
59 | ||
60 | gdb_test "break foo" \ | |
61 | "Breakpoint $decimal at .* line $foo_location\." \ | |
62 | "set breakpoint on foo" | |
63 | ||
64 | gdb_test "break bar" \ | |
65 | "Breakpoint $decimal at .* line $bar_location\." \ | |
66 | "set breakpoint on bar" | |
67 | ||
68 | gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" | |
69 | gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" | |
70 | gdb_test_multiple "continue" "go to end of main forward" { | |
71 | -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" { | |
72 | pass "go to end of main forward" | |
73 | } | |
74 | -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { | |
75 | pass "go to end of main forward" | |
76 | } | |
77 | } | |
78 | ||
bcd2dc50 | 79 | gdb_test_no_output "set exec-direction reverse" "set reverse" |
02506ff1 MS |
80 | |
81 | gdb_continue_to_breakpoint "bar backward" ".*/$srcfile:$bar_location.*" | |
82 | gdb_continue_to_breakpoint "foo backward" ".*/$srcfile:$foo_location.*" | |
83 | ||
84 | gdb_test_multiple "continue" "main backward" { | |
85 | -re ".*Breakpoint $decimal,.*/$srcfile:$main_location.*$gdb_prompt $" { | |
86 | pass "main backward" | |
87 | } | |
88 | -re "No more reverse-execution history.* break in main .*$gdb_prompt $" { | |
89 | pass "main backward" | |
90 | } | |
91 | } | |
92 | ||
bcd2dc50 | 93 | gdb_test_no_output "set exec-direction forward" "set forward" |
02506ff1 MS |
94 | |
95 | gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" | |
96 | gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" | |
97 | ||
98 | gdb_test_multiple "continue" "end of record log" { | |
99 | -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" { | |
100 | pass "end of record log" | |
101 | } | |
102 | -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { | |
103 | pass "end of record log" | |
104 | } | |
105 | } |