Automatic date update in version.in
[binutils-gdb.git] / gdb / testsuite / gdb.reverse / recursion.exp
blob6d7e6d11c4a961201339aee994387a0c52f206ea
1 # Copyright 2008-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16 # This file is part of the GDB testsuite.  It tests reverse stepping
17 # out of recursive functions.
19 require supports_reverse
21 standard_testfile
23 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
24     return -1
27 runto_main
29 if [supports_process_record] {
30     # Activate process record/replay
31     gdb_test_no_output "record" "turn on process record"
34 set end_of_program [gdb_get_line_number "END OF MAIN" "$srcfile"]
35 gdb_breakpoint $end_of_program
36 gdb_continue_to_breakpoint ".*$srcfile/$end_of_program.*"
38 ## test if GDB can reverse over a recursive program
39 gdb_test "reverse-next" ".*int j = foo.*" "Skipping recursion from outside"
40 ## setup and next over a recursion for inside a recursive call
41 repeat_cmd_until "reverse-step" ".*" ".*foo .x=4.*"
42 gdb_test "reverse-next" ".*return foo.*" "Skipping recursion from inside"
43 gdb_test "reverse-next" ".*foo .x=5.*" "print frame when stepping out"
44 gdb_test "reverse-next" ".*bar .x=5.*" "stepping into a different function"
45 gdb_test "reverse-next" "main .. at .*" "stepping back to main"