From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24255 invoked by alias); 11 Dec 2012 17:53:46 -0000 Received: (qmail 24236 invoked by uid 22791); 11 Dec 2012 17:53:45 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-bk0-f41.google.com (HELO mail-bk0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Dec 2012 17:53:35 +0000 Received: by mail-bk0-f41.google.com with SMTP id jg9so1951384bkc.0 for ; Tue, 11 Dec 2012 09:53:33 -0800 (PST) Received: by 10.204.127.22 with SMTP id e22mr6754935bks.23.1355248413585; Tue, 11 Dec 2012 09:53:33 -0800 (PST) Received: from [192.168.0.105] (bl21-174-113.dsl.telepac.pt. [2.82.174.113]) by mx.google.com with ESMTPS id y11sm17902998bkw.8.2012.12.11.09.53.31 (version=SSLv3 cipher=OTHER); Tue, 11 Dec 2012 09:53:32 -0800 (PST) Message-ID: <50C7731A.7040007@gmail.com> Date: Tue, 11 Dec 2012 17:53:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Yao Qi CC: Pedro Alves , gdb-patches@sourceware.org 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> In-Reply-To: <50C489B3.8050101@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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/msg00350.txt.bz2 On 12/09/2012 12:53 PM, Yao Qi wrote: > On 12/07/2012 10:20 PM, Pedro Alves wrote: >>> >> When pending tracepoint is resolved, breakpoint_modified observer is notified, and then, when tracepoint is downloaded, the breakpoint_modified observer is notified again. >> > Okay. Could you add a comment mentioning this in the test? > Sure. Comments are added in the new version. Thanks. On 12/09/2012 12:53 PM, Yao Qi wrote: > set test "tracepoint on pendfunc2 resolved" > + # It is expected to get two "=breakpoint-modified" notifications. > gdb_expect { > - -re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\"" { > + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" { > + # Pending tracepoint is resolved. > pass "$test" > + exp_continue > + } > + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" { > + # Resolved tracepoint is installed. > + pass "tracepoint on pendfunc2 installed" > } > -re ".*${mi_gdb_prompt}$" { > fail $test Actually, sorry for not thinking of this before, but, it seems to me 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 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. 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. -- Pedro Alves