From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 3/3] Match output in async mode.
Date: Fri, 25 May 2012 09:56:00 -0000 [thread overview]
Message-ID: <1337939766-1579-4-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1337939766-1579-1-git-send-email-yao@codesourcery.com>
This patch is to match the program's output when in async mode. It is
hard to match output in a unique way to handle both sync mode and
async mode, so I have to handle them separately.
The reason I choose send_gdb/gdb_expect, instead of gdb_test_multiple,
is gdb_test_multiple matches ""\r\n$gdb_prompt $", and return false.
However, "(gdb) " may appear in somewhere in the output, and trigger
fail for test.
With this patch, I run py-finish-breakpoint.exp 40 times in both
sync mode and async mode, no fail show up.
gdb/testsuite:
2012-05-25 Yao Qi <yao@codesourcery.com>
Fix PR 14135.
* gdb.python/py-finish-breakpoint.exp: Match output in async
mode.
---
gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 69 ++++++++++++++++++--
1 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index c601e85..4ab15e7 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -65,6 +65,22 @@ if ![runto_main] then {
}
gdb_test_no_output "set confirm off" "disable confirmation"
+
+set async "unknown"
+global gdb_prompt
+send_gdb "show target-async\n"
+gdb_expect {
+ -re ".*Controlling the inferior in asynchronous mode is on.*$gdb_prompt $" {
+ set async 1
+ }
+ -re ".*$gdb_prompt $" {
+ set async 0
+ }
+ timeout {
+ set async 0
+ }
+}
+
gdb_test "source $python_file" "Python script imported.*" \
"import python scripts"
gdb_breakpoint "increase_1"
@@ -169,9 +185,22 @@ gdb_test "break ${cond_line} if test_1(i,8)" "Breakpoint .* at .*" \
"set a conditional BP"
gdb_test "python TestBreakpoint()" "TestBreakpoint init" \
"set FinishBP in a breakpoint condition"
-gdb_test "continue" \
- "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \
- "don't allow FinishBreakpoint on dummy frames"
+
+set test "don't allow FinishBreakpoint on dummy frames"
+
+if {$async} {
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "\"FinishBreakpoint\" cannot be set on a dummy frame\\..* Condition Break\. " {
+ pass $test
+ }
+ }
+} else {
+ gdb_test "continue" \
+ "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \
+ $test
+}
+
gdb_test "print i" "8" "check stopped location"
#
@@ -194,12 +223,38 @@ gdb_test "break ${cond_line} if test(i,8)" \
"Breakpoint .* at .*" "set conditional BP"
gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in condition"
-gdb_test "continue" \
- "test don't stop: 1.*test don't stop: 2.*test stop.*Error in testing breakpoint condition.*The program being debugged stopped while in a function called from GDB.*" \
- "stop in condition function"
+set test "stop in condition function"
+
+if {$async} {
+
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "continue.*Continuing\\..*test don't stop: 1.*test don't stop: 2.*test stop.*Error in testing breakpoint condition.*The program being debugged stopped while in a function called from GDB.*Breakpoint " {
+ pass $test
+ }
+
+ timeout { fail "$test (timeout)" }
+ }
+} else {
+ gdb_test "continue" \
+ "test don't stop: 1.*test don't stop: 2.*test stop.*Error in testing breakpoint condition.*The program being debugged stopped while in a function called from GDB.*" \
+ $test
+}
gdb_test "continue" "Continuing.*" "finish condition evaluation"
-gdb_test "continue" "Breakpoint.*" "stop at conditional breakpoint"
+
+set test "stop at conditional breakpoint"
+if {$async} {
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "continue.*Breakpoint.* Condition Break\\. " {
+ pass $test
+ }
+ }
+} else {
+ gdb_test "continue" "Breakpoint.*" $test
+}
+
gdb_test "print i" "8" "check stopped location"
#
--
1.7.0.4
next prev parent reply other threads:[~2012-05-25 9:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 9:56 Fix PR14135 Yao Qi
2012-05-25 9:56 ` [PATCH 2/3] Don't force interpreter sync mode in execute_gdb_command Yao Qi
2013-07-30 19:55 ` Tom Tromey
2013-07-30 20:13 ` Tom Tromey
2012-05-25 9:56 ` [PATCH 1/3] New test case for PR12929 Yao Qi
2013-07-30 19:49 ` Tom Tromey
2013-07-30 20:11 ` Tom Tromey
2013-07-31 7:53 ` Yao Qi
2013-07-31 15:19 ` Tom Tromey
2013-08-01 6:39 ` Yao Qi
2012-05-25 9:56 ` Yao Qi [this message]
2013-07-30 20:06 ` [PATCH 3/3] Match output in async mode Tom Tromey
2013-07-31 7:45 ` Yao Qi
2012-07-17 2:51 ` Fix PR14135 Yao Qi
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=1337939766-1579-4-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.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