From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88425 invoked by alias); 10 May 2017 11:46:41 -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 88349 invoked by uid 89); 10 May 2017 11:46:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=is!, visually X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 May 2017 11:46:38 +0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2017 04:46:40 -0700 X-ExtLoop1: 1 Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga005.jf.intel.com with ESMTP; 10 May 2017 04:46:40 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.163]) by IRSMSX152.ger.corp.intel.com ([169.254.6.231]) with mapi id 14.03.0319.002; Wed, 10 May 2017 12:46:39 +0100 From: "Wiederhake, Tim" To: Simon Marchi CC: "gdb-patches@sourceware.org" , "Metzger, Markus T" Subject: RE: [PATCH v3 11/12] btrace: Remove bfun_s vector. Date: Wed, 10 May 2017 11:46:00 -0000 Message-ID: <9676A094AF46E14E8265E7A3F4CCE9AF3C14CFEA@irsmsx105.ger.corp.intel.com> References: <1494312929-22749-1-git-send-email-tim.wiederhake@intel.com> <1494312929-22749-12-git-send-email-tim.wiederhake@intel.com> In-Reply-To: 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/msg00249.txt.bz2 Hi Simon, thanks for reviewing! > -----Original Message----- > From: Simon Marchi [mailto:simon.marchi@polymtl.ca] > Sent: Wednesday, May 10, 2017 6:27 AM > To: Wiederhake, Tim > Cc: gdb-patches@sourceware.org; Metzger, Markus T > > Subject: Re: [PATCH v3 11/12] btrace: Remove bfun_s vector. >=20 > On 2017-05-09 02:55, Tim Wiederhake wrote: > > 2017-05-09 Tim Wiederhake > > > > gdb/ChangeLog: > > > > * btrace.c: Remove typedef bfun_s. > > (ftrace_new_gap): Directly add gaps to the list of gaps. > > (btrace_bridge_gaps, btrace_compute_ftrace_bts, > pt_btrace_insn_flags, > > ftrace_add_pt, btrace_compute_ftrace_pt, btrace_compute_ftrace_1, > > btrace_finalize_ftrace, btrace_compute_ftrace): Use std::vector > > instead of gdb VEC. >=20 > Looks good, just two nits. >=20 > > @@ -527,15 +524,15 @@ ftrace_new_gap (struct btrace_thread_info > > *btinfo, int errcode) > > } > > > > bfun->errcode =3D errcode; > > + gaps.push_back (bfun->number); > > > > ftrace_debug (bfun, "new gap"); > > > > return bfun; > > } > > > > -/* Update BFUN with respect to the instruction at PC. BTINFO is the > > branch > > - trace information for the current thread. This may create new > > function > > - segments. > > +/* Update the current function segment at the end of the trace in > > BTINFO with > > + respect to the instruction at PC. This may create new function > > segments. > > Return the chronologically latest function segment, never NULL. */ >=20 > Ah here it is! Please move it to the appropriate patch (#6 I believe). Moved. > > @@ -978,16 +970,15 @@ btrace_bridge_gaps (struct thread_info *tp, VEC > > (bfun_s) **gaps) > > { > > /* Let's try to bridge as many gaps as we can. In some cases, > > we need to > > skip a gap and revisit it again after we closed later gaps. */ > > - while (!VEC_empty (bfun_s, *gaps)) > > + while (!gaps.empty ()) > > { > > - struct btrace_function *gap; > > - unsigned int idx; > > - > > - for (idx =3D 0; VEC_iterate (bfun_s, *gaps, idx, gap); ++idx) > > + for (const auto& number : gaps) >=20 > If you don't intend to modify number (the value in the vector), I think > it would be actually more efficient to not use a reference to iterate on > ints. >=20 > Also, I agree with using auto when the type it replaces is visually > scary, but in this case I think it would be as readable and more > informative to use the actual type: >=20 > for (unsigned int number : gaps) Done. >=20 > Thanks, >=20 > Simon Regards, Tim 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