This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix overflow in manythreads.exp
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Tue, 12 Jun 2007 10:45:35 -0400
- Subject: [commit] Fix overflow in manythreads.exp
If your target is slow, and the paths to your shared libraries are
long, "info threads" can overflow expect's buffer size. This patch
eats its output one line at a time, to avoid the expect internal
error.
Tested on x86_64-linux and committed.
--
Daniel Jacobowitz
CodeSourcery
2007-06-12 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.threads/manythreads.exp: Prevent expect buffer overflow
in info threads output.
Index: gdb.threads/manythreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/manythreads.exp,v
retrieving revision 1.5
diff -u -p -r1.5 manythreads.exp
--- gdb.threads/manythreads.exp 2 Mar 2007 22:16:06 -0000 1.5
+++ gdb.threads/manythreads.exp 4 Jun 2007 17:31:45 -0000
@@ -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" {