| 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 precord logfile. | 17 # 'advance' in precord logfile. | 
| 18 | 18 | 
| 19 # This test suitable only for process record-replay | 19 # This test suitable only for process record-replay | 
| 20 if ![supports_process_record] { | 20 if ![supports_process_record] { | 
| 21     return | 21     return | 
| 22 } | 22 } | 
| 23 | 23 | 
| 24 set testfile "until-reverse" | 24 standard_testfile until-reverse.c ur1.c | 
| 25 set srcfile ${testfile}.c | 25 set precsave [standard_output_file until.precsave] | 
| 26 set srcfile1 ur1.c |  | 
| 27 | 26 | 
| 28 if { [prepare_for_testing $testfile.exp $testfile {until-reverse.c ur1.c} ] } { | 27 if { [prepare_for_testing $testfile.exp $testfile \ | 
|  | 28 »         [list $srcfile $srcfile2]] } { | 
| 29     return -1 | 29     return -1 | 
| 30 } | 30 } | 
| 31 | 31 | 
| 32 set bp_location1  [gdb_get_line_number "set breakpoint 1 here"] | 32 set bp_location1  [gdb_get_line_number "set breakpoint 1 here"] | 
| 33 set bp_location7  [gdb_get_line_number "set breakpoint 7 here"] | 33 set bp_location7  [gdb_get_line_number "set breakpoint 7 here"] | 
| 34 set bp_location9  [gdb_get_line_number "set breakpoint 9 here" "$srcfile1"] | 34 set bp_location9  [gdb_get_line_number "set breakpoint 9 here" "$srcfile2"] | 
| 35 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] | 35 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] | 
| 36 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] | 36 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] | 
| 37 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] | 37 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] | 
| 38 | 38 | 
| 39 runto main | 39 runto main | 
| 40 | 40 | 
| 41 if [supports_process_record] { | 41 if [supports_process_record] { | 
| 42     # Activate process record/replay | 42     # Activate process record/replay | 
| 43     gdb_test_no_output "record" "Turn on process record" | 43     gdb_test_no_output "record" "Turn on process record" | 
| 44 } | 44 } | 
| 45 | 45 | 
| 46 set end_of_main [gdb_get_line_number "set breakpoint 10a here" ] | 46 set end_of_main [gdb_get_line_number "set breakpoint 10a here" ] | 
| 47 gdb_test "break $end_of_main" \ | 47 gdb_test "break $end_of_main" \ | 
| 48     "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ | 48     "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ | 
| 49     "BP at end of main" | 49     "BP at end of main" | 
| 50 | 50 | 
| 51 # This can take awhile. | 51 # This can take awhile. | 
| 52 set oldtimeout $timeout | 52 set oldtimeout $timeout | 
| 53 set timeout [expr $oldtimeout + 120] | 53 set timeout [expr $oldtimeout + 120] | 
| 54 gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of ma
     in" | 54 gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of ma
     in" | 
|  | 55 | 
|  | 56 # So can this, against gdbserver, for example. | 
|  | 57 gdb_test "record save $precsave" \ | 
|  | 58     "Saved core file $precsave with execution log\."  \ | 
|  | 59     "save process recfile" | 
| 55 set timeout $oldtimeout | 60 set timeout $oldtimeout | 
| 56 | 61 | 
| 57 gdb_test "record save until.precsave" \ |  | 
| 58     "Saved core file until.precsave with execution log\."  \ |  | 
| 59     "save process recfile" |  | 
| 60 |  | 
| 61 gdb_test "kill" "" "Kill process, prepare to debug log file" \ | 62 gdb_test "kill" "" "Kill process, prepare to debug log file" \ | 
| 62     "Kill the program being debugged\\? \\(y or n\\) " "y" | 63     "Kill the program being debugged\\? \\(y or n\\) " "y" | 
| 63 | 64 | 
| 64 gdb_test "record restore until.precsave" \ | 65 gdb_test "record restore $precsave" \ | 
| 65     "Program terminated with signal .*" \ | 66     "Program terminated with signal .*" \ | 
| 66     "reload core file" | 67     "reload core file" | 
| 67 | 68 | 
| 68 # Verify that plain vanilla "until <location>" works. | 69 # Verify that plain vanilla "until <location>" works. | 
| 69 # | 70 # | 
| 70 gdb_test "until $bp_location1" \ | 71 gdb_test "until $bp_location1" \ | 
| 71     "main .* at .*:$bp_location1.*" \ | 72     "main .* at .*:$bp_location1.*" \ | 
| 72     "until line number" | 73     "until line number" | 
| 73 | 74 | 
| 74 # Advance up to factorial, outer invocation | 75 # Advance up to factorial, outer invocation | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 87 | 88 | 
| 88 # Finish out to main scope | 89 # Finish out to main scope | 
| 89 # | 90 # | 
| 90 gdb_test "finish" \ | 91 gdb_test "finish" \ | 
| 91     " in main .*$srcfile:$bp_location1.*" \ | 92     " in main .*$srcfile:$bp_location1.*" \ | 
| 92     "finish to main" | 93     "finish to main" | 
| 93 | 94 | 
| 94 # Advance to a function called by main (marker2) | 95 # Advance to a function called by main (marker2) | 
| 95 # | 96 # | 
| 96 gdb_test "advance marker2" \ | 97 gdb_test "advance marker2" \ | 
| 97     "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | 98     "marker2 .a=43.*$srcfile2:$bp_location9.*" \ | 
| 98     "advance to marker2" | 99     "advance to marker2" | 
| 99 | 100 | 
| 100 # Now issue an until with another function, not called by the current | 101 # Now issue an until with another function, not called by the current | 
| 101 # frame, as argument. This should not work, i.e. the program should | 102 # frame, as argument. This should not work, i.e. the program should | 
| 102 # stop at main, the caller, where we put the 'guard' breakpoint. | 103 # stop at main, the caller, where we put the 'guard' breakpoint. | 
| 103 # | 104 # | 
| 104 set test_msg "until func, not called by current frame" | 105 set test_msg "until func, not called by current frame" | 
| 105 gdb_test_multiple "until marker3" "$test_msg" { | 106 gdb_test_multiple "until marker3" "$test_msg" { | 
| 106     -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { | 107     -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { | 
| 107         pass "$test_msg" | 108         pass "$test_msg" | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 118 # Set reverse execution direction | 119 # Set reverse execution direction | 
| 119 | 120 | 
| 120 gdb_test_no_output "set exec-dir reverse" "set reverse execution" | 121 gdb_test_no_output "set exec-dir reverse" "set reverse execution" | 
| 121 | 122 | 
| 122 # | 123 # | 
| 123 # We should now be at main, after the return from marker2. | 124 # We should now be at main, after the return from marker2. | 
| 124 # "Advance" backward into marker2. | 125 # "Advance" backward into marker2. | 
| 125 # | 126 # | 
| 126 | 127 | 
| 127 gdb_test "advance marker2" \ | 128 gdb_test "advance marker2" \ | 
| 128     "marker2 .a=43.*$srcfile1:$bp_location9.*" \ | 129     "marker2 .a=43.*$srcfile2:$bp_location9.*" \ | 
| 129     "reverse-advance to marker2" | 130     "reverse-advance to marker2" | 
| 130 | 131 | 
| 131 # Finish out to main scope (backward) | 132 # Finish out to main scope (backward) | 
| 132 | 133 | 
| 133 gdb_test "finish" \ | 134 gdb_test "finish" \ | 
| 134     " in main .*$srcfile:$bp_location20.*" \ | 135     " in main .*$srcfile:$bp_location20.*" \ | 
| 135     "reverse-finish from marker2" | 136     "reverse-finish from marker2" | 
| 136 | 137 | 
| 137 # Advance backward to last line of factorial (outer invocation) | 138 # Advance backward to last line of factorial (outer invocation) | 
| 138 | 139 | 
| 139 gdb_test "advance $bp_location19" \ | 140 gdb_test "advance $bp_location19" \ | 
| 140     "factorial .value=720.*${srcfile}:$bp_location19.*" \ | 141     "factorial .value=720.*${srcfile}:$bp_location19.*" \ | 
| 141     "reverse-advance to final return of factorial" | 142     "reverse-advance to final return of factorial" | 
| 142 | 143 | 
| 143 # Now do "until" across the recursive calls, | 144 # Now do "until" across the recursive calls, | 
| 144 # ending up in the same frame where we are now. | 145 # ending up in the same frame where we are now. | 
| 145 | 146 | 
| 146 gdb_test "until $bp_location7" \ | 147 gdb_test "until $bp_location7" \ | 
| 147     "factorial .value=6..*$srcfile:$bp_location7.*" \ | 148     "factorial .value=6..*$srcfile:$bp_location7.*" \ | 
| 148     "reverse-until to entry of factorial" | 149     "reverse-until to entry of factorial" | 
| OLD | NEW | 
|---|