aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-11-20 15:36:34 +0000
committerAndrew Cagney <cagney@redhat.com>2003-11-20 15:36:34 +0000
commit039cf96dc4850dfd1de813faa9200bdc4fadb021 (patch)
tree73c69b1f37a3b9413c5f5554fd9dc93178d785d8 /gdb/testsuite/lib
parent90ced0dda19963b5a4f79acb8a0fe8e0fe77e70c (diff)
downloadgdb-039cf96dc4850dfd1de813faa9200bdc4fadb021.zip
gdb-039cf96dc4850dfd1de813faa9200bdc4fadb021.tar.gz
gdb-039cf96dc4850dfd1de813faa9200bdc4fadb021.tar.bz2
2003-11-20 Andrew Cagney <cagney@redhat.com>
* gdb.base/maint.exp: Use gdb_internal_error_resync to recover from the internal error. * lib/gdb.exp (gdb_internal_error_resync): New procedure. Original from Jim Blandy. (gdb_test_multiple): Use gdb_internal_error_resync.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp53
1 files changed, 53 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f3b990d..e2848e3 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -360,6 +360,55 @@ proc gdb_continue_to_breakpoint {name} {
}
+# gdb_internal_error_resync:
+#
+# Answer the questions GDB asks after it reports an internal error
+# until we get back to a GDB prompt. Decline to quit the debugging
+# session, and decline to create a core file. Return non-zero if the
+# resync succeeds.
+#
+# This procedure just answers whatever questions come up until it sees
+# a GDB prompt; it doesn't require you to have matched the input up to
+# any specific point. However, it only answers questions it sees in
+# the output itself, so if you've matched a question, you had better
+# answer it yourself before calling this.
+#
+# You can use this function thus:
+#
+# gdb_expect {
+# ...
+# -re ".*A problem internal to GDB has been detected" {
+# gdb_internal_error_resync
+# }
+# ...
+# }
+#
+proc gdb_internal_error_resync {} {
+ global gdb_prompt
+
+ set count 0
+ while {$count < 10} {
+ gdb_expect {
+ -re "Quit this debugging session\\? \\(y or n\\) $" {
+ send_gdb "n\n"
+ incr count
+ }
+ -re "Create a core file of GDB\\? \\(y or n\\) $" {
+ send_gdb "n\n"
+ incr count
+ }
+ -re "$gdb_prompt $" {
+ # We're resynchronized.
+ return 1
+ }
+ timeout {
+ perror "Could not resync from internal error (timeout)"
+ return 0
+ }
+ }
+ }
+}
+
# gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS
# Send a command to gdb; test the result.
@@ -511,6 +560,10 @@ proc gdb_test_multiple { command message user_code } {
}
set code {
+ -re ".*A problem internal to GDB has been detected" {
+ fail "$message (GDB internal error)"
+ gdb_internal_error_resync
+ }
-re "\\*\\*\\* DOSEXIT code.*" {
if { $message != "" } {
fail "$message";