From 4339e69e64f47a31e706ba9c1e7c00945c1620ff Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 12 Jun 2007 14:44:15 +0000 Subject: [PATCH] * gdb.threads/manythreads.exp: Prevent expect buffer overflow in info threads output. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.threads/manythreads.exp | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c953e57f334..cf5d3b4f1c6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-06-12 Daniel Jacobowitz + + * gdb.threads/manythreads.exp: Prevent expect buffer overflow + in info threads output. + 2007-06-12 Ulrich Weigand Markus Deuling diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp index 903a3b14436..0ceacf538d6 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -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" { -- 2.30.2