+ }
+}
+
+proc advancei { cmd } {
+ global gdb_prompt inferior_exited_re
+
+ with_test_prefix "$cmd from handleri" {
+ restart
+
+ # Get us into the handler.
+ gdb_test "break handler"
+ gdb_test "continue" ".* handler .*" "continue to handler"
+
+ set program_exited 0
+ set test "leave handler"
+ gdb_test_multiple "$cmd" "${test}" {
+ -re "Cannot insert breakpoint 0.*${gdb_prompt} $" {
+ # Some platforms use a special read-only page for signal
+ # trampolines. We can't set a breakpoint there, and we
+ # don't gracefully fall back to single-stepping.
+ setup_kfail gdb/8841 "i?86-*-linux*"
+ setup_kfail gdb/8841 "*-*-openbsd*"
+ setup_kfail gdb/8841 "nios2-*-linux*"
+ fail "$test (could not set breakpoint)"
+ return
+ }
+ -re "Could not insert single-step breakpoint.*$gdb_prompt $" {
+ setup_kfail gdb/8841 "sparc*-*-openbsd*"
+ fail "$test (could not insert single-step breakpoint)"
+ }
+ -re "Breakpoint \[0-9\]*, handler .*${gdb_prompt} $" {
+ fail "$test (hit breakpoint again)"
+ }
+ -re "done = 1;.*${gdb_prompt} $" {
+ send_gdb "$cmd\n"
+ exp_continue -continue_timer
+ }
+ -re "\} .. handler .*${gdb_prompt} $" {
+ send_gdb "$cmd\n"
+ exp_continue -continue_timer
+ }
+ -re "signal handler called.*${gdb_prompt} $" {
+ pass "$test"
+ }
+ -re "main .*${gdb_prompt} $" {
+ fail "$test (in main)"
+ }
+ -re "$inferior_exited_re normally.*${gdb_prompt} $" {
+ fail "$test (program exited)"
+ set program_exited 1
+ }
+ -re "Make handler return now.*y or n. $" {
+ send_gdb "y\n"
+ exp_continue -continue_timer
+ }