This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Check threads after using agent
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Fri, 17 Feb 2012 15:38:49 +0800
- Subject: [patch] Check threads after using agent
In Pedro's explanation on why we should stop "debugging thread" before
access inferior via ptrace [1], `info threads' is used to expose the
problem and answer the question. I think it is worth adding it into
test suite.
If we don't stop "debugging thread" when running inferior command, in
this test, we will get a fail.
info threads 3 2 1^M
[New Thread 32316]^M
[New Thread 32317]^M
Id Target Id Frame ^M
3 Thread 32317 Remote failure reply: E01^M
(gdb) FAIL: gdb.trace/strace.exp: info_marker info threads
This test is to about checking thread 1,2,3 can be listed without error.
OK to apply?
--
Yao (éå)
[1] http://sourceware.org/ml/gdb-patches/2012-02/msg00257.html
gdb/testsuite/
2012-02-17 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
* gdb.trace/strace.exp (strace_info_marker): Test `info threads'.
---
gdb/testsuite/gdb.trace/strace.exp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index e8e63b8..2ba177d 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -41,6 +41,7 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_flags
proc strace_info_marker { } {
global executable
global pf_prefix
+ global gdb_prompt
set old_pf_prefix $pf_prefix
lappend pf_prefix "info_marker"
@@ -58,6 +59,13 @@ proc strace_info_marker { } {
gdb_test "info static-tracepoint-markers" \
".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*"
+ # List all the thread. It is expected to get three threads without
+ # any errors.
+ gdb_test_multiple "info threads 3 2 1" "info threads" {
+ -re "3\[ \t\]+Thread .*2\[ \t\]+Thread .*1\[ \t\]+Thread .*${gdb_prompt} $" {
+ pass "info threads"
+ }
+ }
set pf_prefix $old_pf_prefix
}
--
1.7.0.4