OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gdb-7.2/gdb-7.2-or32-1.0rc3/gdb/testsuite/gdb.reverse
    from Rev 330 to Rev 513
    Reverse comparison

Rev 330 → Rev 513

/ms1.c
0,0 → 1,25
/* This testcase is part of GDB, the GNU debugger.
 
Copyright 2008, 2010 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/>. */
 
/*
* Aux function for machine state test.
*/
 
void
hide (int x)
{
}
ms1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: consecutive-reverse.c =================================================================== --- consecutive-reverse.c (nonexistent) +++ consecutive-reverse.c (revision 513) @@ -0,0 +1,38 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +/* + Purpose of this test: to test breakpoints on consecutive instructions. +*/ + +int a[7] = {1, 2, 3, 4, 5, 6, 7}; + +/* assert: first line of foo has more than one instruction. */ +int foo () +{ + return a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6]; +} + +main() +{ +#ifdef usestubs + set_debug_traps (); + breakpoint (); +#endif + foo (); +} /* end of main */ +
consecutive-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: finish-precsave.exp =================================================================== --- finish-precsave.exp (nonexistent) +++ finish-precsave.exp (revision 513) @@ -0,0 +1,249 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests 'finish' with +# reverse debugging. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "finish-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp "$testfile" $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + 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 +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" + } +} Index: Makefile.in =================================================================== --- Makefile.in (nonexistent) +++ Makefile.in (revision 513) @@ -0,0 +1,19 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = break-reverse consecutive-reverse finish-reverse \ + machinestate solib-reverse step-reverse until-reverse \ + watch-reverse i386-reverse + +MISCELLANEOUS = + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + rm -f *~ *.o *.x *.ci *.sl a.out core + rm -f $(EXECUTABLES) $(MISCELLANEOUS) + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status config.log site.* + Index: finish-reverse.exp =================================================================== --- finish-reverse.exp (nonexistent) +++ finish-reverse.exp (revision 513) @@ -0,0 +1,229 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests 'finish' with +# reverse debugging. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "finish-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp "$testfile" $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +# 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 +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" + } +} Index: break-precsave.exp =================================================================== --- break-precsave.exp (nonexistent) +++ break-precsave.exp (revision 513) @@ -0,0 +1,105 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests reverse debugging +# with breakpoints in a process record logfile. + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "break-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +set foo_location [gdb_get_line_number "break in foo" ] +set bar_location [gdb_get_line_number "break in bar" ] +set main_location [gdb_get_line_number "break in main"] +set end_location [gdb_get_line_number "end of main" ] + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +gdb_test "break $end_location" \ + "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ + "BP at end of main" + +gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" + +gdb_test "record save break.precsave" \ + "Saved core file break.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 break.precsave" \ + "Program terminated with signal .*" \ + "reload precord save file" + +gdb_test "break foo" \ + "Breakpoint $decimal at .* line $foo_location\." \ + "set breakpoint on foo" + +gdb_test "break bar" \ + "Breakpoint $decimal at .* line $bar_location\." \ + "set breakpoint on bar" + +gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" +gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" +gdb_test_multiple "continue" "go to end of main forward" { + -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" { + pass "go to end of main forward" + } + -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + pass "go to end of main forward" + } +} + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +gdb_continue_to_breakpoint "bar backward" ".*/$srcfile:$bar_location.*" +gdb_continue_to_breakpoint "foo backward" ".*/$srcfile:$foo_location.*" + +gdb_test_multiple "continue" "main backward" { + -re ".*Breakpoint $decimal,.*/$srcfile:$main_location.*$gdb_prompt $" { + pass "main backward" + } + -re "No more reverse-execution history.* break in main .*$gdb_prompt $" { + pass "main backward" + } +} + +gdb_test_no_output "set exec-direction forward" "set forward" + +gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" +gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" + +gdb_test_multiple "continue" "end of record log" { + -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" { + pass "end of record log" + } + -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + pass "end of record log" + } +} Index: i386-sse-reverse.exp =================================================================== --- i386-sse-reverse.exp (nonexistent) +++ i386-sse-reverse.exp (revision 513) @@ -0,0 +1,702 @@ +# Copyright 2009, 2010 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 . + +# 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 +} + + +if ![istarget "*86*-*linux*"] then { + verbose "Skipping i386 reverse tests." + return +} + +set testfile "i386-sse-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-sse-reverse + return -1 +} + +set end_of_main [gdb_get_line_number " end of main "] +set end_sse_test [gdb_get_line_number " end sse_test "] +set end_sse4_test [gdb_get_line_number " end sse4_test "] + +# 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_no_output "record" "Turn on process record" +} + +global hex +global decimal + +#sse_test + +gdb_test "break $end_sse_test" \ + "Breakpoint $decimal at .* line $end_sse_test\." \ + "set breakpoint at end of sse_test" + +gdb_test "continue" \ + " end sse_test .*" \ + "continue to end of sse_test" + +gdb_test "reverse-step" "xorps.*" "reverse-step to xorps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x7f007f007fff7fff7f007f007fff7fff.*" \ + "verify xmm0 at end of sse_test" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x00ff00ff0000000000ff00ff00000000.*" \ + "verify xmm1 at end of sse_test" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 at end of sse_test" + +gdb_test "reverse-step" "xorpd.*" "reverse-step to xorpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x7f007f007fff7fff7f007f007fff7fff.*" \ + "verify xmm0 after reverse xorps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x7fff7fff7fff7fff7fff7fff7fff7fff.*" \ + "verify xmm1 after reverse xorps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse xorps" + +gdb_test "reverse-step" "unpckhps.*" "reverse-step to unpckhps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x7fff7fff7fff7fff0108000001400000.*" \ + "verify xmm0 after reverse xorpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x7fff7fff7fff7fff7fff7fff7fff7fff.*" \ + "verify xmm1 after reverse xorpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse xorpd" + +gdb_test "reverse-step" "unpckhpd.*" "reverse-step to unpckhpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm0 after reverse unpckhps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x7fff7fff7fff7fff7fff7fff7fff7fff.*" \ + "verify xmm1 after reverse unpckhps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse unpckhps" + +gdb_test "reverse-step" "ucomiss.*" "reverse-step to ucomiss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm0 after reverse unpckhpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x7fff7fff7fff7fff7fff7fff7fff7fff.*" \ + "verify xmm1 after reverse unpckhpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse unpckhpd" + +gdb_test "reverse-step" "ucomisd.*" "reverse-step to ucomisd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm0 after reverse ucomiss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x7fff7fff7fff7fff7fff7fff7fff7fff.*" \ + "verify xmm1 after reverse ucomiss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse ucomiss" + +gdb_test "reverse-step" "packssdw.*" "reverse-step to packssdw" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm0 after reverse ucomisd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm1 after reverse ucomisd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x7f007f007f007f007f007f007f007f00.*" \ + "verify xmm2 after reverse ucomisd" + +gdb_test "reverse-step" "packsswb.*" "reverse-step to packsswb" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm0 after reverse packssdw" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm1 after reverse packssdw" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm2 after reverse packssdw" + +gdb_test "reverse-step" "pabsd.*" "reverse-step to pabsd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0xfff00000ffc00000fff80000ffc00000.*" \ + "verify xmm0 after reverse packsswb" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm1 after reverse packsswb" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm2 after reverse packsswb" + +gdb_test "reverse-step" "pabsw.*" "reverse-step to pabsw" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0xfff00000ffc00000fff80000ffc00000.*" \ + "verify xmm0 after reverse pabsd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse pabsd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x01080000014000000108000001400000.*" \ + "verify xmm2 after reverse pabsd" + +gdb_test "reverse-step" "pabsb.*" "reverse-step to pabsb" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0xfff00000ffc00000fff80000ffc00000.*" \ + "verify xmm0 after reverse pabsw" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse pabsw" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm2 after reverse pabsw" + +gdb_test "reverse-step" "orps.*" "reverse-step to orps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0xfff00000ffc00000fff80000ffc00000.*" \ + "verify xmm0 after reverse pabsb" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse pabsb" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm2 after reverse pabsb" + +gdb_test "reverse-step" "orpd.*" "reverse-step to orpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse orps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse orps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm2 after reverse orps" + +gdb_test "reverse-step" "mulss.*" "reverse-step to mulss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse orpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse orpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm2 after reverse orpd" + +gdb_test "reverse-step" "mulsd.*" "reverse-step to mulsd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse mulss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse mulss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm2 after reverse mulss" + +gdb_test "reverse-step" "mulps.*" "reverse-step to mulps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse mulsd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff80000ffc00000fff80000ffc00000.*" \ + "verify xmm1 after reverse mulsd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff0000000000000fff00000ffc00000.*" \ + "verify xmm2 after reverse mulsd" + +gdb_test "reverse-step" "mulpd.*" "reverse-step to mulpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse mulps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm1 after reverse mulps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff0000000000000fff00000ffc00000.*" \ + "verify xmm2 after reverse mulps" + +gdb_test "reverse-step" "divss.*" "reverse-step to divss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \ + "verify xmm0 after reverse mulpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm1 after reverse mulpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff0000000000000fff0000000000000.*" \ + "verify xmm2 after reverse mulpd" + +gdb_test "reverse-step" "divsd.*" "reverse-step to divsd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \ + "verify xmm0 after reverse divss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xfff00000ffc00000fff00000ffc00000.*" \ + "verify xmm1 after reverse divss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff0000000000000fff0000000000000.*" \ + "verify xmm2 after reverse divss" + +gdb_test "reverse-step" "divps.*" "reverse-step to divps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \ + "verify xmm0 after reverse divsd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \ + "verify xmm1 after reverse divsd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xfff0000000000000fff0000000000000.*" \ + "verify xmm2 after reverse divsd" + +gdb_test "reverse-step" "divpd.*" "reverse-step to divpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \ + "verify xmm0 after reverse divps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \ + "verify xmm1 after reverse divps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xbff0000000000000bff0000000000000.*" \ + "verify xmm2 after reverse divps" + +gdb_test "reverse-step" "cvtpd2ps.*" "reverse-step to cvtpd2ps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \ + "verify xmm0 after reverse divpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xce80200000000000ce80200000000000.*" \ + "verify xmm1 after reverse divpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xbff0000000000000bff0000000000000.*" \ + "verify xmm2 after reverse divpd" + +gdb_test "reverse-step" "cvtpd2dq.*" "reverse-step to cvtpd2dq" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \ + "verify xmm0 after reverse cvtpd2ps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0xce80200000000000ce80200000000000.*" \ + "verify xmm1 after reverse cvtpd2ps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xbff0000000000000bff0000000000000.*" \ + "verify xmm2 after reverse cvtpd2ps" + +gdb_test "reverse-step" "cvtdq2ps.*" "reverse-step to cvtdq2ps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \ + "verify xmm0 after reverse cvtpd2dq" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \ + "verify xmm1 after reverse cvtpd2dq" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xbff0000000000000bff0000000000000.*" \ + "verify xmm2 after reverse cvtpd2dq" + +gdb_test "reverse-step" "cvtdq2pd.*" "reverse-step to cvtdq2pd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \ + "verify xmm0 after reverse cvtdq2ps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \ + "verify xmm1 after reverse cvtdq2ps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xffffffffffffffffffffffff00000000.*" \ + "verify xmm2 after reverse cvtdq2ps" + +gdb_test "reverse-step" "comiss.*" "reverse-step to comiss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \ + "verify xmm0 after reverse cvtdq2pd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \ + "verify xmm1 after reverse cvtdq2pd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xffffffffffffffffffffffff00000000.*" \ + "verify xmm2 after reverse cvtdq2pd" + +gdb_test "reverse-step" "comisd.*" "reverse-step to comisd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \ + "verify xmm0 after reverse comiss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \ + "verify xmm1 after reverse comiss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xffffffffffffffffffffffff00000000.*" \ + "verify xmm2 after reverse comiss" + +gdb_test "reverse-step" "cmpss.*" "reverse-step to cmpss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse comisd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \ + "verify xmm1 after reverse comisd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xffffffffffffffffffffffff00000000.*" \ + "verify xmm2 after reverse comisd" + +gdb_test "reverse-step" "cmpsd.*" "reverse-step to cmpsd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse cmpss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \ + "verify xmm1 after reverse cmpss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0xffffffffffffffffffffffff00000000.*" \ + "verify xmm2 after reverse cmpss" + +gdb_test "reverse-step" "cmpps.*" "reverse-step to cmpps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse cmpsd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \ + "verify xmm1 after reverse cmpsd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \ + "verify xmm2 after reverse cmpsd" + +gdb_test "reverse-step" "cmppd.*" "reverse-step to cmppd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse cmpps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \ + "verify xmm1 after reverse cmpps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \ + "verify xmm2 after reverse cmpps" + +gdb_test "reverse-step" "andps.*" "reverse-step to andps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse cmppd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19182726252400000000.*" \ + "verify xmm1 after reverse cmppd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \ + "verify xmm2 after reverse cmppd" + +gdb_test "reverse-step" "andpd.*" "reverse-step to andpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse andps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19182726252400000000.*" \ + "verify xmm1 after reverse andps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse andps" + +gdb_test "reverse-step" "addsubps.*" "reverse-step to addsubps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse andpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19182726252423222120.*" \ + "verify xmm1 after reverse andpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse andpd" + +gdb_test "reverse-step" "addsubpd.*" "reverse-step to addsubpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \ + "verify xmm0 after reverse addsubps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19182726252423222120.*" \ + "verify xmm1 after reverse addsubps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse addsubps" + +gdb_test "reverse-step" "addss.*" "reverse-step to addss" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \ + "verify xmm0 after reverse addsubpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19182726252423222120.*" \ + "verify xmm1 after reverse addsubpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse addsubpd" + +gdb_test "reverse-step" "addsd.*" "reverse-step to addsd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \ + "verify xmm0 after reverse addss" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse addss" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse addss" + +gdb_test "reverse-step" "addps.*" "reverse-step to addps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \ + "verify xmm0 after reverse addsd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse addsd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse addsd" + +gdb_test "reverse-step" "addpd.*" "reverse-step to addpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \ + "verify xmm0 after reverse addps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse addps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse addps" + + +#sse4_test + +send_gdb "continue\n" + +gdb_test "break $end_sse4_test" \ + "Breakpoint $decimal at .* line $end_sse4_test\." \ + "set breakpoint at end of sse4_test" + +send_gdb "continue\n" +gdb_expect { + -re " end sse4_test .*" { + pass "continue to end of sse4_test" + } + -re " Illegal instruction.*" { + untested i386-sse4-reverse + return -1 + } +} + +gdb_test "reverse-step" "blendvps.*" "reverse-step to blendvps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \ + "verify xmm0 at end of sse4_test" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 at end of sse4_test" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 at end of sse4_test" + +gdb_test "reverse-step" "blendvpd.*" "reverse-step to blendvpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \ + "verify xmm0 after reverse blendvps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse blendvps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse blendvps" + +gdb_test "reverse-step" "blendps.*" "reverse-step to blendps" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09081716151413121110.*" \ + "verify xmm0 after reverse blendvpd" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse blendvpd" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse blendvpd" + +gdb_test "reverse-step" "blendpd.*" "reverse-step to blendpd" + +gdb_test "info register xmm0" \ + "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \ + "verify xmm0 after reverse blendps" + +gdb_test "info register xmm1" \ + "xmm1 .*uint128 = 0x1f1e1d1c1b1a19181716151413121110.*" \ + "verify xmm1 after reverse blendps" + +gdb_test "info register xmm2" \ + "xmm2 .*uint128 = 0x2f2e2d2c2b2a29282726252423222120.*" \ + "verify xmm2 after reverse blendps" Index: until-reverse.c =================================================================== --- until-reverse.c (nonexistent) +++ until-reverse.c (revision 513) @@ -0,0 +1,145 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +#ifdef vxworks + +# include + +/* VxWorks does not supply atoi. */ +static int +atoi (z) + char *z; +{ + int i = 0; + + while (*z >= '0' && *z <= '9') + i = i * 10 + (*z++ - '0'); + return i; +} + +/* I don't know of any way to pass an array to VxWorks. This function + can be called directly from gdb. */ + +vxmain (arg) +char *arg; +{ + char *argv[2]; + + argv[0] = ""; + argv[1] = arg; + main (2, argv, (char **) 0); +} + +#else /* ! vxworks */ +# include +# include +#endif /* ! vxworks */ + +#ifdef PROTOTYPES +extern int marker1 (void); +extern int marker2 (int a); +extern void marker3 (char *a, char *b); +extern void marker4 (long d); +#else +extern int marker1 (); +extern int marker2 (); +extern void marker3 (); +extern void marker4 (); +#endif + +/* + * This simple classical example of recursion is useful for + * testing stack backtraces and such. + */ + +#ifdef PROTOTYPES +int factorial(int); + +int +main (int argc, char **argv, char **envp) +#else +int +main (argc, argv, envp) +int argc; +char *argv[], **envp; +#endif +{ +#ifdef usestubs + set_debug_traps(); /* set breakpoint 5 here */ + breakpoint(); +#endif + if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ + fprintf (stderr, "usage: factorial \n"); + return 1; + } + printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ + /* set breakpoint 12 here */ + marker1 (); /* set breakpoint 11 here */ + marker2 (43); /* set breakpoint 20 here */ + marker3 ("stack", "trace"); /* set breakpoint 21 here */ + marker4 (177601976L); + /* We're used by a test that requires malloc, so make sure it is + in the executable. */ + (void)malloc (1); + + argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ + return argc; /* set breakpoint 10 here */ +} /* set breakpoint 10a here */ + +#ifdef PROTOTYPES +int factorial (int value) +#else +int factorial (value) +int value; +#endif +{ + if (value > 1) { /* set breakpoint 7 here */ + value *= factorial (value - 1); + } + return (value); /* set breakpoint 19 here */ +} + +#ifdef PROTOTYPES +int multi_line_if_conditional (int a, int b, int c) +#else +int multi_line_if_conditional (a, b, c) + int a, b, c; +#endif +{ + if (a /* set breakpoint 3 here */ + && b + && c) + return 0; + else + return 1; +} + +#ifdef PROTOTYPES +int multi_line_while_conditional (int a, int b, int c) +#else +int multi_line_while_conditional (a, b, c) + int a, b, c; +#endif +{ + while (a /* set breakpoint 4 here */ + && b + && c) + { + a--, b--, c--; + } + return 0; +}
until-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: machinestate.c =================================================================== --- machinestate.c (nonexistent) +++ machinestate.c (revision 513) @@ -0,0 +1,101 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +/* + * Test restoration of machine state + */ + +extern void hide (int); + +/* Test register variable + Requires -- compiler honors 'register'. */ + +void +register_state (void) +{ + register int a = 0; + + hide (a); /* External function to defeat optimization. */ + a++; /* register_state: set breakpoint here */ + hide (a); /* register post-change */ +} + +/* Test auto variable (whatever that means). */ + +void +auto_state (void) +{ + auto int a = 0; + + hide (a); /* External function to defeat optimization. */ + a++; /* auto_state: set breakpoint here */ + hide (a); /* auto post-change */ +} + +/* Test function-static variable. */ + +void +function_static_state (void) +{ + static int a = 0; + + hide (a); /* External function to defeat optimization. */ + a++; /* function_static_state: set breakpoint here */ + hide (a); /* function static post-change */ +} + +/* Test module-static variable. */ + +static int astatic; + +void +module_static_state (void) +{ + astatic = 0; + + hide (astatic); /* External function to defeat optimization. */ + astatic++; /* module_static_state: set breakpoint here */ + hide (astatic); /* module static post-change */ +} + +/* Test module-global variable. */ + +int aglobal; + +void +module_global_state (void) +{ + aglobal = 0; + + hide (aglobal); /* External function to defeat optimization. */ + aglobal++; /* module_global_state: set breakpoint here */ + hide (aglobal); /* module global post-change */ +} + +/* main test driver */ + +int +main (int argc, char **argv) +{ + register_state (); /* begin main */ + auto_state (); + function_static_state (); + module_static_state (); + module_global_state (); + + return 0; /* end main */ +}
machinestate.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: break-reverse.exp =================================================================== --- break-reverse.exp (nonexistent) +++ break-reverse.exp (revision 513) @@ -0,0 +1,84 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests reverse debugging +# with breakpoints. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "break-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +set foo_location [gdb_get_line_number "break in foo" ] +set bar_location [gdb_get_line_number "break in bar" ] +set main_location [gdb_get_line_number "break in main"] +set end_location [gdb_get_line_number "end of main" ] + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +gdb_test "break foo" \ + "Breakpoint $decimal at .* line $foo_location\." \ + "set breakpoint on foo" + +gdb_test "break bar" \ + "Breakpoint $decimal at .* line $bar_location\." \ + "set breakpoint on bar" + +gdb_test "break $end_location" \ + "Breakpoint $decimal at .* line $end_location\." \ + set breakpoint at end of main" + +gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" +gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" +gdb_continue_to_breakpoint "end" ".*/$srcfile:$end_location.*" + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +gdb_continue_to_breakpoint "bar backward" ".*/$srcfile:$bar_location.*" +gdb_continue_to_breakpoint "foo backward" ".*/$srcfile:$foo_location.*" + +gdb_test_multiple "continue" "main backward" { + -re ".*Breakpoint $decimal,.*/$srcfile:$main_location.*$gdb_prompt $" { + pass "main backward" + } + -re "No more reverse-execution history.* break in main .*$gdb_prompt $" { + pass "main backward" + } +} + +gdb_test_no_output "set exec-direction forward" "set forward" + +gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*" +gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*" + +gdb_test_multiple "continue" "end of record log" { + -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" { + pass "end of record log" + } + -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + pass "end of record log" + } +} Index: consecutive-precsave.exp =================================================================== --- consecutive-precsave.exp (nonexistent) +++ consecutive-precsave.exp (revision 513) @@ -0,0 +1,117 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests stepping over +# consecutive instructions in a process record logfile. + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "consecutive-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +set end_location [gdb_get_line_number "end of main" ] +gdb_test "break $end_location" \ + "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ + "BP at end of main" + +gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" + +gdb_test "record save consecutive.precsave" \ + "Saved core file consecutive.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 consecutive.precsave" \ + "Program terminated with signal .*" \ + "reload precord save file" + +gdb_breakpoint foo +gdb_test "continue" "Breakpoint $decimal, foo .*" \ + "continue to breakpoint in foo" + +set foo1_addr 0 +set foo2_addr 0 +set stop_addr 0 + +gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" { + global hex + global foo1_addr + global foo2_addr + global gdb_prompt + + -re "=> ($hex).*\[\r\n\]+ ($hex).*$gdb_prompt $" { + set foo1_addr $expect_out(1,string) + set foo2_addr $expect_out(2,string) + pass "get breakpoint address for foo" + } +} + +gdb_test "break \*$foo2_addr" "Breakpoint $decimal at $foo2_addr: file .*" \ + "set bp, 2nd instr" + +set testmsg "stopped at bp, 2nd instr" +gdb_test_multiple "step" $testmsg { + -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" { + set stop_addr $expect_out(1,string) + if [eval expr "$foo2_addr == $stop_addr"] then { + pass "stopped at bp, 2nd instr" + } else { + fail "stopped at bp, 2nd instr (wrong address)" + } + } +} + +### +### +### + +# Set reverse execution direction + +gdb_test_no_output "set exec-dir reverse" "set reverse execution" + +# Now step backward and hope to hit the first breakpoint. + +set test_msg "stopped at bp in reverse, 1st instr" +gdb_test_multiple "step" "$test_msg" { + -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" { + set stop_addr $expect_out(1,string) + if [eval expr "$foo1_addr == $stop_addr"] then { + pass "$test_msg" + } else { + fail "$test_msg (wrong address)" + } + } + -re "Breakpoint $decimal, foo.*$gdb_prompt $" { + gdb_test "print \$pc == $foo1_addr" \ + "$decimal = 1" \ + "$test_msg" + } +} Index: until-precsave.exp =================================================================== --- until-precsave.exp (nonexistent) +++ until-precsave.exp (revision 513) @@ -0,0 +1,144 @@ +# Copyright 2008, 2009, 2010 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 . */ + +# This file is part of the GDB testsuite. It tests 'until' and +# 'advance' in precord logfile. + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + 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_no_output "record" "Turn on process record" +} + +set end_of_main [gdb_get_line_number "set breakpoint 10a here" ] +gdb_test "break $end_of_main" \ + "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ + "BP at end of main" + +gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main" + +gdb_test "record save until.precsave" \ + "Saved core file until.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 until.precsave" \ + "Program terminated with signal .*" \ + "reload core file" + +# Verify that plain vanilla "until " 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 + +gdb_test_no_output "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" Index: i386-reverse.exp =================================================================== --- i386-reverse.exp (nonexistent) +++ i386-reverse.exp (revision 513) @@ -0,0 +1,285 @@ +# Copyright 2009, 2010 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 . + +# 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 +} + + +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_no_output "record" "Turn on process record" +} + +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" + + Index: watch-reverse.c =================================================================== --- watch-reverse.c (nonexistent) +++ watch-reverse.c (revision 513) @@ -0,0 +1,219 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +#include +#include +/* + * Since using watchpoints can be very slow, we have to take some pains to + * ensure that we don't run too long with them enabled or we run the risk + * of having the test timeout. To help avoid this, we insert some marker + * functions in the execution stream so we can set breakpoints at known + * locations, without worrying about invalidating line numbers by changing + * this file. We use null bodied functions are markers since gdb does + * not support breakpoints at labeled text points at this time. + * + * One place we need is a marker for when we start executing our tests + * instructions rather than any process startup code, so we insert one + * right after entering main(). Another is right before we finish, before + * we start executing any process termination code. + * + * Another problem we have to guard against, at least for the test + * suite, is that we need to ensure that the line that causes the + * watchpoint to be hit is still the current line when gdb notices + * the hit. Depending upon the specific code generated by the compiler, + * the instruction after the one that triggers the hit may be part of + * the same line or part of the next line. Thus we ensure that there + * are always some instructions to execute on the same line after the + * code that should trigger the hit. + */ + +int count = -1; +int ival1 = -1; +int ival2 = -1; +int ival3 = -1; +int ival4 = -1; +int ival5 = -1; +char buf[10]; +struct foo +{ + int val; +}; +struct foo struct1, struct2, *ptr1, *ptr2; + +int doread = 0; + +char *global_ptr; + +void marker1 () +{ +} + +void marker2 () +{ +} + +void marker4 () +{ +} + +void marker5 () +{ +} + +void marker6 () +{ +} + +#ifdef PROTOTYPES +void recurser (int x) +#else +void recurser (x) int x; +#endif +{ + int local_x; + + if (x > 0) + recurser (x-1); + local_x = x; +} + +void +func2 () +{ + int local_a; + static int static_b; + + ival5++; + local_a = ival5; + static_b = local_a; +} + +void +func3 () +{ + int x; + int y; + + x = 0; + x = 1; /* second x assignment */ + y = 1; + y = 2; +} + +int +func1 () +{ + /* The point of this is that we will set a breakpoint at this call. + + Then, if DECR_PC_AFTER_BREAK equals the size of a function call + instruction (true on a sun3 if this is gcc-compiled--FIXME we + should use asm() to make it work for any compiler, present or + future), then we will end up branching to the location just after + the breakpoint. And we better not confuse that with hitting the + breakpoint. */ + func2 (); + return 73; +} + +void +func4 () +{ + buf[0] = 3; + global_ptr = buf; + buf[0] = 7; +} + +int main () +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + struct1.val = 1; + struct2.val = 2; + ptr1 = &struct1; + ptr2 = &struct2; + marker1 (); + func1 (); + for (count = 0; count < 4; count++) { + ival1 = count; + ival3 = count; ival4 = count; + } + ival1 = count; /* Outside loop */ + ival2 = count; + ival3 = count; ival4 = count; + marker2 (); + if (doread) + { + static char msg[] = "type stuff for buf now:"; + write (1, msg, sizeof (msg) - 1); + read (0, &buf[0], 5); + } + marker4 (); + + /* We have a watchpoint on ptr1->val. It should be triggered if + ptr1's value changes. */ + ptr1 = ptr2; + + /* This should not trigger the watchpoint. If it does, then we + used the wrong value chain to re-insert the watchpoints or we + are not evaluating the watchpoint expression correctly. */ + struct1.val = 5; + marker5 (); + + /* We have a watchpoint on ptr1->val. It should be triggered if + ptr1's value changes. */ + ptr1 = ptr2; + + /* This should not trigger the watchpoint. If it does, then we + used the wrong value chain to re-insert the watchpoints or we + are not evaluating the watchpoint expression correctly. */ + struct1.val = 5; + marker5 (); + + /* We're going to watch locals of func2, to see that out-of-scope + watchpoints are detected and properly deleted. + */ + marker6 (); + + /* This invocation is used for watches of a single + local variable. */ + func2 (); + + /* This invocation is used for watches of an expression + involving a local variable. */ + func2 (); + + /* This invocation is used for watches of a static + (non-stack-based) local variable. */ + func2 (); + + /* This invocation is used for watches of a local variable + when recursion happens. + */ + marker6 (); + recurser (2); + + marker6 (); + + func3 (); + + func4 (); + + return 0; +} /* end of main */ +
watch-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i387-stack-reverse.exp =================================================================== --- i387-stack-reverse.exp (nonexistent) +++ i387-stack-reverse.exp (revision 513) @@ -0,0 +1,175 @@ +# Copyright 2009, 2010 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 . + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + + +if ![istarget "i?86-*linux*"] then { + verbose "Skipping i387 reverse float tests." + return +} + +set testfile "i387-stack-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 i387-float-reverse + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +runto main + +# Record to end of main + +set location [gdb_get_line_number "END I387-FLOAT-REVERSE"] +gdb_test_no_output "record" "Turn on process record" +gdb_test "until $location" ".*/$srcfile:$location.*" \ + "record to end of main" + +# Now rewind to beginning so we can begin testing. + +set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"] +gdb_test_no_output "set exec-dir reverse" "set reverse direction" +gdb_test "until $location" ".*/$srcfile:$location.*" \ + "rewind to beginning of main" +gdb_test_no_output "set exec-dir forward" "set forward direction" + +# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4, +# st5, st6, st7. We push 8 values to FPU stack in record mode +# and see whether all are getting recorded. + +set location [gdb_get_line_number "test st0 register"] +gdb_test "until $location" ".*/$srcfile:$location.*asm.*fld1.*" \ + "begin test st0" +gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1" +gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1" + + +gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" +gdb_test "info register st0" "st0 *3.32192.*\t.*" "verify st0 == 3.321928094*" +gdb_test "info register st1" "st1 *1\t.*" "verify st1 == 1" + +gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*" +gdb_test "info register st0" "st0 *1.44269.*\t.*" "verify st0 == 1.442695040*" +gdb_test "info register st1" "st1 *3.32192.*\t.*" "verify st1 == 3.3219280948*" +gdb_test "info register st2" "st2 *1\t.*" "verify st2 == 1" + +gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" +gdb_test "info register st0" "st0 *3.14159.*\t.*" "verify st0 == 3.14159265*" +gdb_test "info register st1" "st1 *1.44269.*\t.*" "verify st1 == 1.4426950*" +gdb_test "info register st2" "st2 *3.32192.*\t.*" "verify st2 == 3.3219280*" +gdb_test "info register st3" "st3 *1\t.*" "verify st3 == 1" + +gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*" +gdb_test "info register st0" "st0 *0.30102.*\t.*" "verify st0 == 0.301029*" +gdb_test "info register st1" "st1 *3.14159.*\t.*" "verify st1 == 3.14159265*" +gdb_test "info register st2" "st2 *1.44269.*\t.*" "verify st2 == 1.44269506*" +gdb_test "info register st3" "st3 *3.32192.*\t.*" "verify st3 == 3.3219280948*" +gdb_test "info register st4" "st4 *1\t.*" "verify st4 == 1" + +gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*" +gdb_test "info register st0" "st0 *0.69314.*\t.*" "verify st0 == 0.69314*" +gdb_test "info register st1" "st1 *0.30102.*\t.*" "verify st1 == 0.301029*" +gdb_test "info register st2" "st2 *3.14159.*\t.*" "verify st2 == 3.14159265*" +gdb_test "info register st3" "st3 *1.44269.*\t.*" "verify st3 == 1.442695040*" +gdb_test "info register st4" "st4 *3.32192.*\t.*" "verify st4 == 3.3219280948*" +gdb_test "info register st5" "st5 *1\t.*" "verify st5 == 1" + +gdb_test "stepi" "asm.*fld1.*" "push st0 == 0" +gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0" +gdb_test "info register st1" "st1 *0.69314.*\t.*" "verify st1 == 0.69314*" +gdb_test "info register st2" "st2 *0.30102.*\t.*" "verify st2 == 0.301029*" +gdb_test "info register st3" "st3 *3.14159.*\t.*" "verify st3 == 3.14159265*" +gdb_test "info register st4" "st4 *1.44269.*\t.*" "verify st4 == 1.442695040*" +gdb_test "info register st5" "st5 *3.32192.*\t.*" "verify st5 == 3.32192809*" +gdb_test "info register st6" "st6 *1\t.*" "verify st6 == 1" + +gdb_test "stepi" "asm.*nop.*" "push st0 == 0" +gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1" +gdb_test "info register st1" "st1 *0\t.*" "verify st1 == 0" +gdb_test "info register st2" "st2 *0.69314.*\t.*" "verify st2 == 0.69314*" +gdb_test "info register st3" "st3 *0.30102.*\t.*" "verify st3 == 0.301029*" +gdb_test "info register st4" "st4 *3.14159.*\t.*" "verify st4 == 3.14159265*" +gdb_test "info register st5" "st5 *1.44269.*\t.*" "verify st5 == 1.44269504*" +gdb_test "info register st6" "st6 *3.32192.*\t.*" "verify st6 == 3.3219280948*" +gdb_test "info register st7" "st7 *1.*" "verify st7 == 1" + +# Now step backward, and check that st0 value reverts to zero. + +gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7" +gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0" +gdb_test "info register st1" "st1 *0.69314.*\t.*" "verify st1 == 0.69314*" +gdb_test "info register st2" "st2 *0.30102.*\t.*" "verify st2 == 0.301029*" +gdb_test "info register st3" "st3 *3.14159.*\t.*" "verify st3 == 3.14159265*" +gdb_test "info register st4" "st4 *1.44269.*\t.*" "verify st4 == 1.442695040*" +gdb_test "info register st5" "st5 *3.32192.*\t.*" "verify st5 == 3.3219280948*" +gdb_test "info register st6" "st6 *1\t.*" "verify st6 == 1" + +gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*" +gdb_test "info register st0" "st0 *0.69314.*\t.*" "verify st0 == 0.69314*" +gdb_test "info register st1" "st1 *0.30102.*\t.*" "verify st1 == 0.301029*" +gdb_test "info register st2" "st2 *3.14159.*\t.*" "verify st2 == 3.14159265*" +gdb_test "info register st3" "st3 *1.44269.*\t.*" "verify st3 == 1.442695040*" +gdb_test "info register st4" "st4 *3.32192.*\t.*" "verify st4 == 3.3219280948*" +gdb_test "info register st5" "st5 *1\t.*" "verify st5 == 1" + +gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*" +gdb_test "info register st0" "st0 *0.30102.*\t.*" "verify st0 == 0.301029*" +gdb_test "info register st1" "st1 *3.14159.*\t.*" "verify st1 == 3.14159265*" +gdb_test "info register st2" "st2 *1.44269.*\t.*" "verify st2 == 1.442695040*" +gdb_test "info register st3" "st3 *3.32192.*\t.*" "verify st3 == 3.3219280948*" +gdb_test "info register st4" "st4 *1\t.*" "verify st4 == 1" + +gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" +gdb_test "info register st0" "st0 *3.14159.*\t.*" "verify st0 == 3.14159265*" +gdb_test "info register st1" "st1 *1.44269.*\t.*" "verify st1 == 1.442695040*" +gdb_test "info register st2" "st2 *3.32192.*\t.*" "verify st2 == 3.3219280948*" +gdb_test "info register st3" "st3 *1\t.*" "verify st3 == 1" + +gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*" +gdb_test "info register st0" "st0 *1.44269.*\t.*" "verify st0 == 1.442695040*" +gdb_test "info register st1" "st1 *3.32192.*\t.*" "verify st1 == 3.3219280948*" +gdb_test "info register st2" "st2 *1\t.*" "verify st2 == 1" + + +gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" +gdb_test "info register st0" "st0 *3.32192.*\t.*" "verify st0 == 3.3219280948*" +gdb_test "info register st1" "st1 *1\t.*" "verify st1 == 1" + +gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1" +gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1" + + + + + Index: solib-reverse.c =================================================================== --- solib-reverse.c (nonexistent) +++ solib-reverse.c (revision 513) @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009, 2010 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 . */ + +/* Test reverse debugging of shared libraries. */ + +#include + +/* Shared library function */ +extern int shr2(int); + +int main () +{ + char* cptr = "String 1"; + int b[2] = {5,8}; + + b[0] = shr2(12); /* begin part two */ + b[1] = shr2(17); /* middle part two */ + + b[0] = 6; b[1] = 9; /* generic statement, end part two */ + printf ("message 1\n"); /* printf one */ + printf ("message 2\n"); /* printf two */ + printf ("message 3\n"); /* printf three */ + sleep (0); /* sleep one */ + sleep (0); /* sleep two */ + sleep (0); /* sleep three */ + + return 0; /* end part one */ +} /* end of main */ +
solib-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: finish-reverse.c =================================================================== --- finish-reverse.c (nonexistent) +++ finish-reverse.c (revision 513) @@ -0,0 +1,128 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +/* Test gdb's "return" command in reverse. */ + +int void_test = 0; +int main_test = 0; + +char char_returnval = '1'; +short short_returnval = 1; +int int_returnval = 1; +long long_returnval = 1; +long long long_long_returnval = 1; +float float_returnval = 1; +double double_returnval = 1; + +union { + char char_testval; + short short_testval; + int int_testval; + long long_testval; + long long long_long_testval; + float float_testval; + double double_testval; + char ffff[80]; +} testval; + +void void_func () +{ + void_test = 1; /* VOID FUNC */ +} + +char char_func () +{ + return char_returnval; /* CHAR FUNC */ +} + +short short_func () +{ + return short_returnval; /* SHORT FUNC */ +} + +int int_func () +{ + return int_returnval; /* INT FUNC */ +} + +long long_func () +{ + return long_returnval; /* LONG FUNC */ +} + +long long long_long_func () +{ + return long_long_returnval; /* LONG LONG FUNC */ +} + +float float_func () +{ + return float_returnval; /* FLOAT FUNC */ +} + +double double_func () +{ + return double_returnval; /* DOUBLE FUNC */ +} + +int main (int argc, char **argv) +{ + char char_resultval; + short short_resultval; + int int_resultval; + long long_resultval; + long long long_long_resultval; + float float_resultval; + double double_resultval; + int i; + + /* A "test load" that will insure that the function really returns + a ${type} (as opposed to just a truncated or part of a ${type}). */ + for (i = 0; i < sizeof (testval.ffff); i++) + testval.ffff[i] = 0xff; + + void_func (); /* call to void_func */ + char_resultval = char_func (); /* void_checkpoint */ + short_resultval = short_func (); /* char_checkpoint */ + int_resultval = int_func (); /* short_checkpoint */ + long_resultval = long_func (); /* int_checkpoint */ + long_long_resultval = long_long_func (); /* long_checkpoint */ + + /* On machines using IEEE floating point, the test pattern of all + 1-bits established above turns out to be a floating-point NaN + ("Not a Number"). According to the IEEE rules, NaN's aren't even + equal to themselves. This can lead to stupid conversations with + GDB like: + + (gdb) p testval.float_testval == testval.float_testval + $7 = 0 + (gdb) + + This is the correct answer, but it's not the sort of thing + return2.exp wants to see. So to make things work the way they + ought, we'll set aside the `union' cleverness and initialize the + test values explicitly here. These values have interesting bits + throughout the value, so we'll still detect truncated values. */ + + testval.float_testval = 2.7182818284590452354;/* long_long_checkpoint */ + float_resultval = float_func (); + testval.double_testval = 3.14159265358979323846; /* float_checkpoint */ + double_resultval = double_func (); + main_test = 1; /* double_checkpoint */ + return 0; +} /* end of main */ +
finish-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-sse-reverse.c =================================================================== --- i386-sse-reverse.c (nonexistent) +++ i386-sse-reverse.c (revision 513) @@ -0,0 +1,101 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009, 2010 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 . */ + +/* Architecture tests for intel i386 platform. */ + +void +sse_test (void) +{ + char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15}; + char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31}; + char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47}; + + asm ("movupd %0, %%xmm0":"=m"(buf0)); + asm ("movupd %0, %%xmm1":"=m"(buf1)); + asm ("movupd %0, %%xmm2":"=m"(buf2)); + + asm ("addpd %xmm0, %xmm1"); + asm ("addps %xmm1, %xmm2"); + asm ("addsd %xmm2, %xmm1"); + asm ("addss %xmm1, %xmm0"); + asm ("addsubpd %xmm0, %xmm2"); + asm ("addsubps %xmm0, %xmm1"); + asm ("andpd %xmm1, %xmm2"); + asm ("andps %xmm2, %xmm1"); + asm ("cmppd $3, %xmm0, %xmm1"); + asm ("cmpps $4, %xmm1, %xmm2"); + asm ("cmpsd $5, %xmm2, %xmm1"); + asm ("cmpss $6, %xmm1, %xmm0"); + asm ("comisd %xmm0, %xmm2"); + asm ("comiss %xmm0, %xmm1"); + asm ("cvtdq2pd %xmm1, %xmm2"); + asm ("cvtdq2ps %xmm2, %xmm1"); + asm ("cvtpd2dq %xmm1, %xmm0"); + asm ("cvtpd2ps %xmm0, %xmm1"); + asm ("divpd %xmm1, %xmm2"); + asm ("divps %xmm2, %xmm1"); + asm ("divsd %xmm1, %xmm0"); + asm ("divss %xmm0, %xmm2"); + asm ("mulpd %xmm0, %xmm1"); + asm ("mulps %xmm1, %xmm2"); + asm ("mulsd %xmm2, %xmm1"); + asm ("mulss %xmm1, %xmm0"); + asm ("orpd %xmm2, %xmm0"); + asm ("orps %xmm0, %xmm1"); + asm ("pabsb %xmm1, %xmm2"); + asm ("pabsw %xmm2, %xmm1"); + asm ("pabsd %xmm1, %xmm0"); + asm ("packsswb %xmm0, %xmm2"); + asm ("packssdw %xmm0, %xmm1"); + asm ("ucomisd %xmm1, %xmm2"); + asm ("ucomiss %xmm2, %xmm1"); + asm ("unpckhpd %xmm1, %xmm0"); + asm ("unpckhps %xmm2, %xmm0"); + asm ("xorpd %xmm0, %xmm1"); + asm ("xorps %xmm1, %xmm2"); +} /* end sse_test */ + +void +sse4_test (void) +{ + char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15}; + char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31}; + char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47}; + + asm ("movupd %0, %%xmm0":"=m"(buf0)); + asm ("movupd %0, %%xmm1":"=m"(buf1)); + asm ("movupd %0, %%xmm2":"=m"(buf2)); + + asm ("blendpd $1, %xmm1, %xmm0"); + asm ("blendps $2, %xmm2, %xmm0"); + asm ("blendvpd %xmm0, %xmm1, %xmm2"); + asm ("blendvps %xmm0, %xmm2, %xmm1"); +} /* end sse4_test */ + +int +main () +{ + sse_test (); + sse4_test (); + return 0; /* end of main */ +}
i386-sse-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Makefile =================================================================== --- Makefile (nonexistent) +++ Makefile (revision 513) @@ -0,0 +1,19 @@ + +srcdir = . + +EXECUTABLES = break-reverse consecutive-reverse finish-reverse \ + machinestate solib-reverse step-reverse until-reverse \ + watch-reverse i386-reverse + +MISCELLANEOUS = + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + rm -f *~ *.o *.x *.ci *.sl a.out core + rm -f $(EXECUTABLES) $(MISCELLANEOUS) + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status config.log site.* +
Makefile Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: break-reverse.c =================================================================== --- break-reverse.c (nonexistent) +++ break-reverse.c (revision 513) @@ -0,0 +1,37 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +int xyz; + +int bar () +{ + xyz = 2; /* break in bar */ + return 1; +} + +int foo () +{ + xyz = 1; /* break in foo */ + return bar (); +} + +int main () +{ + xyz = 0; /* break in main */ + foo (); + return (xyz == 2 ? 0 : 1); +} /* end of main */
break-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: step-reverse.exp =================================================================== --- step-reverse.exp (nonexistent) +++ step-reverse.exp (revision 513) @@ -0,0 +1,252 @@ +# Copyright 2008, 2009, 2010 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 . */ + +# This file is part of the GDB testsuite. It tests reverse stepping. +# Lots of code borrowed from "step-test.exp". + +# +# Test step and next in reverse +# + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "step-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +# plain vanilla step/next (no count) + +gdb_test "next" ".*NEXT TEST 1.*" "next test 1" +gdb_test "step" ".*STEP TEST 1.*" "step test 1" + +# step/next with count + +gdb_test "next 2" ".*NEXT TEST 2.*" "next test 2" +gdb_test "step 3" ".*STEP TEST 2.*" "step test 2" + +# step over call + +gdb_test "step" ".*NEXT OVER THIS CALL.*" "step up to call" +gdb_test "next" ".*STEP INTO THIS CALL.*" "next over call" + +# step into call + +gdb_test "step" ".*ARRIVED IN CALLEE.*" "step into call" + +# finish out of call + +set test_message "finish out of fn call" +gdb_test_multiple "finish" "$test_message" { + -re "FINISH TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + send_gdb "step\n" + exp_continue + } +} + +# stepi over flat code (no calls) + +set test_message "simple stepi" +gdb_test_multiple "stepi" "$test_message" { + -re "STEPI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "FINISH TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi into a function call + +set test_message "stepi into function call" +gdb_test_multiple "stepi" "$test_message" { + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } +} + +# stepi thru return of a function call + +set test_message "stepi back from function call" +gdb_test_multiple "stepi" "$test_message" { + -re "NEXTI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "ENTER CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +### +### +### + +# Set reverse execution direction + +gdb_test_no_output "set exec-dir reverse" "set reverse execution" + +# stepi backward thru return and into a function + +set stepi_location [gdb_get_line_number "ARRIVED IN CALLEE" "$srcfile"] +set test_message "reverse stepi thru function return" +gdb_test_multiple "stepi" "$test_message" { + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "$hex\[ \t\]*$stepi_location.*ARRIVED IN CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "STEPI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi backward out of a function call + +set stepi_location [gdb_get_line_number "STEPI TEST" "$srcfile"] +set test_message "reverse stepi from a function call" +gdb_test_multiple "stepi" "$test_message" { + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi backward over flat code (no calls) + +set stepi_location [gdb_get_line_number "FINISH TEST" "$srcfile"] +set test_message "simple reverse stepi" +gdb_test_multiple "stepi" "$test_message" { + -re "STEPI TEST.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "$hex\[ \t\]*$stepi_location.* FINISH TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "$stepi_location.* FINISH TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# step backward into function (thru return) + +set test_message "reverse step into fn call" +gdb_test_multiple "step" "$test_message" { + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "step\n" + exp_continue + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } +} + +# step backward out of called function (thru call) + +gdb_test "step" ".*STEP INTO THIS CALL.*" "reverse step out of called fn" + +# next backward over call + +gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call" + +# step/next backward with count + +gdb_test "step 3" ".*REVERSE STEP TEST 1.*" "reverse step test 1" +gdb_test "next 2" ".*REVERSE NEXT TEST 1.*" "reverse next test 1" + +# step/next backward without count + +gdb_test "step" ".*STEP TEST 1.*" "reverse step test 2" +gdb_test "next" ".*NEXT TEST 1.*" "reverse next test 2" + + + +# Finish test by running forward to the end. +# FIXME return to this later... +# gdb_test_no_output "set exec-dir forward" "set forward execution" +# gdb_continue_to_end "step-reverse.exp" + Index: sigall-reverse.exp =================================================================== --- sigall-reverse.exp (nonexistent) +++ sigall-reverse.exp (revision 513) @@ -0,0 +1,410 @@ +# Copyright 2009, 2010 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 . + +if [target_info exists gdb,nosignals] { + verbose "Skipping sigall-reverse.exp because of nosignals." + return +} + +if ![target_info exists gdb,can_reverse] { + return +} + +if $tracelevel then { + strace $tracelevel +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +set testfile sigall-reverse +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested sigall.exp + return -1 +} + +# Make the first signal SIGABRT because it is always supported. +set sig_supported 1 +set thissig "ABRT" + +proc test_one_sig {nextsig} { + global sig_supported + global gdb_prompt + global thissig + + set this_sig_supported $sig_supported + gdb_test "handle SIG$thissig stop print" \ + "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" + gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*" + gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*" + + set need_another_continue 1 + set missed_handler 0 + if $this_sig_supported then { + if { $thissig == "IO" } { + setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" + } + set testmsg "get signal $thissig" + gdb_test_multiple "continue" $testmsg { + -re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" { + fail "$testmsg (wrong location)" + } + -re "Program received signal SIG$thissig.*$gdb_prompt $" { + pass $testmsg + } + -re "Breakpoint.* handle_$thissig.*$gdb_prompt $" { + xfail $testmsg + set need_another_continue 0 + } + } + } + if [ istarget "alpha-dec-osf3*" ] then { + # OSF/1-3.x is unable to continue with a job control stop signal. + # The inferior remains stopped without an event of interest + # and GDB waits forever for the inferior to stop on an event + # of interest. Work around the kernel bug. + if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } { + setup_xfail "alpha-dec-osf3*" + fail "cannot continue from signal $thissig" + set need_another_continue 0 + } + } + + if $need_another_continue then { + if { $thissig == "URG" } { + setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" + } + # Either Lynx or GDB screws up on SIGPRIO + if { $thissig == "PRIO" } { + setup_xfail "*-*-*lynx*" + } + set testmsg "send signal $thissig" + gdb_test_multiple "continue" $testmsg { + -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" { + pass $testmsg + } + -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { + fail "missed breakpoint at handle_$thissig" + set missed_handler 1 + } + } + } + + if { $missed_handler == "0" } then { + set testmsg "advance to $nextsig" + gdb_test_multiple "signal 0" $testmsg { + -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { + pass $testmsg + set sig_supported 1 + } + -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" { + pass $testmsg + set sig_supported 0 + } + } + } + set thissig $nextsig +} + +proc test_one_sig_reverse {prevsig} { + global gdb_prompt + + gdb_test "reverse-continue" "Breakpoint .* handle_$prevsig.*" \ + "reverse to handler of $prevsig" + + set saw_signal 0 + set testmsg "reverse to gen_$prevsig" + gdb_test_multiple "reverse-continue" $testmsg { + -re "Breakpoint.*handle_.*$gdb_prompt " { + pass "$testmsg (un-handled)" + } + -re "Program received signal SIG$prevsig.*$gdb_prompt " { + pass "reverse to signal event, $prevsig" + + set nested_testmsg "reverse signal delivered" + gdb_test_multiple "frame" $nested_testmsg { + -re ".*handle_$prevsig.*$gdb_prompt " { + fail "$nested_testmsg (wrong location)" + } + -re ".*$gdb_prompt " { + pass $nested_testmsg + } + } + + set saw_signal 1 + send_gdb "reverse-continue\n" + exp_continue + } + -re "Breakpoint.*kill.*$gdb_prompt " { + if { $saw_signal } then { + pass "$testmsg (handled)" + } else { + xfail "$testmsg (handled)" + } + } + -re "No more reverse-execution history.*kill.*$gdb_prompt " { + if { $saw_signal } then { + pass "$testmsg (handled)" + } else { + xfail "$testmsg (handled)" + } + } + } +} + +gdb_load $binfile + +runto gen_ABRT + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +test_one_sig HUP +test_one_sig QUIT +test_one_sig ILL +test_one_sig EMT +test_one_sig FPE +test_one_sig BUS +test_one_sig SEGV +test_one_sig SYS +test_one_sig PIPE +test_one_sig ALRM +test_one_sig URG +test_one_sig TSTP +test_one_sig CONT +test_one_sig CHLD +test_one_sig TTIN +test_one_sig TTOU +test_one_sig IO +test_one_sig XCPU +test_one_sig XFSZ +test_one_sig VTALRM +test_one_sig PROF +test_one_sig WINCH +test_one_sig LOST +test_one_sig USR1 +test_one_sig USR2 +test_one_sig PWR +test_one_sig POLL +test_one_sig WIND +test_one_sig PHONE +test_one_sig WAITING +test_one_sig LWP +test_one_sig DANGER +test_one_sig GRANT +test_one_sig RETRACT +test_one_sig MSG +test_one_sig SOUND +test_one_sig SAK +test_one_sig PRIO +test_one_sig 33 +test_one_sig 34 +test_one_sig 35 +test_one_sig 36 +test_one_sig 37 +test_one_sig 38 +test_one_sig 39 +test_one_sig 40 +test_one_sig 41 +test_one_sig 42 +test_one_sig 43 +test_one_sig 44 +test_one_sig 45 +test_one_sig 46 +test_one_sig 47 +test_one_sig 48 +test_one_sig 49 +test_one_sig 50 +test_one_sig 51 +test_one_sig 52 +test_one_sig 53 +test_one_sig 54 +test_one_sig 55 +test_one_sig 56 +test_one_sig 57 +test_one_sig 58 +test_one_sig 59 +test_one_sig 60 +test_one_sig 61 +test_one_sig 62 +test_one_sig 63 +test_one_sig TERM + +# The last signal (SIGTERM) gets handled slightly differently because +# we are not setting up for another test. +gdb_test "handle SIGTERM stop print" \ + "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" +gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*" +gdb_test "continue" \ + "Continuing.*Program received signal SIGTERM.*" \ + "get signal TERM" +gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM" + +gdb_test "continue" "\[process \[0-9\]+ .*" "continue to sigal exit" \ + "The next instruction is syscall exit_group.* program...y. or n. " \ + "yes" + +test_one_sig_reverse TERM +test_one_sig_reverse 63 +test_one_sig_reverse 62 +test_one_sig_reverse 61 +test_one_sig_reverse 60 +test_one_sig_reverse 59 +test_one_sig_reverse 58 +test_one_sig_reverse 57 +test_one_sig_reverse 56 +test_one_sig_reverse 55 +test_one_sig_reverse 54 +test_one_sig_reverse 53 +test_one_sig_reverse 52 +test_one_sig_reverse 51 +test_one_sig_reverse 50 +test_one_sig_reverse 49 +test_one_sig_reverse 48 +test_one_sig_reverse 47 +test_one_sig_reverse 46 +test_one_sig_reverse 45 +test_one_sig_reverse 44 +test_one_sig_reverse 43 +test_one_sig_reverse 42 +test_one_sig_reverse 41 +test_one_sig_reverse 40 +test_one_sig_reverse 39 +test_one_sig_reverse 38 +test_one_sig_reverse 37 +test_one_sig_reverse 36 +test_one_sig_reverse 35 +test_one_sig_reverse 34 +test_one_sig_reverse 33 +test_one_sig_reverse PRIO +test_one_sig_reverse SAK +test_one_sig_reverse SOUND +test_one_sig_reverse MSG +test_one_sig_reverse RETRACT +test_one_sig_reverse GRANT +test_one_sig_reverse DANGER +test_one_sig_reverse LWP +test_one_sig_reverse WAITING +test_one_sig_reverse PHONE +test_one_sig_reverse WIND +test_one_sig_reverse POLL +test_one_sig_reverse PWR +test_one_sig_reverse USR2 +test_one_sig_reverse USR1 +test_one_sig_reverse LOST +test_one_sig_reverse WINCH +test_one_sig_reverse PROF +test_one_sig_reverse VTALRM +test_one_sig_reverse XFSZ +test_one_sig_reverse XCPU +test_one_sig_reverse IO +test_one_sig_reverse TTOU +test_one_sig_reverse TTIN +test_one_sig_reverse CHLD +test_one_sig_reverse CONT +test_one_sig_reverse TSTP +test_one_sig_reverse URG +test_one_sig_reverse ALRM +test_one_sig_reverse PIPE +test_one_sig_reverse SYS +test_one_sig_reverse SEGV +test_one_sig_reverse BUS +test_one_sig_reverse FPE +test_one_sig_reverse EMT +test_one_sig_reverse ILL +test_one_sig_reverse QUIT +test_one_sig_reverse HUP +test_one_sig_reverse ABRT + +# Make the first signal SIGABRT because it is always supported. +set sig_supported 1 +set thissig "ABRT" + +test_one_sig HUP +test_one_sig QUIT +test_one_sig ILL +test_one_sig EMT +test_one_sig FPE +test_one_sig BUS +test_one_sig SEGV +test_one_sig SYS +test_one_sig PIPE +test_one_sig ALRM +test_one_sig URG +test_one_sig TSTP +test_one_sig CONT +test_one_sig CHLD +test_one_sig TTIN +test_one_sig TTOU +test_one_sig IO +test_one_sig XCPU +test_one_sig XFSZ +test_one_sig VTALRM +test_one_sig PROF +test_one_sig WINCH +test_one_sig LOST +test_one_sig USR1 +test_one_sig USR2 +test_one_sig PWR +test_one_sig POLL +test_one_sig WIND +test_one_sig PHONE +test_one_sig WAITING +test_one_sig LWP +test_one_sig DANGER +test_one_sig GRANT +test_one_sig RETRACT +test_one_sig MSG +test_one_sig SOUND +test_one_sig SAK +test_one_sig PRIO +test_one_sig 33 +test_one_sig 34 +test_one_sig 35 +test_one_sig 36 +test_one_sig 37 +test_one_sig 38 +test_one_sig 39 +test_one_sig 40 +test_one_sig 41 +test_one_sig 42 +test_one_sig 43 +test_one_sig 44 +test_one_sig 45 +test_one_sig 46 +test_one_sig 47 +test_one_sig 48 +test_one_sig 49 +test_one_sig 50 +test_one_sig 51 +test_one_sig 52 +test_one_sig 53 +test_one_sig 54 +test_one_sig 55 +test_one_sig 56 +test_one_sig 57 +test_one_sig 58 +test_one_sig 59 +test_one_sig 60 +test_one_sig 61 +test_one_sig 62 +test_one_sig 63 +test_one_sig TERM Index: i386-reverse.c =================================================================== --- i386-reverse.c (nonexistent) +++ i386-reverse.c (revision 513) @@ -0,0 +1,46 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009, 2010 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 . */ + +/* 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 */ +}
i386-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i387-env-reverse.exp =================================================================== --- i387-env-reverse.exp (nonexistent) +++ i387-env-reverse.exp (revision 513) @@ -0,0 +1,145 @@ +# Copyright 2009, 2010 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 . + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + + +if ![istarget "i?86-*linux*"] then { + verbose "Skipping i387 reverse float tests." + return +} + +set testfile "i387-env-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 i387-float-reverse + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +runto main + +# Record to end of main + +set location [gdb_get_line_number "END I387-FLOAT-REVERSE"] +gdb_test_no_output "record" "Turn on process record" +gdb_test "until $location" ".*/$srcfile:$location.*" \ + "record to end of main" + +# Now rewind to beginning so we can begin testing. + +set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"] +gdb_test_no_output "set exec-dir reverse" "set reverse direction" +gdb_test "until $location" ".*/$srcfile:$location.*" \ + "rewind to beginning of main" +gdb_test_no_output "set exec-dir forward" "set forward direction" + +# Test FPU env particularly ftag and fstatus reigters. + +set location [gdb_get_line_number "TEST ENV"] +gdb_test "until $location" ".*/$srcfile:$location.*asm.*nop.*" \ + "begin testing fpu env" + +gdb_test "n" "asm.*fsave.*" "save FPU env in memory" +gdb_test "n" "asm.*frstor.*" "restore FPU env" +gdb_test "n" "asm.*fstsw.*" "store status word in EAX" +gdb_test "n" "asm.*fld1.*" "push st0" + +gdb_test "info register eax" "eax *0x8040000.*\t.*" "verify eax == 0x8040000" +gdb_test "info register fstat" "fstat *0.*\t.*" "verify fstat == 0" +gdb_test "info register ftag" "ftag *0xffff.*\t.*" "verify ftag == 0xffff" + +gdb_test "stepi" "asm.*fldl2t.*" "push st0" +gdb_test "info register fstat" "fstat *0x3800.*\t.*" "verify fstat == 0x3800" +gdb_test "info register ftag" "ftag *0x3fff.*\t.*" "verify ftag == 0x3fff" + +gdb_test "stepi" "asm.*fldl2e.*" "push st0" +gdb_test "info register fstat" "fstat *0x3000.*\t.*" "verify fstat == 0x3000" +gdb_test "info register ftag" "ftag *0xfff.*\t.*" "verify ftag == 0xfff" + +gdb_test "stepi" "asm.*fldpi.*" "push st0" +gdb_test "info register fstat" "fstat *0x2800.*\t.*" "verify fstat == 0x2800" +gdb_test "info register ftag" "ftag *0x3ff.*\t.*" "verify ftag == 0x3ff" + +gdb_test "stepi" "asm.*fldlg2.*" "push st0" +gdb_test "info register fstat" "fstat *0x2000.*\t.*" "verify fstat == 0x2000" +gdb_test "info register ftag" "ftag *0xff.*\t.*" "verify ftag == 0xff" + +gdb_test "stepi" "asm.*fldln2.*" "push st0" +gdb_test "info register fstat" "fstat *0x1800.*\t.*" "verify fstat == 0x1800" +gdb_test "info register ftag" "ftag *0x3f.*\t.*" "verify ftag == 0x3f" + +gdb_test "stepi" "asm.*fldz.*" "push st0" +gdb_test "info register fstat" "fstat *0x1000.*\t.*" "verify fstat == 0x1000" +gdb_test "info register ftag" "ftag *0xf.*\t.*" "verify ftag == 0xf" + +gdb_test "stepi" "asm.*nop.*" "push st0" +gdb_test "info register fstat" "fstat *0x800.*\t.*" "verify fstat == 0x800" +gdb_test "info register ftag" "ftag *0x7.*\t.*" "verify ftag == 0x7" + + +# move backward and ehck we get the same registers back. + +gdb_test "reverse-stepi" "asm.*fldz.*" "push st0" +gdb_test "info register fstat" "fstat *0x1000.*\t.*" "verify fstat == 0x1000" +gdb_test "info register ftag" "ftag *0xf.*\t.*" "verify ftag == 0xf" + +gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0" +gdb_test "info register fstat" "fstat *0x1800.*\t.*" "verify fstat == 0x1800" +gdb_test "info register ftag" "ftag *0x3f.*\t.*" "verify ftag == 0x3f" + +gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0" +gdb_test "info register fstat" "fstat *0x2000.*\t.*" "verify fstat == 0x2000" +gdb_test "info register ftag" "ftag *0xff.*\t.*" "verify ftag == 0xff" + +gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0" +gdb_test "info register fstat" "fstat *0x2800.*\t.*" "verify fstat == 0x2800" +gdb_test "info register ftag" "ftag *0x3ff.*\t.*" "verify ftag == 0x3ff" + +gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0" +gdb_test "info register fstat" "fstat *0x3000.*\t.*" "verify fstat == 0x3000" +gdb_test "info register ftag" "ftag *0xfff.*\t.*" "verify ftag == 0xfff" + +gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0" +gdb_test "info register fstat" "fstat *0x3800.*\t.*" "verify fstat == 0x3800" +gdb_test "info register ftag" "ftag *0x3fff.*\t.*" "verify ftag == 0x3fff" + +gdb_test "reverse-stepi" "asm.*fld1.*" "push st0" +gdb_test "info register fstat" "fstat *0.*\t.*" "verify fstat == 0" +gdb_test "info register ftag" "ftag *0xffff.*\t.*" "verify ftag == 0xffff" + + + + + + Index: i387-stack-reverse.c =================================================================== --- i387-stack-reverse.c (nonexistent) +++ i387-stack-reverse.c (revision 513) @@ -0,0 +1,38 @@ +#include +#include +#include + +/* marks FPU stack as empty */ +void empty_fpu_stack() +{ + asm ("ffree %st(1) \n\t" + "ffree %st(2) \n\t" + "ffree %st(3) \n\t" + "ffree %st(4) \n\t" + "ffree %st(5) \n\t" + "ffree %st(6) \n\t" + "ffree %st(7)"); +} + +/* tests floating point arithmatic */ +void test_arith_floats() +{ + +} + +int main() +{ + empty_fpu_stack(); /* BEGIN I387-FLOAT-REVERSE */ + + asm ("fld1"); /* test st0 register */ + asm ("fldl2t"); /* test st0, st1 */ + asm ("fldl2e"); /* test st0, st1, st2 */ + asm ("fldpi"); /* test st0, st1, st2, st3 */ + asm ("fldlg2"); /* test st0, st1, st2, st3, st4 */ + asm ("fldln2"); /* test st0, st1, st2, st3, st4, st5 */ + asm ("fldz"); /* test st0, st1, st2, st3, st4, st5, st6 */ + asm ("fld1"); /* test st0, st1, st2, st3, st4, st5, st6, st7 */ + asm ("nop"); + + return 1; /* END I387-FLOAT-REVERSE */ +}
i387-stack-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ur1.c =================================================================== --- ur1.c (nonexistent) +++ ur1.c (revision 513) @@ -0,0 +1,49 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003, 2007, 2008, 2010 + 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 . */ + +/* The code for this file was extracted from the gdb testsuite + testcase "break.c". */ + +/* The following functions do nothing useful. They are included + simply as places to try setting breakpoints at. They are + explicitly "one-line functions" to verify that this case works + (some versions of gcc have or have had problems with this). + + These functions are in a separate source file to prevent an + optimizing compiler from inlining them and optimizing them away. */ + +#ifdef PROTOTYPES +int marker1 (void) { return (0); } /* set breakpoint 15 here */ +int marker2 (int a) { return (1); } /* set breakpoint 8 here */ +void marker3 (char *a, char *b) {} /* set breakpoint 17 here */ +void marker4 (long d) {} /* set breakpoint 14 here */ +#else +int marker1 () { return (0); } /* set breakpoint 16 here */ +int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ +void marker4 (d) long d; {} /* set breakpoint 13 here */ +#endif + +/* A structure we use for field name completion tests. */ +struct some_struct +{ + int a_field; + int b_field; +}; + +struct some_struct values[50];
ur1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-precsave.exp =================================================================== --- i386-precsave.exp (nonexistent) +++ i386-precsave.exp (revision 513) @@ -0,0 +1,303 @@ +# Copyright 2009, 2010 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 . + +# 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 ![target_info exists gdb,use_precord] { + return +} + +if $tracelevel { + strace $tracelevel +} + + +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_no_output "record" "Turn on process record" +} + +global hex +global decimal + +gdb_test "break $end_of_main" \ + "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 i386.precsave" \ + "Saved core file i386.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 i386.precsave" \ + "Program terminated with signal .*" \ + "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" + + Index: consecutive-reverse.exp =================================================================== --- consecutive-reverse.exp (nonexistent) +++ consecutive-reverse.exp (revision 513) @@ -0,0 +1,98 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests stepping over +# consecutive instructions in reverse. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "consecutive-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +gdb_breakpoint foo +gdb_test "continue" "Breakpoint $decimal, foo .*" \ + "continue to breakpoint in foo" + +set foo1_addr 0 +set foo2_addr 0 +set stop_addr 0 + +gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" { + global hex + global foo1_addr + global foo2_addr + global gdb_prompt + + -re "=> ($hex).*\[\r\n\]+ ($hex).*$gdb_prompt $" { + set foo1_addr $expect_out(1,string) + set foo2_addr $expect_out(2,string) + pass "get breakpoint address for foo" + } +} + +gdb_test "break \*$foo2_addr" "Breakpoint $decimal at $foo2_addr: file .*" \ + "set bp, 2nd instr" + +set testmsg "stopped at bp, 2nd instr" +gdb_test_multiple "step" $testmsg { + -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" { + set stop_addr $expect_out(1,string) + if [eval expr "$foo2_addr == $stop_addr"] then { + pass "stopped at bp, 2nd instr" + } else { + fail "stopped at bp, 2nd instr (wrong address)" + } + } +} + +### +### +### + +# Set reverse execution direction + +gdb_test_no_output "set exec-dir reverse" "set reverse execution" + +# Now step backward and hope to hit the first breakpoint. + +set test_msg "stopped at bp in reverse, 1st instr" +gdb_test_multiple "step" "$test_msg" { + -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" { + set stop_addr $expect_out(1,string) + if [eval expr "$foo1_addr == $stop_addr"] then { + pass "$test_msg" + } else { + fail "$test_msg (wrong address)" + } + } + -re "Breakpoint $decimal, foo.*$gdb_prompt $" { + gdb_test "print \$pc == $foo1_addr" \ + "$decimal = 1" \ + "$test_msg" + } +} Index: until-reverse.exp =================================================================== --- until-reverse.exp (nonexistent) +++ until-reverse.exp (revision 513) @@ -0,0 +1,125 @@ +# Copyright 2008, 2009, 2010 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 . */ + +# 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_no_output "record" "Turn on process record" +} + +# Verify that plain vanilla "until " 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 + +gdb_test_no_output "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" Index: shr2.c =================================================================== --- shr2.c (nonexistent) +++ shr2.c (revision 513) @@ -0,0 +1,34 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009, 2010 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 . */ + +#ifdef PROTOTYPES +int shr2(int x) +#else +int shr2(x) int x; +#endif +{ + return 2*x; +} + +#ifdef PROTOTYPES +int shr2_local(int x) +#else +int shr2_local(x) int x; +#endif +{ + return 2*x; +}
shr2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: machinestate.exp =================================================================== --- machinestate.exp (nonexistent) +++ machinestate.exp (revision 513) @@ -0,0 +1,229 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. +# This test tests the restoration of various kinds of machine state +# to their original values by reverse execution. We will execute +# the program forward while it changes various types of data, and +# then execute it backward to see if their values get restored. +# +# The types of machine state (data) that are tested are: +# register variable +# auto variable +# function static variable +# module static variable +# module global variable +# +# TODO: +# various, possibly including... +# .bss variable, .data variable, ... +# shared library variable +# heap variable (pointer)... +# overlay variables... +# Test forward replay +# + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "machinestate" +set srcfile ${testfile}.c +set srcfile1 ms1.c + +if { [prepare_for_testing $testfile.exp $testfile {machinestate.c ms1.c} ] } { + return -1 +} + +set newline "\[\r\n\]+" + +set beginmain [gdb_get_line_number " begin main " $srcfile] +set endmain [gdb_get_line_number " end main " $srcfile] + +# Test begins + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +# Proceed to end of main + +gdb_test "break $endmain" \ + "Breakpoint.* file .*/$srcfile, line $endmain.*" "" +gdb_continue_to_breakpoint "end of main" ".*/$srcfile:$endmain.*" + +### +### +### + +# Now run backward to each of several points where data is changed. +# + +# Module global variable, reverse + +set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint" +gdb_test "step" ".* module global post-change .*" "" +gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp" + + +# Module static variable, reverse + +set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint" +gdb_test "step" ".* module static post-change .*" "" +gdb_test "print astatic" ".* = 1$newline" "module static forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print astatic" ".* = 0$newline" "module static reverse-step" + +# Function static variable, reverse + +set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint" +gdb_test "step" ".* function static post-change .*" "" +gdb_test "print a" ".* = 1$newline" "function static forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "function static reverse-step" + +# Auto variable, reverse + +set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint" +gdb_test "step" ".* auto post-change .*" "" +gdb_test "print a" ".* = 1$newline" "auto var forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "auto var reverse-step" + +# Register variable, reverse + +set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint" +gdb_test "step" ".* register post-change .*" "" +gdb_test "print a" ".* = 1$newline" "register var step post-change" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "register var reverse step-to" + +# Proceed to beginning of main + +gdb_test "tbreak $beginmain" ".*/$srcfile, line $beginmain.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$beginmain.*" "reverse to main" + +# Now repeat tests while replaying forward. + +# Register variable, forward + +set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "register var forward step-to" +gdb_test "step" ".* register post-change .*" "" +gdb_test "print a" ".* = 1$newline" "register var step post-change" + +# Auto variable, forward + +set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "auto var forward step-to" +gdb_test "step" ".* auto post-change .*" "" +gdb_test "print a" ".* = 1$newline" "auto var step post-change" + +# Function static variable, forward + +set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "function static forward step-to" +gdb_test "step" ".* function static post-change .*" "" +gdb_test "print a" ".* = 1$newline" "function static step post-change" + +# Module static variable, forward + +set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print astatic" ".* = 0$newline" "module static forward step-to" +gdb_test "step" ".* module static post-change .*" "" +gdb_test "print astatic" ".* = 1$newline" "module static step post-change" + +# Module global variable, forward + +set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to" +gdb_test "step" ".* module global post-change .*" "" +gdb_test "print aglobal" ".* = 1$newline" "module global step post-change" + Index: sigall-reverse.c =================================================================== --- sigall-reverse.c (nonexistent) +++ sigall-reverse.c (revision 513) @@ -0,0 +1,1413 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009, 2010 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 . */ + +#include +#include + +#ifdef __sh__ +#define signal(a,b) /* Signals not supported on this target - make them go away */ +#endif + +/* Signal handlers, we set breakpoints in them to make sure that the + signals really get delivered. */ + +void +handle_ABRT (int sig) +{ +} + +void +handle_HUP (int sig) +{ +} + +void +handle_QUIT (int sig) +{ +} + +void +handle_ILL (int sig) +{ +} + +void +handle_EMT (int sig) +{ +} + +void +handle_FPE (int sig) +{ +} + +void +handle_BUS (int sig) +{ +} + +void +handle_SEGV (int sig) +{ +} + +void +handle_SYS (int sig) +{ +} + +void +handle_PIPE (int sig) +{ +} + +void +handle_ALRM (int sig) +{ +} + +void +handle_URG (int sig) +{ +} + +void +handle_TSTP (int sig) +{ +} + +void +handle_CONT (int sig) +{ +} + +void +handle_CHLD (int sig) +{ +} + +void +handle_TTIN (int sig) +{ +} + +void +handle_TTOU (int sig) +{ +} + +void +handle_IO (int sig) +{ +} + +void +handle_XCPU (int sig) +{ +} + +void +handle_XFSZ (int sig) +{ +} + +void +handle_VTALRM (int sig) +{ +} + +void +handle_PROF (int sig) +{ +} + +void +handle_WINCH (int sig) +{ +} + +void +handle_LOST (int sig) +{ +} + +void +handle_USR1 (int sig) +{ +} + +void +handle_USR2 (int sig) +{ +} + +void +handle_PWR (int sig) +{ +} + +void +handle_POLL (int sig) +{ +} + +void +handle_WIND (int sig) +{ +} + +void +handle_PHONE (int sig) +{ +} + +void +handle_WAITING (int sig) +{ +} + +void +handle_LWP (int sig) +{ +} + +void +handle_DANGER (int sig) +{ +} + +void +handle_GRANT (int sig) +{ +} + +void +handle_RETRACT (int sig) +{ +} + +void +handle_MSG (int sig) +{ +} + +void +handle_SOUND (int sig) +{ +} + +void +handle_SAK (int sig) +{ +} + +void +handle_PRIO (int sig) +{ +} + +void +handle_33 (int sig) +{ +} + +void +handle_34 (int sig) +{ +} + +void +handle_35 (int sig) +{ +} + +void +handle_36 (int sig) +{ +} + +void +handle_37 (int sig) +{ +} + +void +handle_38 (int sig) +{ +} + +void +handle_39 (int sig) +{ +} + +void +handle_40 (int sig) +{ +} + +void +handle_41 (int sig) +{ +} + +void +handle_42 (int sig) +{ +} + +void +handle_43 (int sig) +{ +} + +void +handle_44 (int sig) +{ +} + +void +handle_45 (int sig) +{ +} + +void +handle_46 (int sig) +{ +} + +void +handle_47 (int sig) +{ +} + +void +handle_48 (int sig) +{ +} + +void +handle_49 (int sig) +{ +} + +void +handle_50 (int sig) +{ +} + +void +handle_51 (int sig) +{ +} + +void +handle_52 (int sig) +{ +} + +void +handle_53 (int sig) +{ +} + +void +handle_54 (int sig) +{ +} + +void +handle_55 (int sig) +{ +} + +void +handle_56 (int sig) +{ +} + +void +handle_57 (int sig) +{ +} + +void +handle_58 (int sig) +{ +} + +void +handle_59 (int sig) +{ +} + +void +handle_60 (int sig) +{ +} + +void +handle_61 (int sig) +{ +} + +void +handle_62 (int sig) +{ +} + +void +handle_63 (int sig) +{ +} + +void +handle_TERM (int sig) +{ +} + +/* Functions to send signals. These also serve as markers. */ +int +gen_ABRT (void) +{ + kill (getpid (), SIGABRT); + return 0; +} + +int +gen_HUP (void) +{ +#ifdef SIGHUP + kill (getpid (), SIGHUP); +#else + handle_HUP (0); +#endif +return 0; +} + +int +gen_QUIT (void) +{ +#ifdef SIGQUIT + kill (getpid (), SIGQUIT); +#else + handle_QUIT (0); +#endif +return 0; +} + +int +gen_ILL (void) +{ +#ifdef SIGILL + kill (getpid (), SIGILL); +#else + handle_ILL (0); +#endif +return 0; +} + +int +gen_EMT (void) +{ +#ifdef SIGEMT + kill (getpid (), SIGEMT); +#else + handle_EMT (0); +#endif +return 0; +} + +int x; + +int +gen_FPE (void) +{ + /* The intent behind generating SIGFPE this way is to check the mapping + from the CPU exception itself to the signals. It would be nice to + do the same for SIGBUS, SIGSEGV, etc., but I suspect that even this + test might turn out to be insufficiently portable. */ + +#if 0 + /* Loses on the PA because after the signal handler executes we try to + re-execute the failing instruction again. Perhaps we could siglongjmp + out of the signal handler? */ + /* The expect script looks for the word "kill"; don't delete it. */ + return 5 / x; /* and we both started jumping up and down yelling kill */ +#else + kill (getpid (), SIGFPE); +#endif +return 0; +} + +int +gen_BUS (void) +{ +#ifdef SIGBUS + kill (getpid (), SIGBUS); +#else + handle_BUS (0); +#endif +return 0; +} + +int +gen_SEGV (void) +{ +#ifdef SIGSEGV + kill (getpid (), SIGSEGV); +#else + handle_SEGV (0); +#endif +return 0; +} + +int +gen_SYS (void) +{ +#ifdef SIGSYS + kill (getpid (), SIGSYS); +#else + handle_SYS (0); +#endif +return 0; +} + +int +gen_PIPE (void) +{ +#ifdef SIGPIPE + kill (getpid (), SIGPIPE); +#else + handle_PIPE (0); +#endif +return 0; +} + +int +gen_ALRM (void) +{ +#ifdef SIGALRM + kill (getpid (), SIGALRM); +#else + handle_ALRM (0); +#endif +return 0; +} + +int +gen_URG (void) +{ +#ifdef SIGURG + kill (getpid (), SIGURG); +#else + handle_URG (0); +#endif +return 0; +} + +int +gen_TSTP (void) +{ +#ifdef SIGTSTP + kill (getpid (), SIGTSTP); +#else + handle_TSTP (0); +#endif +return 0; +} + +int +gen_CONT (void) +{ +#ifdef SIGCONT + kill (getpid (), SIGCONT); +#else + handle_CONT (0); +#endif +return 0; +} + +int +gen_CHLD (void) +{ +#ifdef SIGCHLD + kill (getpid (), SIGCHLD); +#else + handle_CHLD (0); +#endif +return 0; +} + +int +gen_TTIN (void) +{ +#ifdef SIGTTIN + kill (getpid (), SIGTTIN); +#else + handle_TTIN (0); +#endif +return 0; +} + +int +gen_TTOU (void) +{ +#ifdef SIGTTOU + kill (getpid (), SIGTTOU); +#else + handle_TTOU (0); +#endif +return 0; +} + +int +gen_IO (void) +{ +#ifdef SIGIO + kill (getpid (), SIGIO); +#else + handle_IO (0); +#endif +return 0; +} + +int +gen_XCPU (void) +{ +#ifdef SIGXCPU + kill (getpid (), SIGXCPU); +#else + handle_XCPU (0); +#endif +return 0; +} + +int +gen_XFSZ (void) +{ +#ifdef SIGXFSZ + kill (getpid (), SIGXFSZ); +#else + handle_XFSZ (0); +#endif +return 0; +} + +int +gen_VTALRM (void) +{ +#ifdef SIGVTALRM + kill (getpid (), SIGVTALRM); +#else + handle_VTALRM (0); +#endif +return 0; +} + +int +gen_PROF (void) +{ +#ifdef SIGPROF + kill (getpid (), SIGPROF); +#else + handle_PROF (0); +#endif +return 0; +} + +int +gen_WINCH (void) +{ +#ifdef SIGWINCH + kill (getpid (), SIGWINCH); +#else + handle_WINCH (0); +#endif +return 0; +} + +int +gen_LOST (void) +{ +#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT) + kill (getpid (), SIGLOST); +#else + handle_LOST (0); +#endif +return 0; +} + +int +gen_USR1 (void) +{ +#ifdef SIGUSR1 + kill (getpid (), SIGUSR1); +#else + handle_USR1 (0); +#endif +return 0; +} + +int +gen_USR2 (void) +{ +#ifdef SIGUSR2 + kill (getpid (), SIGUSR2); +#else + handle_USR2 (0); +#endif +return 0; +} + +int +gen_PWR (void) +{ +#ifdef SIGPWR + kill (getpid (), SIGPWR); +#else + handle_PWR (0); +#endif +return 0; +} + +int +gen_POLL (void) +{ +#if defined (SIGPOLL) && (!defined (SIGIO) || SIGPOLL != SIGIO) + kill (getpid (), SIGPOLL); +#else + handle_POLL (0); +#endif +return 0; +} + +int +gen_WIND (void) +{ +#ifdef SIGWIND + kill (getpid (), SIGWIND); +#else + handle_WIND (0); +#endif +return 0; +} + +int +gen_PHONE (void) +{ +#ifdef SIGPHONE + kill (getpid (), SIGPHONE); +#else + handle_PHONE (0); +#endif +return 0; +} + +int +gen_WAITING (void) +{ +#ifdef SIGWAITING + kill (getpid (), SIGWAITING); +#else + handle_WAITING (0); +#endif +return 0; +} + +int +gen_LWP (void) +{ +#ifdef SIGLWP + kill (getpid (), SIGLWP); +#else + handle_LWP (0); +#endif +return 0; +} + +int +gen_DANGER (void) +{ +#ifdef SIGDANGER + kill (getpid (), SIGDANGER); +#else + handle_DANGER (0); +#endif +return 0; +} + +int +gen_GRANT (void) +{ +#ifdef SIGGRANT + kill (getpid (), SIGGRANT); +#else + handle_GRANT (0); +#endif +return 0; +} + +int +gen_RETRACT (void) +{ +#ifdef SIGRETRACT + kill (getpid (), SIGRETRACT); +#else + handle_RETRACT (0); +#endif +return 0; +} + +int +gen_MSG (void) +{ +#ifdef SIGMSG + kill (getpid (), SIGMSG); +#else + handle_MSG (0); +#endif +return 0; +} + +int +gen_SOUND (void) +{ +#ifdef SIGSOUND + kill (getpid (), SIGSOUND); +#else + handle_SOUND (0); +#endif +return 0; +} + +int +gen_SAK (void) +{ +#ifdef SIGSAK + kill (getpid (), SIGSAK); +#else + handle_SAK (0); +#endif +return 0; +} + +int +gen_PRIO (void) +{ +#ifdef SIGPRIO + kill (getpid (), SIGPRIO); +#else + handle_PRIO (0); +#endif +return 0; +} + +int +gen_33 (void) +{ +#ifdef SIG33 + kill (getpid (), 33); +#else + handle_33 (0); +#endif +return 0; +} + +int +gen_34 (void) +{ +#ifdef SIG34 + kill (getpid (), 34); +#else + handle_34 (0); +#endif +return 0; +} + +int +gen_35 (void) +{ +#ifdef SIG35 + kill (getpid (), 35); +#else + handle_35 (0); +#endif +return 0; +} + +int +gen_36 (void) +{ +#ifdef SIG36 + kill (getpid (), 36); +#else + handle_36 (0); +#endif +return 0; +} + +int +gen_37 (void) +{ +#ifdef SIG37 + kill (getpid (), 37); +#else + handle_37 (0); +#endif +return 0; +} + +int +gen_38 (void) +{ +#ifdef SIG38 + kill (getpid (), 38); +#else + handle_38 (0); +#endif +return 0; +} + +int +gen_39 (void) +{ +#ifdef SIG39 + kill (getpid (), 39); +#else + handle_39 (0); +#endif +return 0; +} + +int +gen_40 (void) +{ +#ifdef SIG40 + kill (getpid (), 40); +#else + handle_40 (0); +#endif +return 0; +} + +int +gen_41 (void) +{ +#ifdef SIG41 + kill (getpid (), 41); +#else + handle_41 (0); +#endif +return 0; +} + +int +gen_42 (void) +{ +#ifdef SIG42 + kill (getpid (), 42); +#else + handle_42 (0); +#endif +return 0; +} + +int +gen_43 (void) +{ +#ifdef SIG43 + kill (getpid (), 43); +#else + handle_43 (0); +#endif +return 0; +} + +int +gen_44 (void) +{ +#ifdef SIG44 + kill (getpid (), 44); +#else + handle_44 (0); +#endif +return 0; +} + +int +gen_45 (void) +{ +#ifdef SIG45 + kill (getpid (), 45); +#else + handle_45 (0); +#endif +return 0; +} + +int +gen_46 (void) +{ +#ifdef SIG46 + kill (getpid (), 46); +#else + handle_46 (0); +#endif +return 0; +} + +int +gen_47 (void) +{ +#ifdef SIG47 + kill (getpid (), 47); +#else + handle_47 (0); +#endif +return 0; +} + +int +gen_48 (void) +{ +#ifdef SIG48 + kill (getpid (), 48); +#else + handle_48 (0); +#endif +return 0; +} + +int +gen_49 (void) +{ +#ifdef SIG49 + kill (getpid (), 49); +#else + handle_49 (0); +#endif +return 0; +} + +int +gen_50 (void) +{ +#ifdef SIG50 + kill (getpid (), 50); +#else + handle_50 (0); +#endif +return 0; +} + +int +gen_51 (void) +{ +#ifdef SIG51 + kill (getpid (), 51); +#else + handle_51 (0); +#endif +return 0; +} + +int +gen_52 (void) +{ +#ifdef SIG52 + kill (getpid (), 52); +#else + handle_52 (0); +#endif +return 0; +} + +int +gen_53 (void) +{ +#ifdef SIG53 + kill (getpid (), 53); +#else + handle_53 (0); +#endif +return 0; +} + +int +gen_54 (void) +{ +#ifdef SIG54 + kill (getpid (), 54); +#else + handle_54 (0); +#endif +return 0; +} + +int +gen_55 (void) +{ +#ifdef SIG55 + kill (getpid (), 55); +#else + handle_55 (0); +#endif +return 0; +} + +int +gen_56 (void) +{ +#ifdef SIG56 + kill (getpid (), 56); +#else + handle_56 (0); +#endif +return 0; +} + +int +gen_57 (void) +{ +#ifdef SIG57 + kill (getpid (), 57); +#else + handle_57 (0); +#endif +return 0; +} + +int +gen_58 (void) +{ +#ifdef SIG58 + kill (getpid (), 58); +#else + handle_58 (0); +#endif +return 0; +} + +int +gen_59 (void) +{ +#ifdef SIG59 + kill (getpid (), 59); +#else + handle_59 (0); +#endif +return 0; +} + +int +gen_60 (void) +{ +#ifdef SIG60 + kill (getpid (), 60); +#else + handle_60 (0); +#endif +return 0; +} + +int +gen_61 (void) +{ +#ifdef SIG61 + kill (getpid (), 61); +#else + handle_61 (0); +#endif +return 0; +} + +int +gen_62 (void) +{ +#ifdef SIG62 + kill (getpid (), 62); +#else + handle_62 (0); +#endif +return 0; +} + +int +gen_63 (void) +{ +#ifdef SIG63 + kill (getpid (), 63); +#else + handle_63 (0); +#endif +return 0; +} + +int +gen_TERM (void) +{ + kill (getpid (), SIGTERM); +return 0; +} + +int +main () +{ +#ifdef usestubs + set_debug_traps (); + breakpoint (); +#endif + +#ifdef SIG_SETMASK + /* Ensure all the signals aren't blocked. + The environment in which the testsuite is run may have blocked some + for whatever reason. */ + { + sigset_t newset; + sigemptyset (&newset); + sigprocmask (SIG_SETMASK, &newset, NULL); + } +#endif + + signal (SIGABRT, handle_ABRT); +#ifdef SIGHUP + signal (SIGHUP, handle_HUP); +#endif +#ifdef SIGQUIT + signal (SIGQUIT, handle_QUIT); +#endif +#ifdef SIGILL + signal (SIGILL, handle_ILL); +#endif +#ifdef SIGEMT + signal (SIGEMT, handle_EMT); +#endif +#ifdef SIGFPE + signal (SIGFPE, handle_FPE); +#endif +#ifdef SIGBUS + signal (SIGBUS, handle_BUS); +#endif +#ifdef SIGSEGV + signal (SIGSEGV, handle_SEGV); +#endif +#ifdef SIGSYS + signal (SIGSYS, handle_SYS); +#endif +#ifdef SIGPIPE + signal (SIGPIPE, handle_PIPE); +#endif +#ifdef SIGALRM + signal (SIGALRM, handle_ALRM); +#endif +#ifdef SIGURG + signal (SIGURG, handle_URG); +#endif +#ifdef SIGTSTP + signal (SIGTSTP, handle_TSTP); +#endif +#ifdef SIGCONT + signal (SIGCONT, handle_CONT); +#endif +#ifdef SIGCHLD + signal (SIGCHLD, handle_CHLD); +#endif +#ifdef SIGTTIN + signal (SIGTTIN, handle_TTIN); +#endif +#ifdef SIGTTOU + signal (SIGTTOU, handle_TTOU); +#endif +#ifdef SIGIO + signal (SIGIO, handle_IO); +#endif +#ifdef SIGXCPU + signal (SIGXCPU, handle_XCPU); +#endif +#ifdef SIGXFSZ + signal (SIGXFSZ, handle_XFSZ); +#endif +#ifdef SIGVTALRM + signal (SIGVTALRM, handle_VTALRM); +#endif +#ifdef SIGPROF + signal (SIGPROF, handle_PROF); +#endif +#ifdef SIGWINCH + signal (SIGWINCH, handle_WINCH); +#endif +#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT) + signal (SIGLOST, handle_LOST); +#endif +#ifdef SIGUSR1 + signal (SIGUSR1, handle_USR1); +#endif +#ifdef SIGUSR2 + signal (SIGUSR2, handle_USR2); +#endif +#ifdef SIGPWR + signal (SIGPWR, handle_PWR); +#endif +#if defined (SIGPOLL) && (!defined (SIGIO) || SIGPOLL != SIGIO) + signal (SIGPOLL, handle_POLL); +#endif +#ifdef SIGWIND + signal (SIGWIND, handle_WIND); +#endif +#ifdef SIGPHONE + signal (SIGPHONE, handle_PHONE); +#endif +#ifdef SIGWAITING + signal (SIGWAITING, handle_WAITING); +#endif +#ifdef SIGLWP + signal (SIGLWP, handle_LWP); +#endif +#ifdef SIGDANGER + signal (SIGDANGER, handle_DANGER); +#endif +#ifdef SIGGRANT + signal (SIGGRANT, handle_GRANT); +#endif +#ifdef SIGRETRACT + signal (SIGRETRACT, handle_RETRACT); +#endif +#ifdef SIGMSG + signal (SIGMSG, handle_MSG); +#endif +#ifdef SIGSOUND + signal (SIGSOUND, handle_SOUND); +#endif +#ifdef SIGSAK + signal (SIGSAK, handle_SAK); +#endif +#ifdef SIGPRIO + signal (SIGPRIO, handle_PRIO); +#endif +#ifdef __Lynx__ + /* Lynx doesn't seem to have anything in signal.h for this. */ + signal (33, handle_33); + signal (34, handle_34); + signal (35, handle_35); + signal (36, handle_36); + signal (37, handle_37); + signal (38, handle_38); + signal (39, handle_39); + signal (40, handle_40); + signal (41, handle_41); + signal (42, handle_42); + signal (43, handle_43); + signal (44, handle_44); + signal (45, handle_45); + signal (46, handle_46); + signal (47, handle_47); + signal (48, handle_48); + signal (49, handle_49); + signal (50, handle_50); + signal (51, handle_51); + signal (52, handle_52); + signal (53, handle_53); + signal (54, handle_54); + signal (55, handle_55); + signal (56, handle_56); + signal (57, handle_57); + signal (58, handle_58); + signal (59, handle_59); + signal (60, handle_60); + signal (61, handle_61); + signal (62, handle_62); + signal (63, handle_63); +#endif /* lynx */ + signal (SIGTERM, handle_TERM); + + x = 0; + + gen_ABRT (); + gen_HUP (); + gen_QUIT (); + gen_ILL (); + gen_EMT (); + gen_FPE (); + gen_BUS (); + gen_SEGV (); + gen_SYS (); + gen_PIPE (); + gen_ALRM (); + gen_URG (); + gen_TSTP (); + gen_CONT (); + gen_CHLD (); + gen_TTIN (); + gen_TTOU (); + gen_IO (); + gen_XCPU (); + gen_XFSZ (); + gen_VTALRM (); + gen_PROF (); + gen_WINCH (); + gen_LOST (); + gen_USR1 (); + gen_USR2 (); + gen_PWR (); + gen_POLL (); + gen_WIND (); + gen_PHONE (); + gen_WAITING (); + gen_LWP (); + gen_DANGER (); + gen_GRANT (); + gen_RETRACT (); + gen_MSG (); + gen_SOUND (); + gen_SAK (); + gen_PRIO (); + gen_33 (); + gen_34 (); + gen_35 (); + gen_36 (); + gen_37 (); + gen_38 (); + gen_39 (); + gen_40 (); + gen_41 (); + gen_42 (); + gen_43 (); + gen_44 (); + gen_45 (); + gen_46 (); + gen_47 (); + gen_48 (); + gen_49 (); + gen_50 (); + gen_51 (); + gen_52 (); + gen_53 (); + gen_54 (); + gen_55 (); + gen_56 (); + gen_57 (); + gen_58 (); + gen_59 (); + gen_60 (); + gen_61 (); + gen_62 (); + gen_63 (); + gen_TERM (); + + return 0; /* end of main */ +}
sigall-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: step-reverse.c =================================================================== --- step-reverse.c (nonexistent) +++ step-reverse.c (revision 513) @@ -0,0 +1,78 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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 . */ + +#include +#include + +/* Test various kinds of stepping. +*/ +int myglob = 0; + +int callee() { /* ENTER CALLEE */ + myglob++; return 0; /* ARRIVED IN CALLEE */ +} /* RETURN FROM CALLEE */ + +/* A structure which, we hope, will need to be passed using memcpy. */ +struct rhomboidal { + int rather_large[100]; +}; + +void +large_struct_by_value (struct rhomboidal r) +{ + myglob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ +} + +int main () { + int w,x,y,z; + int a[10], b[10]; + + /* Test "next" and "step" */ + w = 0; /* BREAK AT MAIN */ + x = 1; /* NEXT TEST 1 */ + y = 2; /* STEP TEST 1 */ + z = 3; /* REVERSE NEXT TEST 1 */ + w = w + 2; /* NEXT TEST 2 */ + x = x + 3; /* REVERSE STEP TEST 1 */ + y = y + 4; + z = z + 5; /* STEP TEST 2 */ + + /* Test that "next" goes over a call */ + callee(); /* NEXT OVER THIS CALL */ + + /* Test that "step" doesn't */ + callee(); /* STEP INTO THIS CALL */ + + /* Test "stepi" */ + a[5] = a[3] - a[4]; /* FINISH TEST */ + callee(); /* STEPI TEST */ + + /* Test "nexti" */ + callee(); /* NEXTI TEST */ + + y = w + z; + + { + struct rhomboidal r; + memset (r.rather_large, 0, sizeof (r.rather_large)); + r.rather_large[42] = 10; + large_struct_by_value (r); /* step-test.exp: large struct by value */ + } + + exit (0); /* end of main */ +} +
step-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: machinestate-precsave.exp =================================================================== --- machinestate-precsave.exp (nonexistent) +++ machinestate-precsave.exp (revision 513) @@ -0,0 +1,255 @@ +# Copyright 2008, 2009, 2010 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 . + +# This file is part of the GDB testsuite. +# This test tests the restoration of various kinds of machine state +# to their original values with a process record log. We will execute +# the program forward while it changes various types of data, and +# then execute it backward to see if their values get restored. +# +# The types of machine state (data) that are tested are: +# register variable +# auto variable +# function static variable +# module static variable +# module global variable +# +# TODO: +# various, possibly including... +# .bss variable, .data variable, ... +# shared library variable +# heap variable (pointer)... +# overlay variables... +# Test forward replay +# + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "machinestate" +set srcfile ${testfile}.c +set srcfile1 ms1.c + +if { [prepare_for_testing $testfile.exp $testfile {machinestate.c ms1.c} ] } { + return -1 +} + +set newline "\[\r\n\]+" + +set beginmain [gdb_get_line_number " begin main " $srcfile] +set endmain [gdb_get_line_number " end main " $srcfile] + +# Test begins + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +gdb_test "break $endmain" \ + "Breakpoint $decimal at .*/$srcfile, line $endmain\." \ + "BP at end of main" + +gdb_test "continue" "Breakpoint .* end main .*" "run to end of main" + +gdb_test "record save machinestate.precsave" \ + "Saved core file machinestate.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 machinestate.precsave" \ + "Program terminated with signal .*" \ + "reload prec save file" + +# Proceed to end of main + +gdb_test "break $endmain" \ + "Breakpoint.* file .*/$srcfile, line $endmain.*" "" + +gdb_test_multiple "continue" "go to end of main forward" { + -re ".*Breakpoint $decimal,.*/$srcfile:$endmain.*$gdb_prompt $" { + pass "go to end of main forward" + } + -re "No more reverse-execution history.* end main .*$gdb_prompt $" { + pass "go to end of main forward" + } +} + +### +### +### + +# Now run backward to each of several points where data is changed. +# + +# Module global variable, reverse + +set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint" +gdb_test "step" ".* module global post-change .*" "" +gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp" + + +# Module static variable, reverse + +set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint" +gdb_test "step" ".* module static post-change .*" "" +gdb_test "print astatic" ".* = 1$newline" "module static forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print astatic" ".* = 0$newline" "module static reverse-step" + +# Function static variable, reverse + +set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint" +gdb_test "step" ".* function static post-change .*" "" +gdb_test "print a" ".* = 1$newline" "function static forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "function static reverse-step" + +# Auto variable, reverse + +set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint" +gdb_test "step" ".* auto post-change .*" "" +gdb_test "print a" ".* = 1$newline" "auto var forward" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "auto var reverse-step" + +# Register variable, reverse + +set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc" + +gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint" +gdb_test "step" ".* register post-change .*" "" +gdb_test "print a" ".* = 1$newline" "register var step post-change" +gdb_test "reverse-step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "register var reverse step-to" + +# Proceed to beginning of main + +gdb_test "tbreak $beginmain" ".*/$srcfile, line $beginmain.*" "" +gdb_test "reverse-continue" ".*/$srcfile:$beginmain.*" "reverse to main" + +# Now repeat tests while replaying forward. + +# Register variable, forward + +set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "register var forward step-to" +gdb_test "step" ".* register post-change .*" "" +gdb_test "print a" ".* = 1$newline" "register var step post-change" + +# Auto variable, forward + +set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "auto var forward step-to" +gdb_test "step" ".* auto post-change .*" "" +gdb_test "print a" ".* = 1$newline" "auto var step post-change" + +# Function static variable, forward + +set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print a" ".* = 0$newline" "function static forward step-to" +gdb_test "step" ".* function static post-change .*" "" +gdb_test "print a" ".* = 1$newline" "function static step post-change" + +# Module static variable, forward + +set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print astatic" ".* = 0$newline" "module static forward step-to" +gdb_test "step" ".* module static post-change .*" "" +gdb_test "print astatic" ".* = 1$newline" "module static step post-change" + +# Module global variable, forward + +set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + +gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" "" +gdb_test "continue" ".*/$srcfile:$breakloc.*" "forward to $breakloc" + +gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint" +gdb_test "reverse-step" ".*hide.*" "" +gdb_test "step" ".*$newline$breakloc.*" "" +gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to" +gdb_test "step" ".* module global post-change .*" "" +gdb_test "print aglobal" ".* = 1$newline" "module global step post-change" + Index: watch-precsave.exp =================================================================== --- watch-precsave.exp (nonexistent) +++ watch-precsave.exp (revision 513) @@ -0,0 +1,216 @@ +# Copyright 2009, 2010 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 . + +# Based on a file written by Fred Fish. (fnf@cygnus.com) +# This file is part of the GDB testsuite. It tests precord dumpfile +# debugging with watchpoints. + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "watch-reverse" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +set end_location [gdb_get_line_number "end of main" ] +gdb_test "break $end_location" \ + "Breakpoint $decimal at .*/$srcfile, line $end_location\." \ + "BP at end of main" + +gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" + +gdb_test "record save watch.precsave" \ + "Saved core file watch.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 watch.precsave" \ + "Program terminated with signal .*" \ + "reload core file" + +# Only software watchpoints can be used in reverse +gdb_test_no_output "set can-use-hw-watchpoints 0" "" + +gdb_test "break marker1" \ + "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ + "set breakpoint at marker1" + +gdb_test "break marker2" \ + "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ + "set breakpoint at marker2" + +gdb_continue_to_breakpoint "marker1" ".*/$srcfile:.*" + +gdb_test "watch ival3" \ + ".*\[Ww\]atchpoint $decimal: ival3.*" \ + "set watchpoint on ival3" + +# Continue until first change, from -1 to 0 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, first time" + +# Continue until the next change, from 0 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, second time" + +# Continue until the next change, from 1 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, third time" + +# Continue until the next change, from 2 to 3. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, fourth time" + +# Continue until the next change, from 3 to 4. +# Note that this one is outside the loop. + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, fifth time" + +# Continue until we hit the finishing marker function. +# Make sure we hit no more watchpoints. + +gdb_continue_to_breakpoint "marker2" ".*/$srcfile:.*" + +### +### +### + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +# Reverse until the previous change, from 4 to 3 +# Note that this one is outside the loop + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, first time" + +# Reverse until the previous change, from 3 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, second time" + +# Reverse until the previous change, from 2 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, third time" + +# Reverse until the previous change, from 1 to 0. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, fourth time" + +# Reverse until first change, from 0 to -1 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, fifth time" + +gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints" + +### +### +### + +gdb_test_no_output "set exec-direction forward" "set forward" + +# Continue until first change, from -1 to 0 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, first time" + +# Continue until the next change, from 0 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, second time" + +# Continue until the next change, from 1 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, third time" + +# Continue until the next change, from 2 to 3. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, fourth time" + +# Continue until the next change, from 3 to 4. +# Note that this one is outside the loop. + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, fifth time" + +# Continue until we hit the finishing marker function. +# Make sure we hit no more watchpoints. + +gdb_test "continue" "marker2 .*" "replay forward to marker2" + +### +### +### + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +# Reverse until the previous change, from 4 to 3 +# Note that this one is outside the loop + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, first time" + +# Reverse until the previous change, from 3 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, second time" + +# Reverse until the previous change, from 2 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, third time" + +# Reverse until the previous change, from 1 to 0. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, fourth time" + +# Reverse until first change, from 0 to -1 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, fifth time" + Index: solib-precsave.exp =================================================================== --- solib-precsave.exp (nonexistent) +++ solib-precsave.exp (revision 513) @@ -0,0 +1,141 @@ +# Copyright 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests precord debugging +# with shared libraries and a logfile. + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "solib-reverse" +set srcfile ${testfile}.c +set libfile "shr2" +set libsrc ${libfile}.c +set library ${objdir}/${subdir}/${libfile}.sl +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } { + untested "Could not compile shared library." + return -1 +} + +set exec_opts [list debug shlib=${library}] + +if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { + untested "Could not compile $binfile." + return -1 +} + +# Start with a fresh gdb. + +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_no_output "record" "Turn on process record" +} + +set end_of_main [gdb_get_line_number "end of main" ] +gdb_test "break $end_of_main" \ + "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 solib.precsave" \ + "Saved core file solib.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 solib.precsave" \ + "Program terminated with signal .*" \ + "reload core file" + +# +# Test reverse-step over undebuggable solib functions. +# + +# Run forward past some solib function calls. + +set end_part_one [gdb_get_line_number " end part one" "$srcfile"] +set end_part_two [gdb_get_line_number " end part two" "$srcfile"] +gdb_test "until $end_part_one" " end part one.*" "run until end part one" + +gdb_test "reverse-step" " sleep three .*" "reverse-step third sleep" +gdb_test "reverse-step" " sleep two .*" "reverse-step second sleep" +gdb_test "reverse-step" " sleep one .*" \ + "reverse-step first sleep, dynsym resolve" + +gdb_test "reverse-step" " printf three .*" "reverse-step third printf" +gdb_test "reverse-step" " printf two .*" "reverse-step second printf" +gdb_test "reverse-step" " printf one .*" \ + "reverse-step first printf, dynsym resolve" +gdb_test "reverse-step" " generic statement.*" "reverse-step generic" + + +# +# Test reverse-next over undebuggable solib functions. +# + +# Run forward again... + +gdb_test "until $end_part_one" " end part one.*" "forward to end part one" + +gdb_test "reverse-next" " sleep three .*" "reverse-next third sleep" +gdb_test "reverse-next" " sleep two .*" "reverse-next second sleep" +gdb_test "reverse-next" " sleep one .*" \ + "reverse-next first sleep, dynsym resolve" + +gdb_test "reverse-next" " printf three .*" "reverse-next third printf" +gdb_test "reverse-next" " printf two .*" "reverse-next second printf" +gdb_test "reverse-next" " printf one .*" \ + "reverse-next first printf, dynsym resolve" +gdb_test "reverse-next" " generic statement.*" "reverse-next generic" + + +# +# Test reverse-step into debuggable solib function +# + +gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function one" +gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one" +gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one" + +gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function two" +gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two" +gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two" + +# +# Test reverse-next over debuggable solib function +# + +gdb_test "until $end_part_two" " end part two.*" "run until end part two" + +gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one" +gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two" Index: i387-env-reverse.c =================================================================== --- i387-env-reverse.c (nonexistent) +++ i387-env-reverse.c (revision 513) @@ -0,0 +1,60 @@ +#include +#include +#include + + +float no1,no2,no3,no4,no5,no6,no7; +float result,resultd,resultld; +float *float_memory; +long double ldx = 88888888888888888888.88, ldy = 9999999999999999999.99; +double x = 100.345, y = 25.7789; +/* marks FPU stack as empty */ +void empty_fpu_stack() +{ + asm ("ffree %st(1) \n\t" + "ffree %st(2) \n\t" + "ffree %st(3) \n\t" + "ffree %st(4) \n\t" + "ffree %st(5) \n\t" + "ffree %st(6) \n\t" + "ffree %st(7)"); +} + +/* initialization of floats */ +void init_floats() +{ + no1 = 10.45; + no2 = 20.77; + no3 = 156.89874646; + no4 = 14.56; + no5 = 11.11; + no6 = 66.77; + no7 = 88.88; + float_memory = malloc(sizeof(float) * 4); + *float_memory = 256.256; + *(float_memory + 1) = 356.356; + *(float_memory + 2) = 456.456; + *(float_memory + 3) = 556.556; +} + +int main() +{ + init_floats(); + empty_fpu_stack(); /* BEGIN I387-FLOAT-REVERSE */ + + asm("nop"); /* TEST ENV */ + asm ("fsave %0" : "=m"(*float_memory) : ); + asm ("frstor %0" : : "m"(*float_memory)); + asm ("fstsw %ax"); /* test eax register */ + + asm ("fld1"); + asm ("fldl2t"); + asm ("fldl2e"); + asm ("fldpi"); + asm ("fldlg2"); + asm ("fldln2"); + asm ("fldz"); + asm ("nop"); + + return 1; /* END I387-FLOAT-REVERSE */ +}
i387-env-reverse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: watch-reverse.exp =================================================================== --- watch-reverse.exp (nonexistent) +++ watch-reverse.exp (revision 513) @@ -0,0 +1,198 @@ +# Copyright 2008, 2009, 2010 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 . + +# Based on a file written by Fred Fish. (fnf@cygnus.com) +# This file is part of the GDB testsuite. It tests reverse debugging +# with watchpoints. + + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "watch-reverse" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +# Test software watchpoints +gdb_test_no_output "set can-use-hw-watchpoints 0" "disable hw watchpoints" + +gdb_test "break marker1" \ + "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ + "set breakpoint at marker1" + +gdb_test "break marker2" \ + "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ + "set breakpoint at marker2" + +gdb_continue_to_breakpoint "marker1" ".*/$srcfile:.*" + +gdb_test "watch ival3" \ + ".*\[Ww\]atchpoint $decimal: ival3.*" \ + "set watchpoint on ival3" + +# Continue until first change, from -1 to 0 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, first time" + +# Continue until the next change, from 0 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, second time" + +# Continue until the next change, from 1 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, third time" + +# Continue until the next change, from 2 to 3. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, fourth time" + +# Continue until the next change, from 3 to 4. +# Note that this one is outside the loop. + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, fifth time" + +# Continue until we hit the finishing marker function. +# Make sure we hit no more watchpoints. + +gdb_continue_to_breakpoint "marker2" ".*/$srcfile:.*" + +### +### +### + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +# Reverse until the previous change, from 4 to 3 +# Note that this one is outside the loop + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, first time" + +# Reverse until the previous change, from 3 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, second time" + +# Reverse until the previous change, from 2 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, third time" + +# Reverse until the previous change, from 1 to 0. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, fourth time" + +# Reverse until first change, from 0 to -1 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, fifth time" + +gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints" + +### +### +### + +gdb_test_no_output "set exec-direction forward" "set forward" + +# Continue until first change, from -1 to 0 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, first time" + +# Continue until the next change, from 0 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, second time" + +# Continue until the next change, from 1 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, third time" + +# Continue until the next change, from 2 to 3. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, fourth time" + +# Continue until the next change, from 3 to 4. +# Note that this one is outside the loop. + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit, forward replay, fifth time" + +# Continue until we hit the finishing marker function. +# Make sure we hit no more watchpoints. + +gdb_test "continue" "marker2 .*" "replay forward to marker2" + +### +### +### + +gdb_test_no_output "set exec-direction reverse" "set reverse" + +# Reverse until the previous change, from 4 to 3 +# Note that this one is outside the loop + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, first time" + +# Reverse until the previous change, from 3 to 2. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, second time" + +# Reverse until the previous change, from 2 to 1. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, third time" + +# Reverse until the previous change, from 1 to 0. +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, fourth time" + +# Reverse until first change, from 0 to -1 + +gdb_test "continue" \ + ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \ + "watchpoint hit in reverse, HW, fifth time" + Index: step-precsave.exp =================================================================== --- step-precsave.exp (nonexistent) +++ step-precsave.exp (revision 513) @@ -0,0 +1,271 @@ +# Copyright 2008, 2009, 2010 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 . */ + +# This file is part of the GDB testsuite. It tests reverse stepping. +# Lots of code borrowed from "step-test.exp". + +# +# Test step and next with a reloaded process record file. +# + +# This test suitable only for process record-replay +if ![target_info exists gdb,use_precord] { + return +} + +set testfile "step-reverse" +set srcfile ${testfile}.c + +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +runto main + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + gdb_test_no_output "record" "Turn on process record" +} + +set end_of_main [gdb_get_line_number "end of main" ] +gdb_test "break $end_of_main" \ + "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 step.precsave" \ + "Saved core file step.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 step.precsave" \ + "Program terminated with signal .*" \ + "reload core file" + +# plain vanilla step/next (no count) + +gdb_test "next" ".*NEXT TEST 1.*" "next test 1" +gdb_test "step" ".*STEP TEST 1.*" "step test 1" + +# step/next with count + +gdb_test "next 2" ".*NEXT TEST 2.*" "next test 2" +gdb_test "step 3" ".*STEP TEST 2.*" "step test 2" + +# step over call + +gdb_test "step" ".*NEXT OVER THIS CALL.*" "step up to call" +gdb_test "next" ".*STEP INTO THIS CALL.*" "next over call" + +# step into call + +gdb_test "step" ".*ARRIVED IN CALLEE.*" "step into call" + +# finish out of call + +set test_message "finish out of fn call" +gdb_test_multiple "finish" "$test_message" { + -re "FINISH TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + send_gdb "step\n" + exp_continue + } +} + +# stepi over flat code (no calls) + +set test_message "simple stepi" +gdb_test_multiple "stepi" "$test_message" { + -re "STEPI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "FINISH TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi into a function call + +set test_message "stepi into function call" +gdb_test_multiple "stepi" "$test_message" { + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } +} + +# stepi thru return of a function call + +set test_message "stepi back from function call" +gdb_test_multiple "stepi" "$test_message" { + -re "NEXTI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "ENTER CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +### +### +### + +# Set reverse execution direction + +gdb_test_no_output "set exec-dir reverse" "set reverse execution" + +# stepi backward thru return and into a function + +set stepi_location [gdb_get_line_number "ARRIVED IN CALLEE" "$srcfile"] +set test_message "reverse stepi thru function return" +gdb_test_multiple "stepi" "$test_message" { + -re "NEXTI TEST.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "$hex\[ \t\]*$stepi_location.*ARRIVED IN CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + fail "$test_message (too far)" + } + -re "STEPI TEST.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi backward out of a function call + +set stepi_location [gdb_get_line_number "STEPI TEST" "$srcfile"] +set test_message "reverse stepi from a function call" +gdb_test_multiple "stepi" "$test_message" { + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "ENTER CALLEE.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "STEPI TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# stepi backward over flat code (no calls) + +set stepi_location [gdb_get_line_number "FINISH TEST" "$srcfile"] +set test_message "simple reverse stepi" +gdb_test_multiple "stepi" "$test_message" { + -re "STEPI TEST.*$gdb_prompt $" { + fail "$test_message (start statement)" + } + -re "$hex\[ \t\]*$stepi_location.* FINISH TEST.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } + -re "$stepi_location.* FINISH TEST.*$gdb_prompt $" { + pass "$test_message" + } + -re "STEP INTO THIS CALL.*$gdb_prompt $" { + fail "$test_message (too far)" + } +} + +# step backward into function (thru return) + +set test_message "reverse step into fn call" +gdb_test_multiple "step" "$test_message" { + -re "RETURN FROM CALLEE.*$gdb_prompt $" { + send_gdb "step\n" + exp_continue + } + -re "ARRIVED IN CALLEE.*$gdb_prompt $" { + pass "$test_message" + } +} + +# step backward out of called function (thru call) + +gdb_test "step" ".*STEP INTO THIS CALL.*" "reverse step out of called fn" + +# next backward over call + +gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call" + +# step/next backward with count + +gdb_test "step 3" ".*REVERSE STEP TEST 1.*" "reverse step test 1" +gdb_test "next 2" ".*REVERSE NEXT TEST 1.*" "reverse next test 1" + +# step/next backward without count + +gdb_test "step" ".*STEP TEST 1.*" "reverse step test 2" +gdb_test "next" ".*NEXT TEST 1.*" "reverse next test 2" + + + +# Finish test by running forward to the end. +# FIXME return to this later... +# gdb_test_no_output "set exec-dir forward" "set forward execution" +# gdb_continue_to_end "step-reverse.exp" + Index: solib-reverse.exp =================================================================== --- solib-reverse.exp (nonexistent) +++ solib-reverse.exp (revision 513) @@ -0,0 +1,122 @@ +# Copyright 2009, 2010 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 . + +# This file is part of the GDB testsuite. It tests reverse debugging +# with shared libraries. + +if ![target_info exists gdb,can_reverse] { + return +} + +set testfile "solib-reverse" +set srcfile ${testfile}.c +set libfile "shr2" +set libsrc ${libfile}.c +set library ${objdir}/${subdir}/${libfile}.sl +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } { + untested "Could not compile shared library." + return -1 +} + +set exec_opts [list debug shlib=${library}] + +if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { + untested "Could not compile $binfile." + return -1 +} + +# Start with a fresh gdb. + +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_no_output "record" "Turn on process record" +} + +# +# Test reverse-step over undebuggable solib functions. +# + +# Run forward past some solib function calls. + +set end_part_one [gdb_get_line_number " end part one" "$srcfile"] +set end_part_two [gdb_get_line_number " end part two" "$srcfile"] +gdb_test "until $end_part_one" " end part one.*" "run until end part one" + +gdb_test "reverse-step" " sleep three .*" "reverse-step third sleep" +gdb_test "reverse-step" " sleep two .*" "reverse-step second sleep" +gdb_test "reverse-step" " sleep one .*" \ + "reverse-step first sleep, dynsym resolve" + +gdb_test "reverse-step" " printf three .*" "reverse-step third printf" +gdb_test "reverse-step" " printf two .*" "reverse-step second printf" +gdb_test "reverse-step" " printf one .*" \ + "reverse-step first printf, dynsym resolve" +gdb_test "reverse-step" " generic statement.*" "reverse-step generic" + + +# +# Test reverse-next over undebuggable solib functions. +# + +# Run forward again... + +gdb_test "until $end_part_one" " end part one.*" "forward to end part one" + +gdb_test "reverse-next" " sleep three .*" "reverse-next third sleep" +gdb_test "reverse-next" " sleep two .*" "reverse-next second sleep" +gdb_test "reverse-next" " sleep one .*" \ + "reverse-next first sleep, dynsym resolve" + +gdb_test "reverse-next" " printf three .*" "reverse-next third printf" +gdb_test "reverse-next" " printf two .*" "reverse-next second printf" +gdb_test "reverse-next" " printf one .*" \ + "reverse-next first printf, dynsym resolve" +gdb_test "reverse-next" " generic statement.*" "reverse-next generic" + + +# +# Test reverse-step into debuggable solib function +# + +gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function one" +gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one" +gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one" + +gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function two" +gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two" +gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two" + +# +# Test reverse-next over debuggable solib function +# + +gdb_test "until $end_part_two" " end part two.*" "run until end part two" + +gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one" +gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two" Index: sigall-precsave.exp =================================================================== --- sigall-precsave.exp (nonexistent) +++ sigall-precsave.exp (revision 513) @@ -0,0 +1,435 @@ +# Copyright 2009, 2010 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 . + +if [target_info exists gdb,nosignals] { + verbose "Skipping sigall-reverse.exp because of nosignals." + return +} + +if ![target_info exists gdb,can_reverse] { + return +} + +if $tracelevel then { + strace $tracelevel +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +set testfile sigall-reverse +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested sigall.exp + return -1 +} + +# Make the first signal SIGABRT because it is always supported. +set sig_supported 1 +set thissig "ABRT" + +proc test_one_sig {nextsig} { + global sig_supported + global gdb_prompt + global thissig + + set this_sig_supported $sig_supported + gdb_test "handle SIG$thissig stop print" \ + "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" + gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*" + gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*" + + set need_another_continue 1 + set missed_handler 0 + if $this_sig_supported then { + if { $thissig == "IO" } { + setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" + } + set testmsg "get signal $thissig" + gdb_test_multiple "continue" $testmsg { + -re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" { + fail "$testmsg (wrong location)" + } + -re "Program received signal SIG$thissig.*$gdb_prompt $" { + pass $testmsg + } + -re "Breakpoint.* handle_$thissig.*$gdb_prompt $" { + xfail $testmsg + set need_another_continue 0 + } + } + } + if [ istarget "alpha-dec-osf3*" ] then { + # OSF/1-3.x is unable to continue with a job control stop signal. + # The inferior remains stopped without an event of interest + # and GDB waits forever for the inferior to stop on an event + # of interest. Work around the kernel bug. + if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } { + setup_xfail "alpha-dec-osf3*" + fail "cannot continue from signal $thissig" + set need_another_continue 0 + } + } + + if $need_another_continue then { + if { $thissig == "URG" } { + setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" + } + # Either Lynx or GDB screws up on SIGPRIO + if { $thissig == "PRIO" } { + setup_xfail "*-*-*lynx*" + } + set testmsg "send signal $thissig" + gdb_test_multiple "continue" $testmsg { + -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" { + pass $testmsg + } + -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { + fail "missed breakpoint at handle_$thissig" + set missed_handler 1 + } + } + } + + if { $missed_handler == "0" } then { + set testmsg "advance to $nextsig" + gdb_test_multiple "signal 0" $testmsg { + -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { + pass $testmsg + set sig_supported 1 + } + -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" { + pass $testmsg + set sig_supported 0 + } + } + } + set thissig $nextsig +} + +proc test_one_sig_reverse {prevsig} { + global gdb_prompt + + gdb_test "reverse-continue" "Breakpoint .* handle_$prevsig.*" \ + "reverse to handler of $prevsig" + + set saw_signal 0 + set testmsg "reverse to gen_$prevsig" + gdb_test_multiple "reverse-continue" $testmsg { + -re "Breakpoint.*handle_.*$gdb_prompt " { + pass "$testmsg (un-handled)" + } + -re "Program received signal SIG$prevsig.*$gdb_prompt " { + pass "reverse to signal event, $prevsig" + + set nested_testmsg "reverse signal delivered" + gdb_test_multiple "frame" $nested_testmsg { + -re ".*handle_$prevsig.*$gdb_prompt " { + fail "$nested_testmsg (wrong location)" + } + -re ".*$gdb_prompt " { + pass $nested_testmsg + } + } + + set saw_signal 1 + send_gdb "reverse-continue\n" + exp_continue + } + -re "Breakpoint.*kill.*$gdb_prompt " { + if { $saw_signal } then { + pass "$testmsg (handled)" + } else { + xfail "$testmsg (handled)" + } + } + -re "No more reverse-execution history.*kill.*$gdb_prompt " { + if { $saw_signal } then { + pass "$testmsg (handled)" + } else { + xfail "$testmsg (handled)" + } + } + } +} + +gdb_load $binfile + +runto gen_ABRT + +if [target_info exists gdb,use_precord] { + # Activate process record/replay + 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" + +# Signal handlers must be disabled +gdb_test "handle all nostop noprint" + +gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" + +gdb_test "record save sigall.precsave" \ + "Saved core file sigall.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 sigall.precsave" \ + "Program terminated with signal .*" \ + "reload precord save file" + +# Signal handlers must be re-enabled +gdb_test "handle all stop print" + +# test signal handling +test_one_sig HUP +test_one_sig QUIT +test_one_sig ILL +test_one_sig EMT +test_one_sig FPE +test_one_sig BUS +test_one_sig SEGV +test_one_sig SYS +test_one_sig PIPE +test_one_sig ALRM +test_one_sig URG +test_one_sig TSTP +test_one_sig CONT +test_one_sig CHLD +test_one_sig TTIN +test_one_sig TTOU +test_one_sig IO +test_one_sig XCPU +test_one_sig XFSZ +test_one_sig VTALRM +test_one_sig PROF +test_one_sig WINCH +test_one_sig LOST +test_one_sig USR1 +test_one_sig USR2 +test_one_sig PWR +test_one_sig POLL +test_one_sig WIND +test_one_sig PHONE +test_one_sig WAITING +test_one_sig LWP +test_one_sig DANGER +test_one_sig GRANT +test_one_sig RETRACT +test_one_sig MSG +test_one_sig SOUND +test_one_sig SAK +test_one_sig PRIO +test_one_sig 33 +test_one_sig 34 +test_one_sig 35 +test_one_sig 36 +test_one_sig 37 +test_one_sig 38 +test_one_sig 39 +test_one_sig 40 +test_one_sig 41 +test_one_sig 42 +test_one_sig 43 +test_one_sig 44 +test_one_sig 45 +test_one_sig 46 +test_one_sig 47 +test_one_sig 48 +test_one_sig 49 +test_one_sig 50 +test_one_sig 51 +test_one_sig 52 +test_one_sig 53 +test_one_sig 54 +test_one_sig 55 +test_one_sig 56 +test_one_sig 57 +test_one_sig 58 +test_one_sig 59 +test_one_sig 60 +test_one_sig 61 +test_one_sig 62 +test_one_sig 63 +test_one_sig TERM + +# The last signal (SIGTERM) gets handled slightly differently because +# we are not setting up for another test. +gdb_test "handle SIGTERM stop print" \ + "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" +gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*" +gdb_test "continue" \ + "Continuing.*Program received signal SIGTERM.*" \ + "get signal TERM" +gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM" + +gdb_test "continue" " end of main .*" "continue to sigall exit" + +test_one_sig_reverse TERM +test_one_sig_reverse 63 +test_one_sig_reverse 62 +test_one_sig_reverse 61 +test_one_sig_reverse 60 +test_one_sig_reverse 59 +test_one_sig_reverse 58 +test_one_sig_reverse 57 +test_one_sig_reverse 56 +test_one_sig_reverse 55 +test_one_sig_reverse 54 +test_one_sig_reverse 53 +test_one_sig_reverse 52 +test_one_sig_reverse 51 +test_one_sig_reverse 50 +test_one_sig_reverse 49 +test_one_sig_reverse 48 +test_one_sig_reverse 47 +test_one_sig_reverse 46 +test_one_sig_reverse 45 +test_one_sig_reverse 44 +test_one_sig_reverse 43 +test_one_sig_reverse 42 +test_one_sig_reverse 41 +test_one_sig_reverse 40 +test_one_sig_reverse 39 +test_one_sig_reverse 38 +test_one_sig_reverse 37 +test_one_sig_reverse 36 +test_one_sig_reverse 35 +test_one_sig_reverse 34 +test_one_sig_reverse 33 +test_one_sig_reverse PRIO +test_one_sig_reverse SAK +test_one_sig_reverse SOUND +test_one_sig_reverse MSG +test_one_sig_reverse RETRACT +test_one_sig_reverse GRANT +test_one_sig_reverse DANGER +test_one_sig_reverse LWP +test_one_sig_reverse WAITING +test_one_sig_reverse PHONE +test_one_sig_reverse WIND +test_one_sig_reverse POLL +test_one_sig_reverse PWR +test_one_sig_reverse USR2 +test_one_sig_reverse USR1 +test_one_sig_reverse LOST +test_one_sig_reverse WINCH +test_one_sig_reverse PROF +test_one_sig_reverse VTALRM +test_one_sig_reverse XFSZ +test_one_sig_reverse XCPU +test_one_sig_reverse IO +test_one_sig_reverse TTOU +test_one_sig_reverse TTIN +test_one_sig_reverse CHLD +test_one_sig_reverse CONT +test_one_sig_reverse TSTP +test_one_sig_reverse URG +test_one_sig_reverse ALRM +test_one_sig_reverse PIPE +test_one_sig_reverse SYS +test_one_sig_reverse SEGV +test_one_sig_reverse BUS +test_one_sig_reverse FPE +test_one_sig_reverse EMT +test_one_sig_reverse ILL +test_one_sig_reverse QUIT +test_one_sig_reverse HUP +test_one_sig_reverse ABRT + +# Make the first signal SIGABRT because it is always supported. +set sig_supported 1 +set thissig "ABRT" + +test_one_sig HUP +test_one_sig QUIT +test_one_sig ILL +test_one_sig EMT +test_one_sig FPE +test_one_sig BUS +test_one_sig SEGV +test_one_sig SYS +test_one_sig PIPE +test_one_sig ALRM +test_one_sig URG +test_one_sig TSTP +test_one_sig CONT +test_one_sig CHLD +test_one_sig TTIN +test_one_sig TTOU +test_one_sig IO +test_one_sig XCPU +test_one_sig XFSZ +test_one_sig VTALRM +test_one_sig PROF +test_one_sig WINCH +test_one_sig LOST +test_one_sig USR1 +test_one_sig USR2 +test_one_sig PWR +test_one_sig POLL +test_one_sig WIND +test_one_sig PHONE +test_one_sig WAITING +test_one_sig LWP +test_one_sig DANGER +test_one_sig GRANT +test_one_sig RETRACT +test_one_sig MSG +test_one_sig SOUND +test_one_sig SAK +test_one_sig PRIO +test_one_sig 33 +test_one_sig 34 +test_one_sig 35 +test_one_sig 36 +test_one_sig 37 +test_one_sig 38 +test_one_sig 39 +test_one_sig 40 +test_one_sig 41 +test_one_sig 42 +test_one_sig 43 +test_one_sig 44 +test_one_sig 45 +test_one_sig 46 +test_one_sig 47 +test_one_sig 48 +test_one_sig 49 +test_one_sig 50 +test_one_sig 51 +test_one_sig 52 +test_one_sig 53 +test_one_sig 54 +test_one_sig 55 +test_one_sig 56 +test_one_sig 57 +test_one_sig 58 +test_one_sig 59 +test_one_sig 60 +test_one_sig 61 +test_one_sig 62 +test_one_sig 63 +test_one_sig TERM

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.