* gdb.threads/manythreads.exp: Prevent expect buffer overflow
authorDaniel Jacobowitz <drow@false.org>
Tue, 12 Jun 2007 14:44:15 +0000 (14:44 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 12 Jun 2007 14:44:15 +0000 (14:44 +0000)
in info threads output.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/manythreads.exp

index c953e57f334820ddbc37d4433d5446d7c85ed618..cf5d3b4f1c6f5d7cabee9bbe2f2926a4713ec524 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-12  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb.threads/manythreads.exp: Prevent expect buffer overflow
+       in info threads output.
+
 2007-06-12  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
            Markus Deuling  <deuling@de.ibm.com>
 
index 903a3b1443656cb38fbcc9a7423a39987f388929..0ceacf538d6f49ce9a1b71aaf7e7abde48ca668f 100644 (file)
@@ -81,7 +81,25 @@ gdb_test_multiple "" "stop threads 1" {
   }
 }
 
-gdb_test "info threads" ".*1 Thread .*"
+set cmd "info threads"
+set ok 0
+gdb_test_multiple $cmd $cmd {
+    -re " 1 Thread " {
+       set ok 1
+       exp_continue
+    }
+    -re ".*\r\n" {
+       # Eat this line and continue, to prevent the buffer overflowing.
+       exp_continue
+    }
+    -re "$gdb_prompt $" {
+       if { $ok } {
+           pass $cmd
+       } else {
+           fail $cmd
+       }
+    }
+}
 
 set message "second continue"
 gdb_test_multiple "continue" "second continue" {