From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94990 invoked by alias); 17 May 2017 07:56:45 -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 94965 invoked by uid 89); 17 May 2017 07:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_2,RP_MATCHES_RCVD,SPF_PASS,UNSUBSCRIBE_BODY autolearn=ham version=3.3.2 spammy=nicole, Nicole, Hx-languages-length:2352, sk:gdb-pat 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; Wed, 17 May 2017 07:56:42 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2017 00:56:44 -0700 X-ExtLoop1: 1 Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga001.fm.intel.com with ESMTP; 17 May 2017 00:56:43 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.163]) by IRSMSX151.ger.corp.intel.com ([169.254.4.123]) with mapi id 14.03.0319.002; Wed, 17 May 2017 08:56:42 +0100 From: "Wiederhake, Tim" To: "Metzger, Markus T" , "gdb-patches@sourceware.org" CC: "simon.marchi@polymtl.ca" Subject: RE: [PATCH v4 04/12] btrace: Use function segment index in call iterator. Date: Wed, 17 May 2017 07:56:00 -0000 Message-ID: <9676A094AF46E14E8265E7A3F4CCE9AF3C14DB21@irsmsx105.ger.corp.intel.com> References: <1494416867-19612-1-git-send-email-tim.wiederhake@intel.com> <1494416867-19612-5-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/msg00362.txt.bz2 Hi Markus, Thanks for your input! > -----Original Message----- > From: Metzger, Markus T > Sent: Thursday, May 11, 2017 12:03 PM > To: Wiederhake, Tim ; gdb-patches@sourceware.org > Cc: simon.marchi@polymtl.ca > Subject: RE: [PATCH v4 04/12] btrace: Use function segment index in call > iterator. >=20 > Hello Tim, >=20 > > /* See btrace.h. */ > > @@ -2702,26 +2684,14 @@ btrace_find_call_by_number (struct > > btrace_call_iterator *it, > > const struct btrace_thread_info *btinfo, > > unsigned int number) > > { > > - const struct btrace_function *bfun; > > + const unsigned int length =3D btinfo->functions.size (); > > > > - for (bfun =3D btinfo->end; bfun !=3D NULL; bfun =3D bfun->flow.prev) > > - { > > - unsigned int bnum; > > - > > - bnum =3D bfun->number; > > - if (number =3D=3D bnum) > > - { > > - it->btinfo =3D btinfo; > > - it->function =3D bfun; > > - return 1; > > - } > > - > > - /* Functions are ordered and numbered consecutively. We could > bail out > > - earlier. On the other hand, it is very unlikely that we search for > > - a nonexistent function. */ > > - } > > + if ((number =3D=3D 0) || (number > length)) > > + return 0; > > > > - return 0; > > + it->btinfo =3D btinfo; > > + it->index =3D number - 1; > > + return 1; > > } >=20 > We have those +1 and -1 operations throughout the code. Should we > introduce > some small helpers to document what we're doing? E.g. >=20 > static inline unsigned int btrace_call_number_from_index (unsigned int > call_index) > { > return call_index + 1; > } >=20 > and >=20 > static inline unsigned int btrace_call_number_to_index (unsigned int > call_number) > { > return call_number - 1; > } >=20 Most of these manual adjustments are temporary and are replaced in later pa= tches in this series. I replaced the remaining adjustments in record-btrace= .c with calls to find_call_by_number which leaves us with only three occurr= ences in btrace.c, where we actually write to btrace_call_iterator. > Regards, > Markus. 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