| 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 # This file is part of the gdb testsuite. | 16 # This file is part of the gdb testsuite. |
| 17 | 17 |
| 18 # | 18 # |
| 19 # This test tests some i386 general instructions with a precord dumpfile. | 19 # This test tests some i386 general instructions with a precord dumpfile. |
| 20 # | 20 # |
| 21 | 21 |
| 22 # This test suitable only for process record-replay | 22 # This test suitable only for process record-replay |
| 23 if ![supports_process_record] { | 23 if ![supports_process_record] { |
| 24 return | 24 return |
| 25 } | 25 } |
| 26 | 26 |
| 27 if $tracelevel { | |
| 28 strace $tracelevel | |
| 29 } | |
| 30 | |
| 31 | 27 |
| 32 if ![istarget "i?86-*linux*"] then { | 28 if ![istarget "i?86-*linux*"] then { |
| 33 verbose "Skipping i386 reverse tests." | 29 verbose "Skipping i386 reverse tests." |
| 34 return | 30 return |
| 35 } | 31 } |
| 36 | 32 |
| 37 set testfile "i386-precsave" | 33 standard_testfile i386-reverse.c |
| 38 set srcfile i386-reverse.c | 34 set precsave [standard_output_file i386.precsave] |
| 39 set binfile ${objdir}/${subdir}/${testfile} | |
| 40 | 35 |
| 41 # some targets have leading underscores on assembly symbols. | 36 # some targets have leading underscores on assembly symbols. |
| 42 set additional_flags [gdb_target_symbol_prefix_flags] | 37 set additional_flags [gdb_target_symbol_prefix_flags] |
| 43 | 38 |
| 44 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
debug $additional_flags]] != "" } { | 39 if {[prepare_for_testing $testfile.exp $testfile $srcfile \ |
| 45 untested ${testfile}.exp | 40 » [list debug $additional_flags]]} { |
| 46 return -1 | 41 return -1 |
| 47 } | 42 } |
| 48 | 43 |
| 49 set end_of_main [gdb_get_line_number " end of main "] | 44 set end_of_main [gdb_get_line_number " end of main "] |
| 50 set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "] | 45 set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "] |
| 51 | 46 |
| 52 # Get things started. | |
| 53 | |
| 54 gdb_exit | |
| 55 gdb_start | |
| 56 gdb_reinitialize_dir $srcdir/$subdir | |
| 57 gdb_load ${binfile} | |
| 58 runto main | 47 runto main |
| 59 | 48 |
| 60 if [supports_process_record] { | 49 if [supports_process_record] { |
| 61 # Activate process record/replay | 50 # Activate process record/replay |
| 62 gdb_test_no_output "record" "Turn on process record" | 51 gdb_test_no_output "record" "Turn on process record" |
| 63 } | 52 } |
| 64 | 53 |
| 65 global hex | 54 global hex |
| 66 global decimal | 55 global decimal |
| 67 | 56 |
| 68 gdb_test "break $end_of_main" \ | 57 gdb_test "break $end_of_main" \ |
| 69 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ | 58 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ |
| 70 "BP at end of main" | 59 "BP at end of main" |
| 71 | 60 |
| 72 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" | 61 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" |
| 73 | 62 |
| 74 gdb_test "record save i386.precsave" \ | 63 gdb_test "record save $precsave" \ |
| 75 "Saved core file i386.precsave with execution log\." \ | 64 "Saved core file $precsave with execution log\." \ |
| 76 "save process recfile" | 65 "save process recfile" |
| 77 | 66 |
| 78 gdb_test "kill" "" "Kill process, prepare to debug log file" \ | 67 gdb_test "kill" "" "Kill process, prepare to debug log file" \ |
| 79 "Kill the program being debugged\\? \\(y or n\\) " "y" | 68 "Kill the program being debugged\\? \\(y or n\\) " "y" |
| 80 | 69 |
| 81 gdb_test "record restore i386.precsave" \ | 70 gdb_test "record restore $precsave" \ |
| 82 "Program terminated with signal .*" \ | 71 "Program terminated with signal .*" \ |
| 83 "reload precord save file" | 72 "reload precord save file" |
| 84 | 73 |
| 85 gdb_test "step" "inc .eax.*" "step to inc eax 1st time" | 74 gdb_test "step" "inc .eax.*" "step to inc eax 1st time" |
| 86 send_gdb "info reg eax\n" | 75 send_gdb "info reg eax\n" |
| 87 gdb_expect { | 76 gdb_expect { |
| 88 -re "eax *($hex)\t.*$gdb_prompt " { | 77 -re "eax *($hex)\t.*$gdb_prompt " { |
| 89 set preinc_eax $expect_out(1,string) | 78 set preinc_eax $expect_out(1,string) |
| 90 } | 79 } |
| 91 } | 80 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 279 |
| 291 gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx before reverse-inc" | 280 gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx before reverse-inc" |
| 292 gdb_test "reverse-step" "inc .ecx.*" "reverse-step to inc ecx" | 281 gdb_test "reverse-step" "inc .ecx.*" "reverse-step to inc ecx" |
| 293 gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx after reverse-inc" | 282 gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx after reverse-inc" |
| 294 | 283 |
| 295 gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax before reverse-inc" | 284 gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax before reverse-inc" |
| 296 gdb_test "reverse-step" "inc .eax.*" "reverse-step to inc eax" | 285 gdb_test "reverse-step" "inc .eax.*" "reverse-step to inc eax" |
| 297 gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax after reverse-inc" | 286 gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax after reverse-inc" |
| 298 | 287 |
| 299 | 288 |
| OLD | NEW |