From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37335 invoked by alias); 11 May 2017 10:02:52 -0000 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 Received: (qmail 36778 invoked by uid 89); 11 May 2017 10:02:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Tel, tel, commercial, office X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 May 2017 10:02:50 +0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 03:02:48 -0700 X-ExtLoop1: 1 Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by fmsmga004.fm.intel.com with ESMTP; 11 May 2017 03:02:47 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.170]) by IRSMSX107.ger.corp.intel.com ([169.254.10.107]) with mapi id 14.03.0319.002; Thu, 11 May 2017 11:02:47 +0100 From: "Metzger, Markus T" To: "Wiederhake, Tim" , "gdb-patches@sourceware.org" CC: "simon.marchi@polymtl.ca" Subject: RE: [PATCH v4 07/12] btrace: Remove struct btrace_thread_info::{begin,end}. Date: Thu, 11 May 2017 10:02:00 -0000 Message-ID: References: <1494416867-19612-1-git-send-email-tim.wiederhake@intel.com> <1494416867-19612-8-git-send-email-tim.wiederhake@intel.com> In-Reply-To: <1494416867-19612-8-git-send-email-tim.wiederhake@intel.com> dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00286.txt.bz2 Hello Tim, > - /* The last function segment contains the current instruction, which i= s not > - really part of the trace. If it contains just this one instruction= , we > - stop when we reach it; otherwise, we let the below loop run to the = end. */ > - end =3D btinfo->end; > - if (VEC_length (btrace_insn_s, end->insn) > 1) > - end =3D NULL; > - > level =3D INT_MAX; > - for (; bfun !=3D end; bfun =3D bfun->flow.next) > - level =3D std::min (level, bfun->level); > + length =3D btinfo->functions.size (); > + for (const auto &bfun: btinfo->functions) > + { > + /* The last function segment contains the current instruction, whi= ch is > + not really part of the trace. If it contains just this one > + instruction, we ignore the segment. */ > + if (bfun->number =3D=3D length && VEC_length (btrace_insn_s, bfun-= >insn) =3D=3D 1) > + continue; > + > + level =3D std::min (level, bfun->level); > + } This adds an additional bfun->number =3D=3D length check to the loop that c= ould be avoided by iterating over indices. Regards, Markus. Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928