From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10170 invoked by alias); 12 Dec 2013 08:24:04 -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 10156 invoked by uid 89); 12 Dec 2013 08:24:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Dec 2013 08:24:02 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 12 Dec 2013 00:23:59 -0800 X-ExtLoop1: 1 Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 12 Dec 2013 00:23:58 -0800 Received: from irsmsx151.ger.corp.intel.com (163.33.192.59) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 12 Dec 2013 08:23:47 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.135]) by IRSMSX151.ger.corp.intel.com ([169.254.4.126]) with mapi id 14.03.0123.003; Thu, 12 Dec 2013 08:23:47 +0000 From: "Metzger, Markus T" To: Jan Kratochvil CC: "gdb-patches@sourceware.org" , Pedro Alves Subject: RE: [patch v7 22/24] btrace, gdbserver: read branch trace incrementally Date: Thu, 12 Dec 2013 08:24:00 -0000 Message-ID: References: <1385735899-12481-1-git-send-email-markus.t.metzger@intel.com> <1385735899-12481-23-git-send-email-markus.t.metzger@intel.com> <20131211195820.GB22687@host2.jankratochvil.net> In-Reply-To: <20131211195820.GB22687@host2.jankratochvil.net> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00463.txt.bz2 > -----Original Message----- > From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com] > Sent: Wednesday, December 11, 2013 8:58 PM Thanks for your review. > > +static int > > +btrace_stitch_trace (VEC (btrace_block_s) **btrace, > > + const struct btrace_thread_info *btinfo) > > +{ > > + struct btrace_function *end; > > + struct btrace_insn *insn; > > + btrace_block_s *block; > > + > > + /* If we don't have trace, there's nothing to do. */ > > + if (VEC_empty (btrace_block_s, *btrace)) > > + return 0; > > + > > + end =3D btinfo->end; > > + gdb_assert (end !=3D NULL); > > + > > + block =3D VEC_last (btrace_block_s, *btrace); > > + insn =3D VEC_last (btrace_insn_s, end->insn); >=20 > At least call block and insn somehow specific from where they come from. > Maybe btrace_block and btinfo_end. Also end should be called btinfo_end > (if > the extra variable still makes sense in such case). >=20 > I would even call it new_btrace and old_btinfo with variables old_end etc. Hmm, btrace_block and btinfo_end doesn't help very much, I think. What this function does is stitch the old and new trace together by inserti= ng the last instruction of the old trace as beginning of the chronologically f= irst block of the new trace. Then it removes the last instruction from the old trace - it will be re-added when we process the new trace. I renamed the variables as follows: end -> last_bfun insn -> last_insn block -> first_new_block I also added a comment explaining why first_new_block is assigned from VEC_last (). I hope those names are clearer. Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052