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

250 lines
6.7 KiB
Text
Raw Normal View History

2011-01-01 15:34:07 +00:00
# Copyright 2008, 2009, 2010, 2011 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 'finish' with
# reverse debugging.
if ![supports_reverse] {
return
}
set testfile "finish-reverse"
set srcfile ${testfile}.c
if { [prepare_for_testing $testfile.exp "$testfile" $srcfile] } {
return -1
}
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"
}
# Run until end, then save execution log.
set breakloc [gdb_get_line_number "end of main" "$srcfile"]
gdb_test "break $breakloc" \
"Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
"BP at end of main"
gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
gdb_test "record save finish.precsave" \
"Saved core file finish.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 finish.precsave" \
"Program terminated with signal .*" \
"reload precord save file"
# Test finish from void func
set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
gdb_test "break void_func" \
"Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
"set breakpoint on void_func"
gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from void_func"
gdb_test_multiple "finish" "$test_msg" {
-re " call to void_func .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " void_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test finish from char func
set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
gdb_test "break char_func" \
"Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
"set breakpoint on char_func"
gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from char_func"
gdb_test_multiple "finish" "$test_msg" {
-re " void_checkpoint .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " char_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test finish from short func
set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
gdb_test "break short_func" \
"Breakpoint $decimal at .* line $breakloc\." \
"set breakpoint on short_func"
gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from short_func"
gdb_test_multiple "finish" "$test_msg" {
-re " char_checkpoint .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " short_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test finish from int func
set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
gdb_test "break int_func" \
"Breakpoint $decimal at .* line $breakloc\." \
"set breakpoint on int_func"
gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from int_func"
gdb_test_multiple "finish" "$test_msg" {
-re " short_checkpoint .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " int_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test finish from long func
set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
gdb_test "break long_func" \
"Breakpoint $decimal at .* line $breakloc\." \
"set breakpoint on long_func"
gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from long_func"
gdb_test_multiple "finish" "$test_msg" {
-re " int_checkpoint .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " long_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test finish from long long func
set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
gdb_test "break long_long_func" \
"Breakpoint $decimal at .* line $breakloc\." \
"set breakpoint on long_long_func"
gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
set test_msg "finish from long_long_func"
gdb_test_multiple "finish" "$test_msg" {
-re " long_checkpoint .*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re " long_long_checkpoint .*$gdb_prompt $" {
pass "$test_msg"
}
}
###
###
###
# Now switch to reverse
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 "set exec-dir reverse" "set reverse execution"
# Test reverse finish from long long func
set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from long_long_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* long_checkpoint.*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test reverse finish from long func
set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from long_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* int_checkpoint.*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test reverse finish from int func
set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from int_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* short_checkpoint.*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test reverse finish from short func
set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from short_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* char_checkpoint.*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test reverse finish from char func
set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from char_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* void_checkpoint.*$gdb_prompt $" {
pass "$test_msg"
}
}
# Test reverse finish from void func
set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
set test_msg "reverse finish from void_func"
gdb_test_multiple "finish" "$test_msg" {
-re ".* call to void_func.*$gdb_prompt $" {
pass "$test_msg"
}
}