| OLD | NEW |
| 1 # Copyright 2009-2012 Free Software Foundation, Inc. | 1 # Copyright 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 # Based on a file written by Fred Fish. (fnf@cygnus.com) | 16 # Based on a file written by Fred Fish. (fnf@cygnus.com) |
| 17 # This file is part of the GDB testsuite. It tests precord dumpfile | 17 # This file is part of the GDB testsuite. It tests precord dumpfile |
| 18 # debugging with watchpoints. | 18 # debugging with watchpoints. |
| 19 | 19 |
| 20 # This test suitable only for process record-replay | 20 # This test suitable only for process record-replay |
| 21 if ![supports_process_record] { | 21 if ![supports_process_record] { |
| 22 return | 22 return |
| 23 } | 23 } |
| 24 | 24 |
| 25 set testfile "watch-reverse" | 25 standard_testfile watch-reverse.c |
| 26 set srcfile ${testfile}.c | 26 set precsave [standard_output_file watch.precsave] |
| 27 set binfile ${objdir}/${subdir}/${testfile} | |
| 28 | 27 |
| 29 if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { | 28 if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { |
| 30 return -1 | 29 return -1 |
| 31 } | 30 } |
| 32 | 31 |
| 33 runto main | 32 runto main |
| 34 | 33 |
| 35 if [supports_process_record] { | 34 if [supports_process_record] { |
| 36 # Activate process record/replay | 35 # Activate process record/replay |
| 37 gdb_test_no_output "record" "Turn on process record" | 36 gdb_test_no_output "record" "Turn on process record" |
| 38 } | 37 } |
| 39 | 38 |
| 40 set end_location [gdb_get_line_number "end of main" ] | 39 set end_location [gdb_get_line_number "end of main" ] |
| 41 gdb_test "break $end_location" \ | 40 gdb_test "break $end_location" \ |
| 42 "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ | 41 "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ |
| 43 "BP at end of main" | 42 "BP at end of main" |
| 44 | 43 |
| 45 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" | 44 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" |
| 46 | 45 |
| 47 gdb_test "record save watch.precsave" \ | 46 gdb_test "record save $precsave" \ |
| 48 "Saved core file watch.precsave with execution log\." \ | 47 "Saved core file $precsave with execution log\." \ |
| 49 "save process recfile" | 48 "save process recfile" |
| 50 | 49 |
| 51 gdb_test "kill" "" "Kill process, prepare to debug log file" \ | 50 gdb_test "kill" "" "Kill process, prepare to debug log file" \ |
| 52 "Kill the program being debugged\\? \\(y or n\\) " "y" | 51 "Kill the program being debugged\\? \\(y or n\\) " "y" |
| 53 | 52 |
| 54 gdb_test "record restore watch.precsave" \ | 53 gdb_test "record restore $precsave" \ |
| 55 "Program terminated with signal .*" \ | 54 "Program terminated with signal .*" \ |
| 56 "reload core file" | 55 "reload core file" |
| 57 | 56 |
| 58 # Only software watchpoints can be used in reverse | 57 # Only software watchpoints can be used in reverse |
| 59 gdb_test_no_output "set can-use-hw-watchpoints 0" "" | 58 gdb_test_no_output "set can-use-hw-watchpoints 0" "" |
| 60 | 59 |
| 61 gdb_test "break marker1" \ | 60 gdb_test "break marker1" \ |
| 62 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ | 61 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ |
| 63 "set breakpoint at marker1" | 62 "set breakpoint at marker1" |
| 64 | 63 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 gdb_test "continue" \ | 206 gdb_test "continue" \ |
| 208 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival
4 = count;.*" \ | 207 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival
4 = count;.*" \ |
| 209 "watchpoint hit in reverse, HW, fourth time" | 208 "watchpoint hit in reverse, HW, fourth time" |
| 210 | 209 |
| 211 # Reverse until first change, from 0 to -1 | 210 # Reverse until first change, from 0 to -1 |
| 212 | 211 |
| 213 gdb_test "continue" \ | 212 gdb_test "continue" \ |
| 214 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; iva
l4 = count;.*" \ | 213 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; iva
l4 = count;.*" \ |
| 215 "watchpoint hit in reverse, HW, fifth time" | 214 "watchpoint hit in reverse, HW, fifth time" |
| 216 | 215 |
| OLD | NEW |