aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2009-08-27 00:05:08 +0000
committerMichael Snyder <msnyder@vmware.com>2009-08-27 00:05:08 +0000
commit2efab443eb62bbb0fb1e6a4ed0449460199c321a (patch)
tree2d912402dc1be28b0a448a96bd649afe7dd389d4 /gdb/testsuite
parent38d9e59d535da410c082700f8566d66ff058ff02 (diff)
downloadgdb-2efab443eb62bbb0fb1e6a4ed0449460199c321a.zip
gdb-2efab443eb62bbb0fb1e6a4ed0449460199c321a.tar.gz
gdb-2efab443eb62bbb0fb1e6a4ed0449460199c321a.tar.bz2
2009-08-26 Michael Snyder <msnyder@vmware.com>
* gdb.base/i386-reverse.c: New file. * gdb.base/i386-reverse.exp: New file. * gdb.base/Makefile.in: Add new files to be removed.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.reverse/Makefile.in2
-rw-r--r--gdb/testsuite/gdb.reverse/i386-reverse.c46
-rw-r--r--gdb/testsuite/gdb.reverse/i386-reverse.exp288
4 files changed, 341 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c0954b3..6a8aba0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-26 Michael Snyder <msnyder@vmware.com>
+
+ * gdb.base/i386-reverse.c: New file.
+ * gdb.base/i386-reverse.exp: New file.
+ * gdb.base/Makefile.in: Add new files to be removed.
+
2009-08-26 Joseph Myers <joseph@codesourcery.com>
* gdb.mi/mi-basics.exp (test_cwd_specification): Do not test
diff --git a/gdb/testsuite/gdb.reverse/Makefile.in b/gdb/testsuite/gdb.reverse/Makefile.in
index 43b2f58..513c884 100644
--- a/gdb/testsuite/gdb.reverse/Makefile.in
+++ b/gdb/testsuite/gdb.reverse/Makefile.in
@@ -3,7 +3,7 @@ srcdir = @srcdir@
EXECUTABLES = break-reverse consecutive-reverse finish-reverse \
machinestate solib-reverse step-reverse until-reverse \
- watch-reverse
+ watch-reverse i386-reverse
MISCELLANEOUS =
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.c b/gdb/testsuite/gdb.reverse/i386-reverse.c
new file mode 100644
index 0000000..3407a5a
--- /dev/null
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.c
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009 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/>. */
+
+/* Architecture tests for intel i386 platform. */
+
+void
+inc_dec_tests (void)
+{
+ asm ("inc %eax");
+ asm ("inc %ecx");
+ asm ("inc %edx");
+ asm ("inc %ebx");
+ asm ("inc %esp");
+ asm ("inc %ebp");
+ asm ("inc %esi");
+ asm ("inc %edi");
+ asm ("dec %eax");
+ asm ("dec %ecx");
+ asm ("dec %edx");
+ asm ("dec %ebx");
+ asm ("dec %esp");
+ asm ("dec %ebp");
+ asm ("dec %esi");
+ asm ("dec %edi");
+} /* end inc_dec_tests */
+
+int
+main ()
+{
+ inc_dec_tests ();
+ return 0; /* end of main */
+}
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp
new file mode 100644
index 0000000..a9167b0
--- /dev/null
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp
@@ -0,0 +1,288 @@
+# Copyright 2009 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 for reverse execution.
+#
+
+if ![target_info exists gdb,can_reverse] {
+ return
+}
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "i?86-*linux*"] then {
+ verbose "Skipping i386 reverse tests."
+ return
+}
+
+set testfile "i386-reverse"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
+ untested i386-reverse
+ 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 "]
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+runto main
+
+if [target_info exists gdb,use_precord] {
+ # Activate process record/replay
+ gdb_test "record" "" "Turn on process record"
+ # FIXME: command ought to acknowledge, so we can test if it succeeded.
+}
+
+global hex
+global decimal
+
+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"
+
+