delete_breakpoints: Rewrite using gdb_test_multiple

Because delete_breakpoints uses gdb_expect directly, an internal error
results in slow timeouts instead of quickly bailing out.  This patch
rewrites the procedure to use gdb_test_multiple instead, while
preserving the existing general logic ("delete breakpoints" + "info
breakpoints").

gdb/testsuite/
2015-02-23  Pedro Alves  <palves@redhat.com>

	* lib/gdb.exp (delete_breakpoints): Rewrite using
	gdb_test_multiple.
This commit is contained in:
Pedro Alves 2015-02-23 17:35:09 +00:00
parent fd63f640f6
commit d8b901edd1
2 changed files with 29 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2015-02-23 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (delete_breakpoints): Rewrite using
gdb_test_multiple.
2015-02-23 Pedro Alves <palves@redhat.com>
* gdb.base/info-os.c: Include stdlib.h.

View File

@ -181,25 +181,35 @@ proc delete_breakpoints {} {
# we need a larger timeout value here or this thing just confuses
# itself. May need a better implementation if possible. - guo
#
send_gdb "delete breakpoints\n"
gdb_expect 100 {
-re "Delete all breakpoints.*y or n.*$" {
set timeout 100
set msg "delete all breakpoints in delete_breakpoints"
set deleted 0
gdb_test_multiple "delete breakpoints" "$msg" {
-re "Delete all breakpoints.*y or n.*$" {
send_gdb "y\n"
exp_continue
}
-re "$gdb_prompt $" { # This happens if there were no breakpoints
}
timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return }
-re "$gdb_prompt $" {
set deleted 1
}
}
send_gdb "info breakpoints\n"
gdb_expect 100 {
-re "No breakpoints or watchpoints..*$gdb_prompt $" {}
-re "$gdb_prompt $" { perror "breakpoints not deleted" ; return }
-re "Delete all breakpoints.*or n.*$" {
send_gdb "y\n"
exp_continue
if {$deleted} {
# Confirm with "info breakpoints".
set deleted 0
set msg "info breakpoints"
gdb_test_multiple $msg $msg {
-re "No breakpoints or watchpoints..*$gdb_prompt $" {
set deleted 1
}
-re "$gdb_prompt $" {
}
}
timeout { perror "info breakpoints (timeout)" ; return }
}
if {!$deleted} {
perror "breakpoints not deleted"
}
}