2003-11-20 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Thu, 20 Nov 2003 15:36:34 +0000 (15:36 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 20 Nov 2003 15:36:34 +0000 (15:36 +0000)
* 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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/lib/gdb.exp

index 82f158d24372760d0f102cb4402c103925ec291e..04928ed90b6bbdd168547c95f519346e79078ee4 100644 (file)
@@ -1,3 +1,11 @@
+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.
+       
 2003-11-19  Andrew Cagney  <cagney@redhat.com>
 
        * gdb.base/callfuncs.exp: Change the XFAILed descriptor test to a
index f82bf0202b0f415193c27c5395c32b00be23ebfa..212d1064b169be2cf77d31c1c096af635c97d66b 100644 (file)
@@ -650,34 +650,22 @@ gdb_expect  {
         }
 
 send_gdb "maint internal-error\n"
-gdb_expect  {
-    -re "Quit this debugging session.*\\(y or n\\) $" {
-       send_gdb "n\n"
-       gdb_expect {
-           -re "Create a core file.*\\(y or n\\) $" {
-               send_gdb "n\n"
-               gdb_expect {
-                   -re ".*$gdb_prompt $" {
-                       pass "maint internal-error"
-                   }
-                   timeout {
-                       fail "(timeout)  maint internal-error"
-                   }
-               }
-           }
-           -re ".*$gdb_prompt $" {
-               fail "maint internal-error"
-           }
-           timeout {
-               fail "(timeout)  maint internal-error"
-           }
+gdb_expect {
+    -re "A problem internal to GDB has been detected" {
+       pass "maint internal-error"
+       if [gdb_internal_error_resync] {
+           pass "internal-error resync"
+       } else {
+           fail "internal-error resync"
        }
     }
     -re ".*$gdb_prompt $" {
        fail "maint internal-error"
+       untested "internal-error resync"
     }
     timeout {
-       fail "(timeout) maint internal-error"
+       fail "maint internal-error (timeout)"
+       untested "internal-error resync"
     }
 }
 
index f3b990d678d42622f889815d586dc058849de268..e2848e31b9212eed778737f1b3ef206ff51012b3 100644 (file)
@@ -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";
This page took 0.038473 seconds and 4 git commands to generate.