Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <luisgpm@linux.vnet.ibm.com>, 	"'Daniel Jacobowitz'" <drow@false.org>
Cc: <gdb-patches@sourceware.org>
Subject: [RFC/RFA] testsuite/gdb.base/watch_thread_num.exp: Fix test for systems having hidden threads
Date: Wed, 19 Dec 2007 13:05:00 -0000	[thread overview]
Message-ID: <000601c8423e$f49ca010$ddd5e030$@u-strasbg.fr> (raw)
In-Reply-To: <1197894945.24027.8.camel@gargoyle>

This test currently fails on cygwin target
and it does by timeout's which means that it takes a lot of time...
The reason of the failure is that 
thread #2 is a thread created internally by cygwin,
for posix emulation, and thus never
changes the value of the variable shared_var.
  
  I modified the test so that it does
not suppose that thread 2 is one of the explicitly generated
threads, but instead adds a breakpoint to
thread_function, and reads the thread number of the first
explicitly generated thread.
  I also added an iteration number to the final test loop.

  I am mainly unsure about the details
required for the ChangeLog entry...

  I only tested the patch on Cygwin target where it gives
29 passes, but I expect it to give the same results
on other targets that had no failures before.

  One possible problem is about the $expect_out(1,string)
because this is undefined if the first pattern is not found.
But I suppose that this is not unique to my patch,
as lots of gdb_expect calls only have braces
to define a group that will become the $expect_out return values
in only one regular expression.

  Is there a coding rule for this?

Pierre Muller


testsuite directory ChangeLog entry

2007-12-19  Pierre Muller  <muller@ics-u-strasbg.fr>

	* (gdb.base/watch_thread_num.exp): Add breakpoint at
	thread_function and record first explicitly generated
	thread number. 
	Use that thread number for thread specific watchpoint test.
	Add iteration number to repetitive tests.

$ cat threadwatch.patch
Index: gdb/testsuite/gdb.base/watch_thread_num.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watch_thread_num.exp,v
retrieving revision 1.1
diff -u -p -r1.1 watch_thread_num.exp
--- gdb/testsuite/gdb.base/watch_thread_num.exp 17 Dec 2007 12:32:23 -00001.1
+++ gdb/testsuite/gdb.base/watch_thread_num.exp 19 Dec 2007 08:45:41 -0000
@@ -54,11 +54,28 @@ gdb_test "watch shared_var thread" "A sy

 gdb_test "Next 5" ""

-gdb_test "watch shared_var thread 2" "Hardware watchpoint 2: shared_var" "Watch
point on shared variable"
-gdb_test "info breakpoint 2" "stop only in thread 2"
+gdb_test "break thread_function" "Breakpoint \[0-9\].*" \
+  "Set breakpoint at thread_function"

-for {set i 0} {$i < 10} {incr i 1} {
-gdb_test "continue" "Hardware watchpoint 2: shared_var.*" "Watchpoint triggered
"
-gdb_test "thread" "\\\[Current thread is 2 \\\(Thread $hex \\\(LWP $decimal\\\)
\\\)\\\]" "Check thread that triggered"
+gdb_test "continue" ".*Breakpoint 2.*" "Stopped in thread_function"
+
+send_gdb "thread\n"
+gdb_expect {
+  -re ".*Current thread is (\[0-9\]*).*$gdb_prompt $" { pass "Thread command" }
+  -re ".*$gdb_prompt $" { fail "Thread command" }
+  timeout { fail "(timeout) Thread command" }
+}
+
+set thread_num "$expect_out(1,string)"
+
+gdb_test "disable 2" "" "Disable breakpoint 2"
+gdb_test "watch shared_var thread $thread_num" "Hardware watchpoint 3: shared_v
ar" "Watchpoint on shared variable"
+gdb_test "info breakpoint 3" "stop only in thread $thread_num"
+
+for {set i 1} {$i <= 10} {incr i 1} {
+gdb_test "continue" "Hardware watchpoint 3: shared_var.*" \
+  "Watchpoint triggered iteration $i"
+gdb_test "thread" ".*Current thread is $thread_num .*" \
+  "Check thread that triggered iteration $i"
 }




  reply	other threads:[~2007-12-19 12:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 21:03 [patch] Watchpoints: support for thread <thread_num> parameters Luis Machado
2007-08-17 10:24 ` Eli Zaretskii
2007-08-17 15:47   ` Luis Machado
2007-08-17 18:41     ` Eli Zaretskii
2007-08-17 18:50       ` Daniel Jacobowitz
2007-08-20 14:28         ` Luis Machado
2007-08-20 14:21           ` Daniel Jacobowitz
2007-08-20 15:23             ` Luis Machado
2007-08-20 15:29               ` Daniel Jacobowitz
2007-08-23 21:08                 ` Joel Brobecker
2007-08-23 21:15                   ` Luis Machado
2007-10-11 19:40     ` Daniel Jacobowitz
2007-10-11 20:33       ` Luis Machado
2007-11-13 14:50         ` Luis Machado
2007-11-13 15:38           ` Andreas Schwab
2007-11-13 22:30           ` Eli Zaretskii
2007-11-14 12:20             ` Luis Machado
2007-11-30 16:10               ` Luis Machado
2007-12-16 21:50               ` Daniel Jacobowitz
2007-12-17 13:29                 ` Luis Machado
2007-12-19 13:05                   ` Pierre Muller [this message]
2007-12-19 13:56                     ` [RFC/RFA] testsuite/gdb.base/watch_thread_num.exp: Fix test for systems having hidden threads Luis Machado
2007-12-19 14:04                       ` Pierre Muller
2007-12-19 14:05                     ` 'Daniel Jacobowitz'
2007-12-19 14:55                       ` Pierre Muller
2007-12-19 15:04                         ` 'Daniel Jacobowitz'

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000601c8423e$f49ca010$ddd5e030$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=luisgpm@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox