From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8857 invoked by alias); 27 Feb 2013 01:37:23 -0000 Received: (qmail 8849 invoked by uid 22791); 27 Feb 2013 01:37:22 -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, 27 Feb 2013 01:37:18 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UAVxN-0001Nq-1F from Yao_Qi@mentor.com ; Tue, 26 Feb 2013 17:37:17 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 26 Feb 2013 17:37:17 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Tue, 26 Feb 2013 17:37:16 -0800 Message-ID: <512D6315.7030805@codesourcery.com> Date: Wed, 27 Feb 2013 01:37:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH 2/2] Find the next matched trace file in 'tfile target'. References: <1361761061-9625-1-git-send-email-yao@codesourcery.com> <1361761061-9625-2-git-send-email-yao@codesourcery.com> <512D129B.6040504@redhat.com> In-Reply-To: <512D129B.6040504@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed 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: 2013-02/txt/msg00666.txt.bz2 On 02/27/2013 03:52 AM, Pedro Alves wrote: > I'm confused on why this bit of the predicate > > (tfnum == traceframe_number && tfnum == 0) > > is necessary. traceframe_number is -1 when not looking > at a traceframe yet, so "tfnum > traceframe_number" > should be sufficient, no? > This condition was added to handle the case like this below: (gdb) tfind 0 Found trace frame 0, tracepoint 2 (gdb) tfind tracepoint 2 Found trace frame 0, tracepoint 2 It is not necessary, and doesn't match the documentation. We start from trace frame zero, and look for *next* frame from trace frame one. This predicate can be removed. > I find it clearer to move the frame skipping a bit higher > up, even before the specific tfind tp/range/etc. matching. > Doing it this way also avoids unnecessary read/lseek system > calls done by tfile_get_traceframe_address. > > WDYT? > That makes sense to me. > > Regression tested on x86_64 Fedora 17. > > gdb/ > 2013-02-25 Yao Qi > Pedro Alves > > * tracepoint.c (tfile_trace_find): For tfind > pc/tp/range/outside, look for the next trace frame instead of > always starting from frame 0. Committed. -- Yao (齐尧)