old-cross-binutils/gdb/testsuite/gdb.reverse/i386-precsave.exp

289 lines
8.8 KiB
Text
Raw Normal View History

# Copyright 2009-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is part of the gdb testsuite.
#
# This test tests some i386 general instructions with a precord dumpfile.
#
# This test suitable only for process record-replay
if ![supports_process_record] {
return
}
if ![istarget "i?86-*linux*"] then {
verbose "Skipping i386 reverse tests."
return
}
* gdb.reverse/break-precsave.exp: Use standard_testfile. * gdb.reverse/break-reverse.exp: Use standard_testfile. * gdb.reverse/consecutive-precsave.exp: Use standard_testfile. * gdb.reverse/consecutive-reverse.exp: Use standard_testfile. * gdb.reverse/finish-precsave.exp: Use standard_testfile. * gdb.reverse/finish-reverse-bkpt.exp: Use standard_testfile. * gdb.reverse/finish-reverse.exp: Use standard_testfile. * gdb.reverse/i386-precsave.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-sse-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-env-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-stack-reverse.exp: Use standard_testfile, prepare_for_testing * gdb.reverse/machinestate-precsave.exp: Use standard_testfile. * gdb.reverse/machinestate.exp: Use standard_testfile. * gdb.reverse/next-reverse-bkpt-over-sr.exp: Use standard_testfile. * gdb.reverse/sigall-precsave.exp: Use standard_testfile, build_executable. * gdb.reverse/sigall-reverse.exp: Use standard_testfile, build_executable. * gdb.reverse/solib-precsave.exp: Use standard_testfile, standard_output_file. * gdb.reverse/solib-reverse.exp: Use standard_testfile, standard_output_file. * gdb.reverse/step-precsave.exp: Use standard_testfile. * gdb.reverse/step-reverse.exp: Use standard_testfile. * gdb.reverse/until-precsave.exp: Use standard_testfile. * gdb.reverse/until-reverse.exp: Use standard_testfile. * gdb.reverse/watch-precsave.exp: Use standard_testfile. * gdb.reverse/watch-reverse.exp: Use standard_testfile.
2012-06-26 17:54:59 +00:00
standard_testfile i386-reverse.c
set precsave [standard_output_file i386.precsave]
# some targets have leading underscores on assembly symbols.
2011-05-24 12:01:22 +00:00
set additional_flags [gdb_target_symbol_prefix_flags]
* gdb.reverse/break-precsave.exp: Use standard_testfile. * gdb.reverse/break-reverse.exp: Use standard_testfile. * gdb.reverse/consecutive-precsave.exp: Use standard_testfile. * gdb.reverse/consecutive-reverse.exp: Use standard_testfile. * gdb.reverse/finish-precsave.exp: Use standard_testfile. * gdb.reverse/finish-reverse-bkpt.exp: Use standard_testfile. * gdb.reverse/finish-reverse.exp: Use standard_testfile. * gdb.reverse/i386-precsave.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-sse-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-env-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-stack-reverse.exp: Use standard_testfile, prepare_for_testing * gdb.reverse/machinestate-precsave.exp: Use standard_testfile. * gdb.reverse/machinestate.exp: Use standard_testfile. * gdb.reverse/next-reverse-bkpt-over-sr.exp: Use standard_testfile. * gdb.reverse/sigall-precsave.exp: Use standard_testfile, build_executable. * gdb.reverse/sigall-reverse.exp: Use standard_testfile, build_executable. * gdb.reverse/solib-precsave.exp: Use standard_testfile, standard_output_file. * gdb.reverse/solib-reverse.exp: Use standard_testfile, standard_output_file. * gdb.reverse/step-precsave.exp: Use standard_testfile. * gdb.reverse/step-reverse.exp: Use standard_testfile. * gdb.reverse/until-precsave.exp: Use standard_testfile. * gdb.reverse/until-reverse.exp: Use standard_testfile. * gdb.reverse/watch-precsave.exp: Use standard_testfile. * gdb.reverse/watch-reverse.exp: Use standard_testfile.
2012-06-26 17:54:59 +00:00
if {[prepare_for_testing $testfile.exp $testfile $srcfile \
[list debug $additional_flags]]} {
return -1
}
set end_of_main [gdb_get_line_number " end of main "]
set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "]
runto main
if [supports_process_record] {
# Activate process record/replay
2010-05-28 Michael Snyder <msnyder@msnyder-server.eng.vmware.com> * gdb.reverse/break-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/break-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/consecutive-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/consecutive-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/finish-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/finish-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/i386-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/i386-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/i386-sse-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/i387-env-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/i387-stack-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/machinestate-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/machinestate.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/sigall-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/sigall-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/solib-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/solib-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/step-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/step-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/until-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/until-reverse.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/watch-precsave.exp: Replace uses of send_gdb / gdb_expect. * gdb.reverse/watch-reverse.exp: Replace uses of send_gdb / gdb_expect.
2010-05-28 18:26:41 +00:00
gdb_test_no_output "record" "Turn on process record"
}
global hex
global decimal
gdb_test "break $end_of_main" \
Fix mingw32 failures due to incorrect directory separator in pattern Some testcases, mostly gdb.reverse ones, assume the presence of a '/' directory separator before the source file name. This is incorrect for mingw32 hosts, generating false failures for those tests. I attempted to catch most of the occurrences of the pattern ".*/$srcfile" and replaced them with ".*$srcfile". The latter is used elsewhere in the testsuite. The resulting patch is attached. I also see other occurrences of the same assumption throughout the testsuite, but usually they are arguments for function calls and i seem to recall either the test harness or GDB deals with those paths properly. gdb/testsuite: 2014-10-17 Luis Machado <lgustavo@codesourcery.com> * gdb.guile/scm-breakpoint.exp: Do not assume any directory separators when matching source file paths. * gdb.python/py-breakpoint.exp: Likewise. * gdb.reverse/break-precsave.exp: Likewise. * gdb.reverse/break-reverse.exp: Likewise. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/finish-reverse-bkpt.exp: Likewise. * gdb.reverse/finish-reverse.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/i387-env-reverse.exp: Likewise. * gdb.reverse/i387-stack-reverse.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/machinestate.exp: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise. * gdb.reverse/watch-reverse.exp: Likewise.
2014-10-17 14:28:17 +00:00
"Breakpoint $decimal at .*$srcfile, line $end_of_main\." \
"BP at end of main"
gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
gdb_test "record save $precsave" \
"Saved core file $precsave with execution log\." \
"save process recfile"
gdb_test "kill" "" "Kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
gdb_test "record restore $precsave" \
I caught a few mingw32-specific failures for some of the gdb.reverse tests. FAIL: gdb.reverse/consecutive-precsave.exp: reload precord save file FAIL: gdb.reverse/finish-precsave.exp: reload precord save file FAIL: gdb.reverse/until-precsave.exp: reload core file FAIL: gdb.reverse/watch-precsave.exp: reload core file FAIL: gdb.reverse/step-precsave.exp: reload core file FAIL: gdb.reverse/break-precsave.exp: reload precord save file FAIL: gdb.reverse/sigall-precsave.exp: reload precord save file They happen for two reasons. - mingw32 does not define SIGTRAP, so upon recording a core file, the signal information will be missing, which in turn causes GDB to not display the stopping signal when it loads the same core file. An earlier message warns about this: "warning: Signal SIGTRAP does not exist on this system." - The testcase is crafted in a way that expects a pattern of the stopping signal message instead of a successful core file read message. The following patch fixes this by changing the old pattern to a more reasonable one, while still ignoring the fact that mingw32-based GDB does not record a SIGTRAP in a core file because it does not define it. gdb/testsuite/ 2014-11-18 Luis Machado <lgustavo@codesourcery.com> * gdb.reverse/break-precsave: Expect completion message for core file reads. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise.
2014-11-18 13:16:37 +00:00
"Restored records from core file .*" \
"reload precord save file"
gdb_test "step" "inc .eax.*" "step to inc eax 1st time"
send_gdb "info reg eax\n"
gdb_expect {
-re "eax *($hex)\t.*$gdb_prompt " {
set preinc_eax $expect_out(1,string)
}
}
gdb_test "step" "inc .ecx.*" "step to inc ecx 1st time"
send_gdb "info reg ecx\n"
gdb_expect {
-re "ecx *($hex)\t.*$gdb_prompt " {
set preinc_ecx $expect_out(1,string)
}
}
gdb_test "step" "inc .edx.*" "step to inc edx 1st time"
send_gdb "info reg edx\n"
gdb_expect {
-re "edx *($hex)\t.*$gdb_prompt " {
set preinc_edx $expect_out(1,string)
}
}
gdb_test "step" "inc .ebx.*" "step to inc ebx 1st time"
send_gdb "info reg ebx\n"
gdb_expect {
-re "ebx *($hex)\t.*$gdb_prompt " {
set preinc_ebx $expect_out(1,string)
}
}
gdb_test "step" "inc .esp.*" "step to inc esp 1st time"
send_gdb "info reg esp\n"
gdb_expect {
-re "esp *($hex)\t.*$gdb_prompt " {
set preinc_esp $expect_out(1,string)
}
}
gdb_test "step" "inc .ebp.*" "step to inc ebp 1st time"
send_gdb "info reg ebp\n"
gdb_expect {
-re "ebp *($hex)\t.*$gdb_prompt " {
set preinc_ebp $expect_out(1,string)
}
}
gdb_test "step" "inc .esi.*" "step to inc esi 1st time"
send_gdb "info reg esi\n"
gdb_expect {
-re "esi *($hex)\t.*$gdb_prompt " {
set preinc_esi $expect_out(1,string)
}
}
gdb_test "step" "inc .edi.*" "step to inc edi 1st time"
send_gdb "info reg edi\n"
gdb_expect {
-re "edi *($hex)\t.*$gdb_prompt " {
set preinc_edi $expect_out(1,string)
}
}
gdb_test "step" "dec .eax.*" "step to dec eax 1st time"
send_gdb "info reg eax\n"
gdb_expect {
-re "eax *($hex)\t.*$gdb_prompt " {
set predec_eax $expect_out(1,string)
}
}
gdb_test "step" "dec .ecx.*" "step to dec ecx 1st time"
send_gdb "info reg ecx\n"
gdb_expect {
-re "ecx *($hex)\t.*$gdb_prompt " {
set predec_ecx $expect_out(1,string)
}
}
gdb_test "step" "dec .edx.*" "step to dec edx 1st time"
send_gdb "info reg edx\n"
gdb_expect {
-re "edx *($hex)\t.*$gdb_prompt " {
set predec_edx $expect_out(1,string)
}
}
gdb_test "step" "dec .ebx.*" "step to dec ebx 1st time"
send_gdb "info reg ebx\n"
gdb_expect {
-re "ebx *($hex)\t.*$gdb_prompt " {
set predec_ebx $expect_out(1,string)
}
}
gdb_test "step" "dec .esp.*" "step to dec esp 1st time"
send_gdb "info reg esp\n"
gdb_expect {
-re "esp *($hex)\t.*$gdb_prompt " {
set predec_esp $expect_out(1,string)
}
}
gdb_test "step" "dec .ebp.*" "step to dec ebp 1st time"
send_gdb "info reg ebp\n"
gdb_expect {
-re "ebp *($hex)\t.*$gdb_prompt " {
set predec_ebp $expect_out(1,string)
}
}
gdb_test "step" "dec .esi.*" "step to dec esi 1st time"
send_gdb "info reg esi\n"
gdb_expect {
-re "esi *($hex)\t.*$gdb_prompt " {
set predec_esi $expect_out(1,string)
}
}
gdb_test "step" "dec .edi.*" "step to dec edi 1st time"
send_gdb "info reg edi\n"
gdb_expect {
-re "edi *($hex)\t.*$gdb_prompt " {
set predec_edi $expect_out(1,string)
}
}
# gdb_test "step" "end inc_dec_tests .*" "step to end inc_dec_tests 1st time"
gdb_test "break $end_of_main" \
"Breakpoint $decimal at .* line $end_of_main\." \
"set breakpoint at end of main"
gdb_test "continue" \
" end of main .*" \
"continue to end of main"
gdb_test "break $end_of_inc_dec_tests" \
"Breakpoint $decimal at .* line $end_of_inc_dec_tests\." \
"set breakpoint at end of inc_dec_tests"
gdb_test "reverse-continue" \
" end inc_dec_tests .*" \
"reverse to inc_dec_tests"
#
# Now reverse step, and check register values.
#
gdb_test "info reg edi" "edi *$preinc_edi\t.*" "edi before reverse-dec"
gdb_test "reverse-step" "dec .edi.*" "reverse-step to dec edi"
gdb_test "info reg edi" "edi *$predec_edi\t.*" "edi after reverse-dec"
gdb_test "info reg esi" "esi *$preinc_esi\t.*" "esi before reverse-dec"
gdb_test "reverse-step" "dec .esi.*" "reverse-step to dec esi"
gdb_test "info reg esi" "esi *$predec_esi\t.*" "esi after reverse-dec"
gdb_test "info reg ebp" "ebp *$preinc_ebp\t.*" "ebp before reverse-dec"
gdb_test "reverse-step" "dec .ebp.*" "reverse-step to dec ebp"
gdb_test "info reg ebp" "ebp *$predec_ebp\t.*" "ebp after reverse-dec"
gdb_test "info reg esp" "esp *$preinc_esp\t.*" "esp before reverse-dec"
gdb_test "reverse-step" "dec .esp.*" "reverse-step to dec esp"
gdb_test "info reg esp" "esp *$predec_esp\t.*" "esp after reverse-dec"
gdb_test "info reg ebx" "ebx *$preinc_ebx\t.*" "ebx before reverse-dec"
gdb_test "reverse-step" "dec .ebx.*" "reverse-step to dec ebx"
gdb_test "info reg ebx" "ebx *$predec_ebx\t.*" "ebx after reverse-dec"
gdb_test "info reg edx" "edx *$preinc_edx\t.*" "edx before reverse-dec"
gdb_test "reverse-step" "dec .edx.*" "reverse-step to dec edx"
gdb_test "info reg edx" "edx *$predec_edx\t.*" "edx after reverse-dec"
gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx before reverse-dec"
gdb_test "reverse-step" "dec .ecx.*" "reverse-step to dec ecx"
gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx after reverse-dec"
gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax before reverse-dec"
gdb_test "reverse-step" "dec .eax.*" "reverse-step to dec eax"
gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax after reverse-dec"
gdb_test "info reg edi" "edi *$predec_edi\t.*" "edi before reverse-inc"
gdb_test "reverse-step" "inc .edi.*" "reverse-step to inc edi"
gdb_test "info reg edi" "edi *$preinc_edi\t.*" "edi after reverse-inc"
gdb_test "info reg esi" "esi *$predec_esi\t.*" "esi before reverse-inc"
gdb_test "reverse-step" "inc .esi.*" "reverse-step to inc esi"
gdb_test "info reg esi" "esi *$preinc_esi\t.*" "esi after reverse-inc"
gdb_test "info reg ebp" "ebp *$predec_ebp\t.*" "ebp before reverse-inc"
gdb_test "reverse-step" "inc .ebp.*" "reverse-step to inc ebp"
gdb_test "info reg ebp" "ebp *$preinc_ebp\t.*" "ebp after reverse-inc"
gdb_test "info reg esp" "esp *$predec_esp\t.*" "esp before reverse-inc"
gdb_test "reverse-step" "inc .esp.*" "reverse-step to inc esp"
gdb_test "info reg esp" "esp *$preinc_esp\t.*" "esp after reverse-inc"
gdb_test "info reg ebx" "ebx *$predec_ebx\t.*" "ebx before reverse-inc"
gdb_test "reverse-step" "inc .ebx.*" "reverse-step to inc ebx"
gdb_test "info reg ebx" "ebx *$preinc_ebx\t.*" "ebx after reverse-inc"
gdb_test "info reg edx" "edx *$predec_edx\t.*" "edx before reverse-inc"
gdb_test "reverse-step" "inc .edx.*" "reverse-step to inc edx"
gdb_test "info reg edx" "edx *$preinc_edx\t.*" "edx after reverse-inc"
gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx before reverse-inc"
gdb_test "reverse-step" "inc .ecx.*" "reverse-step to inc ecx"
gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx after reverse-inc"
gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax before reverse-inc"
gdb_test "reverse-step" "inc .eax.*" "reverse-step to inc eax"
gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax after reverse-inc"