From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25661 invoked by alias); 12 Dec 2012 02:59:35 -0000 Received: (qmail 25651 invoked by uid 22791); 12 Dec 2012 02:59:34 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,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; Wed, 12 Dec 2012 02:59:26 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TicXd-0005l7-69 from Yao_Qi@mentor.com ; Tue, 11 Dec 2012 18:59:25 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 11 Dec 2012 18:59:25 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Tue, 11 Dec 2012 18:59:23 -0800 Message-ID: <50C7F30C.1050906@codesourcery.com> Date: Wed, 12 Dec 2012 02:59:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Pedro Alves CC: Pedro Alves , Subject: Re: [PATCH 5/6] Test tracepoints are installed or not References: <1354596282-32526-1-git-send-email-yao@codesourcery.com> <1354596282-32526-6-git-send-email-yao@codesourcery.com> <50C1E38F.2020108@redhat.com> <50C1F553.8030502@codesourcery.com> <50C1FB3A.8050802@redhat.com> <50C489B3.8050101@codesourcery.com> <50C7731A.7040007@gmail.com> In-Reply-To: <50C7731A.7040007@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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-12/txt/msg00372.txt.bz2 On 12/12/2012 01:53 AM, Pedro Alves wrote: > Actually, sorry for not thinking of this before, but, it seems to me Never mind, your comments are always welcome :) > this use of pass+exp_continue is fragile. Say a GDB bug is > introduced, and the second =breakpoint-modified fails to be output. In > that case, this will result in: > > PASS: tracepoint on pendfunc2 resolved > FAIL: tracepoint on pendfunc2 resolved > > instead of > PASS: tracepoint on pendfunc2 resolved > FAIL: tracepoint on pendfunc2 installed > My intention of using exp_coutine here is to handle the situation that notifications may arrive in different orders. The fail message is not clear, but not a big deal, to me. It is important to catch a fail and then we can check gdb.log and test case to fix it. > You could fix that by doing: > > + # Pending tracepoint is resolved. > pass "$test" > + set test "tracepoint on pendfunc2 installed" > + exp_continue > > But then, if the order of the notifications changes (IOW, due to a bug, > we end up with the tracepoint not installed), this won't catch it. Looks the fix is worse than the original one, at least no fail is missing in the original one. > It seems best to me to only use exp_continue in cases we won't to > consume/skip output, and in the case of this patch, split the two > tests into two consecutive gdb_expects. If this way, we can't handle that two notifications arrive in a reversed order (which is also correct). If we don't have to worry about the order (after all, the order of MI notifications are still deterministic nowadays), I am OK with your suggestion. -- Yao (齐尧) gdb/testsuite: 2012-12-12 Yao Qi * gdb.trace/mi-tracepoint-changed.exp (test_pending_resolved): Check 'installed' field in '=breakpoint-modified'. (test_reconnect): Check 'installed' field in '=breakpoint-modified' and '=breakpoint-created'. --- gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp | 27 ++++++++++++++------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp index 2913b12..0073d4b 100644 --- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp @@ -133,13 +133,18 @@ proc test_reconnect { } { with_test_prefix "reconnect" { fail "$test: 2" exp_continue } - -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*${mi_gdb_prompt}" { + -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*installed=\"y\"" { # A tracepoint on main was defined in the stub, not in GDB, # so we should see a =breakpoint-created notification. pass $test } - timeout { - fail $test + } + # Tracepoint on marker is defined. After the sync, we know that + # the tracepoint is in remote stub. Mark it 'installed'. + set test "tracepoint on marker is installed" + gdb_expect { + -re "=breakpoint-modified,bkpt=\{number=\"2\".*,func=\"marker\".*installed=\"y\".*${mi_gdb_prompt}$" { + pass "$test" } } # Check that tracepoint 1 is still pending. @@ -188,18 +193,22 @@ proc test_pending_resolved { } { with_test_prefix "pending resolved" { mi_send_resuming_command "exec-continue" "continuing execution to marker 1" + # It is expected to get two "=breakpoint-modified" notifications. + # Pending tracepoint is resolved. set test "tracepoint on pendfunc2 resolved" gdb_expect { - -re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\"" { + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" { pass "$test" } - -re ".*${mi_gdb_prompt}$" { - fail $test - } - timeout { - fail "$test (timeout)" + } + # Resolved tracepoint is installed. + set test "tracepoint on pendfunc2 installed" + gdb_expect { + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" { + pass "$test" } } + mi_expect_stop "breakpoint-hit" "marker" ".*" ".*" ".*" \ {"" "disp=\"keep\""} "continue to marker" -- 1.7.7.6