From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25347 invoked by alias); 25 Feb 2013 02:58:52 -0000 Received: (qmail 25331 invoked by uid 22791); 25 Feb 2013 02:58:51 -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; Mon, 25 Feb 2013 02:58:45 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1U9oH6-00002n-Gr from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sun, 24 Feb 2013 18:58:44 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 24 Feb 2013 18:58:44 -0800 Received: from qiyao.dyndns.org.dyndns.org (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; Sun, 24 Feb 2013 18:58:09 -0800 From: Yao Qi To: Subject: [PATCH 2/2] Find the next matched trace file in 'tfile target'. Date: Mon, 25 Feb 2013 02:58:00 -0000 Message-ID: <1361761061-9625-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1361761061-9625-1-git-send-email-yao@codesourcery.com> References: <1361761061-9625-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: 2013-02/txt/msg00612.txt.bz2 The previous patch exposes a bug in tfile target when finding a trace frame. Every time, GDB will scan tfile from the starting offset and initialize trace frame number to zero. When TYPE is not tfind_number, it means GDB wants to find the *next* matched trace frame of current one. So we need to check the tfile trace frame number iterator is greater than the current trace frame number (which means *next*). This is mainly what this patch does. Regression tested on x86_64-linux. gdb: 2013-02-25 Yao Qi * tracepoint.c (tfile_trace_find): Find the next matched trace frame. --- gdb/tracepoint.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index ca104aa..f7a3650 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4324,22 +4324,34 @@ tfile_trace_find (enum trace_find_type type, int num, break; case tfind_pc: tfaddr = tfile_get_traceframe_address (tframe_offset); - if (tfaddr == addr1) + if (tfaddr == addr1 + /* Looks for the next trace frame if matched. */ + && (tfnum > traceframe_number + || (tfnum == traceframe_number && tfnum == 0))) found = 1; break; case tfind_tp: tp = get_tracepoint (num); - if (tp && tpnum == tp->number_on_target) + if (tp && tpnum == tp->number_on_target + /* Looks for the next trace frame if matched. */ + && (tfnum > traceframe_number + || (tfnum == traceframe_number && tfnum == 0))) found = 1; break; case tfind_range: tfaddr = tfile_get_traceframe_address (tframe_offset); - if (addr1 <= tfaddr && tfaddr <= addr2) + if (addr1 <= tfaddr && tfaddr <= addr2 + /* Looks for the next trace frame if matched. */ + && (tfnum > traceframe_number + || (tfnum == traceframe_number && tfnum == 0))) found = 1; break; case tfind_outside: tfaddr = tfile_get_traceframe_address (tframe_offset); - if (!(addr1 <= tfaddr && tfaddr <= addr2)) + if (!(addr1 <= tfaddr && tfaddr <= addr2) + /* Looks for the next trace frame if matched. */ + && (tfnum > traceframe_number + || (tfnum == traceframe_number && tfnum == 0))) found = 1; break; default: -- 1.7.7.6