This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove printf from gdb.threads/manythreads.c


Pedro, thanks for the review.

On 11/08/2012 11:57 PM, Pedro Alves wrote:
> Seems like you're only removing one instance of "Thread ... executing" in the
> .exp file, but I see at least two more.
> 

The new one removes the rest two.

> Okay with that change.  Or since all the thread id array, the argument
> passing to thread_function etc., are all still in place, and I think that
> if I were to investigate/debug a failure in this test, I'd add the printf
> back temporarily, we could leave it there commented out (or enabled with a
> command line option).

With the new patch applied, if we want to get debug output, we can
simply run,

  make check RUNTESTFLAGS='gdb.threads/manythreads.exp DEBUG=1'

otherwise, the printf statement is disabled.  Committed.

-- 
Yao (éå)

gdb/testsuite:

2012-11-14  Yao Qi  <yao@codesourcery.com>

	* gdb.threads/manythreads.c [DEBUG]: Include "stdio.h".
	(thread_function)[DEBUG]: Call 'printf'.
	* gdb.threads/manythreads.exp: Pass '-DDEBUG' to compilation
	command line if 'DEBUG=1' is passed to test.
	Remove a pattern to match inferior's output.
---
 gdb/testsuite/gdb.threads/manythreads.c   |    4 ++++
 gdb/testsuite/gdb.threads/manythreads.exp |   17 +++++++----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/manythreads.c b/gdb/testsuite/gdb.threads/manythreads.c
index a622d99..8cef148 100644
--- a/gdb/testsuite/gdb.threads/manythreads.c
+++ b/gdb/testsuite/gdb.threads/manythreads.c
@@ -20,7 +20,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <pthread.h>
+#ifdef DEBUG
 #include <stdio.h>
+#endif
 #include <limits.h>
 
 void *
@@ -28,7 +30,9 @@ thread_function (void *arg)
 {
   int x = * (int *) arg;
 
+#ifdef DEBUG
   printf ("Thread <%d> executing\n", x);
+#endif /* DEBUG */
 
   return NULL;
 }
diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
index c863ee1..b06a34a 100644
--- a/gdb/testsuite/gdb.threads/manythreads.exp
+++ b/gdb/testsuite/gdb.threads/manythreads.exp
@@ -19,7 +19,13 @@
 
 standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
+set opts { debug }
+if [info exists DEBUG] {
+    # make check RUNTESTFLAGS='gdb.threads/manythreads.exp DEBUG=1'
+    lappend opts "additional_flags=-DDEBUG"
+}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
     return -1
 }
 
@@ -59,9 +65,6 @@ gdb_test_multiple "" "stop threads 1" {
   -re "\\\[\[^\]\]* exited\\\]\r\n" {
     exp_continue
   }
-  -re "Thread \[^\n\]* executing\r\n" {
-    exp_continue
-  }
   -re "Program received signal SIGINT.*$gdb_prompt $" {
     pass "$message"
   }
@@ -113,9 +116,6 @@ remote_expect host 1 {
   -re "\\\[\[^\]\]* exited\\\]\r\n" {
     exp_continue -continue_timer
   }
-  -re "Thread \[^\n\]* executing\r\n" {
-    exp_continue -continue_timer
-  }
   -re "Program received signal SIGINT.*$gdb_prompt $" {
     if { $failed == 0 } {
       fail "check for duplicate SIGINT"
@@ -141,9 +141,6 @@ gdb_test_multiple "" "stop threads 2" {
   -re "\\\[\[^\]\]* exited\\\]\r\n" {
     exp_continue
   }
-  -re "Thread \[^\n\]* executing\r\n" {
-    exp_continue
-  }
   -re "Program received signal SIGINT.*$gdb_prompt $" {
     pass "$message"
   }
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]