diff options
author | Michael Snyder <msnyder@vmware.com> | 2009-06-27 18:49:20 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2009-06-27 18:49:20 +0000 |
commit | 28d41a992fe2b335e93e84f724c76df8ed47fe28 (patch) | |
tree | 5a0b179ef4873d6255a32ecb30790e2bc3625704 /gdb/testsuite/gdb.reverse/until-reverse.exp | |
parent | 388a856237fc981725e33eca6644d837c94918a9 (diff) | |
download | binutils-28d41a992fe2b335e93e84f724c76df8ed47fe28.zip binutils-28d41a992fe2b335e93e84f724c76df8ed47fe28.tar.gz binutils-28d41a992fe2b335e93e84f724c76df8ed47fe28.tar.bz2 |
2009-06-27 Michael Snyder <msnyder@vmware.com>
* gdb.reverse: New directory.
* gdb.reverse/break-reverse.c: New test.
* gdb.reverse/break-reverse.exp: New test.
* gdb.reverse/consecutive-reverse.c: New test.
* gdb.reverse/consecutive-reverse.exp: New test.
* gdb.reverse/finish-reverse.c: New test.
* gdb.reverse/finish-reverse.exp: New test.
* gdb.reverse/machinestate.c: New test.
* gdb.reverse/ms1.c: New test.
* gdb.reverse/machinestate.exp: New test.
* gdb.reverse/Makefile.in: New file.
* gdb.reverse/shr2.c: New test.
* gdb.reverse/solib-reverse.c: New test.
* gdb.reverse/solib-reverse.exp: New test.
* gdb.reverse/step-reverse.c: New test.
* gdb.reverse/step-reverse.exp: New test.
* gdb.reverse/until-reverse.c: New test.
* gdb.reverse/ur1.c: New test.
* gdb.reverse/until-reverse.exp: New test.
* gdb.reverse/watch-reverse.c: New test.
* gdb.reverse/watch-reverse.exp: New test.
* configure.ac (AC_OUTPUT): Add gdb.reverse/Makefile.
* configure: Regenerate.
Diffstat (limited to 'gdb/testsuite/gdb.reverse/until-reverse.exp')
-rw-r--r-- | gdb/testsuite/gdb.reverse/until-reverse.exp | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.exp b/gdb/testsuite/gdb.reverse/until-reverse.exp new file mode 100644 index 0000000..6667fa2 --- /dev/null +++ b/gdb/testsuite/gdb.reverse/until-reverse.exp @@ -0,0 +1,129 @@ +# Copyright 2008, 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. It tests 'until' and +# 'advance' in reverse debugging. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "until-reverse" +set srcfile ${testfile}.c +set srcfile1 ur1.c + +if { [prepare_for_testing $testfile.exp $testfile {until-reverse.c ur1.c} ] } { + return -1 +} + +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] +set bp_location9 [gdb_get_line_number "set breakpoint 9 here" "$srcfile1"] +set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] +set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] +set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] + +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. +} + +# Verify that plain vanilla "until <location>" works. +# +gdb_test "until $bp_location1" \ + "main .* at .*:$bp_location1.*" \ + "until line number" + +# Advance up to factorial, outer invocation +# +gdb_test "advance factorial" \ + "factorial .value=6..*$srcfile:$bp_location7.*" \ + "advance to factorial" + +# At this point, 'until' should continue the inferior up to when all the +# inner invocations of factorial() are completed and we are back at this +# frame. +# +gdb_test "until $bp_location19" \ + "factorial .value=720.*${srcfile}:$bp_location19.*" \ + "until factorial, recursive function" + +# Finish out to main scope +# +gdb_test "finish" \ + " in main .*$srcfile:$bp_location1.*" \ + "finish to main" + +# Advance to a function called by main (marker2) +# +gdb_test "advance marker2" \ + "marker2 .a=43.*$srcfile1:$bp_location9.*" \ + "advance to marker2" + +# Now issue an until with another function, not called by the current +# frame, as argument. This should not work, i.e. the program should +# stop at main, the caller, where we put the 'guard' breakpoint. +# +set test_msg "until func, not called by current frame" +gdb_test_multiple "until marker3" "$test_msg" { + -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" { + pass "$test_msg" + } + -re "main .*at .*${srcfile}:$bp_location21.*$gdb_prompt $" { + pass "$test_msg" + } +} + +### +### +### + +# Set reverse execution direction +# FIXME: command needs to acknowledge, so we can test if it succeeded. + +gdb_test "set exec-dir reverse" "" "set reverse execution" + +# +# We should now be at main, after the return from marker2. +# "Advance" backward into marker2. +# + +gdb_test "advance marker2" \ + "marker2 .a=43.*$srcfile1:$bp_location9.*" \ + "reverse-advance to marker2" + +# Finish out to main scope (backward) + +gdb_test "finish" \ + " in main .*$srcfile:$bp_location20.*" \ + "reverse-finish from marker2" + +# Advance backward to last line of factorial (outer invocation) + +gdb_test "advance $bp_location19" \ + "factorial .value=720.*${srcfile}:$bp_location19.*" \ + "reverse-advance to final return of factorial" + +# Now do "until" across the recursive calls, +# ending up in the same frame where we are now. + +gdb_test "until $bp_location7" \ + "factorial .value=6..*$srcfile:$bp_location7.*" \ + "reverse-until to entry of factorial" + + |