From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH] fix spurious FAIL in py-inferior.exp (x86-solaris)
Date: Fri, 04 Mar 2011 11:31:00 -0000 [thread overview]
Message-ID: <1299238268-32142-1-git-send-email-brobecker@adacore.com> (raw)
The inferior is single-threaded, but on x86-solaris, GDB says
that the program has two entries in the thread list:
(gdb) info threads
Id Target Id Frame
* 2 Thread 1 (LWP 1) f2 (a=1) at /[...]/py-inferior.c:20
1 LWP 1 f2 (a=1) at /[...]/py-inferior.c:20
As a result, the test that prints the list of threads trips
because the expected output assumes only one thread.
The regular expression I used to match is a little complicated because
of the case where there is only one element -vs- the case where there
is more than one. In the first case, the last element is followed by
a comma. In the second case, it's not. I tried to make it easier
to read by using a variable that factorizes the expression matching
a thread object, as well as makes it shorter and easier to read.
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.exp: Adjust expected output of
test printing the list of threads as seen by Python, to
allow the list to contain more than 1 thread.
Tested on x86-solaris and x86_64-linux.
---
gdb/testsuite/gdb.python/py-inferior.exp | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 138c0fb..07c7801 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -64,7 +64,12 @@ gdb_test "python print 'result =', i0 == inferiors\[0\]" " = True" "test equalit
gdb_test "python print 'result =', i0.num" " = \[0-9\]+" "test Inferior.num"
gdb_test "python print 'result =', i0.pid" " = \[0-9\]+" "test Inferior.pid"
gdb_test "python print 'result =', i0.was_attached" " = False" "test Inferior.was_attached"
-gdb_test "python print i0.threads ()" "\\(<gdb.InferiorThread object at 0x\[\[:xdigit:\]\]+>,\\)" "test Inferior.threads"
+# Print the list of threads in inferior 0. Althought this inferior
+# does not use threads, the list of threads may in fact show more
+# than 1 thread. We've seen this on x86-solaris where "info threads"
+# shows 1 thread and 1 LWP.
+set thread_re "<gdb.InferiorThread object at 0x\[\[:xdigit:\]\]+>"
+gdb_test "python print i0.threads ()" "\\(${thread_re}((, ${thread_re})*|,)\\)" "test Inferior.threads"
# Test memory read and write operations.
--
1.7.1
next reply other threads:[~2011-03-04 11:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 11:31 Joel Brobecker [this message]
2011-03-04 12:18 ` Mark Kettenis
2011-03-04 12:27 ` Pedro Alves
2011-03-07 5:05 ` Joel Brobecker
2011-03-07 5:21 ` Jan Kratochvil
2011-03-07 10:52 ` Pedro Alves
2011-03-07 9:49 ` Mark Kettenis
2011-03-07 10:16 ` Joel Brobecker
2011-03-07 11:02 ` Pedro Alves
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=1299238268-32142-1-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/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