From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3572 invoked by alias); 25 May 2012 09:56:44 -0000 Received: (qmail 3557 invoked by uid 22791); 25 May 2012 09:56:43 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 May 2012 09:56:23 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SXrFv-00024R-7R from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 25 May 2012 02:56:23 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 25 May 2012 02:56:23 -0700 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Fri, 25 May 2012 02:56:22 -0700 From: Yao Qi To: Subject: [PATCH 3/3] Match output in async mode. Date: Fri, 25 May 2012 09:56:00 -0000 Message-ID: <1337939766-1579-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1337939766-1579-1-git-send-email-yao@codesourcery.com> References: <1337939766-1579-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00964.txt.bz2 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 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