gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call"
set step_out 0
+set max_iterations 1000
gdb_test_multiple "next" "reverse next over recursion" {
-re -wrap ".*NEXT OVER THIS RECURSION.*" {
pass "$gdb_test_name"
}
}
if { "$step_out" == 1 } {
+ set iterations 0
gdb_test_multiple "next" "stepping out of recursion" {
- -re -wrap "NEXT OVER THIS RECURSION.*" {
+ -re -wrap "^main.*NEXT OVER THIS RECURSION.*" {
set step_out 0
+ pass "$gdb_test_name"
}
- -re -wrap ".*" {
+ -re -wrap "^\[0-9\].*" {
+ incr iterations
+ if { $iterations == $max_iterations } {
+ fail "$gdb_test_name (reached $max_iterations iterations)"
+ return
+ }
+
send_gdb "next\n"
exp_continue
}
gdb_test "step" ".*EXIT RECURSIVE FUNCTION.*" "enter recursive function"
set seen_recursive_call 0
+set iterations 0
gdb_test_multiple "next" "step over recursion inside the recursion" {
-re -wrap ".*RECURSIVE CALL.*" {
incr seen_recursive_call
+ incr iterations
+ if { $iterations == $max_iterations } {
+ fail "$gdb_test_name (reached $max_iterations iterations)"
+ return
+ }
+
send_gdb "next\n"
exp_continue
}
gdb_assert {"$seen_recursive_call" == 1} \
"step over recursion inside the recursion"
}
- -re -wrap ".*" {
+ -re -wrap "^\[0-9\].*" {
+ incr iterations
+ if { $iterations == $max_iterations } {
+ fail "$gdb_test_name (reached $max_iterations iterations)"
+ return
+ }
+
send_gdb "next\n"
exp_continue
}