From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53746 invoked by alias); 24 Feb 2017 09:32:48 -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 53671 invoked by uid 89); 24 Feb 2017 09:32:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=relates 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; Fri, 24 Feb 2017 09:32:45 +0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2017 01:32:43 -0800 X-ExtLoop1: 1 Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga005.jf.intel.com with ESMTP; 24 Feb 2017 01:32:42 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.142]) by IRSMSX107.ger.corp.intel.com ([169.254.10.3]) with mapi id 14.03.0248.002; Fri, 24 Feb 2017 09:32:41 +0000 From: "Metzger, Markus T" To: "Wiederhake, Tim" , "gdb-patches@sourceware.org" Subject: RE: [PATCH 05/11] btrace: Use function segment index in insn iterator. Date: Fri, 24 Feb 2017 09:32:00 -0000 Message-ID: References: <1487337989-6367-1-git-send-email-tim.wiederhake@intel.com> <1487337989-6367-6-git-send-email-tim.wiederhake@intel.com> In-Reply-To: <1487337989-6367-6-git-send-email-tim.wiederhake@intel.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00662.txt.bz2 > -----Original Message----- > From: Wiederhake, Tim > Sent: Friday, February 17, 2017 2:26 PM > To: gdb-patches@sourceware.org > Cc: Metzger, Markus T > Subject: [PATCH 05/11] btrace: Use function segment index in insn iterato= r. Hello Tim, =20 > 2017-02-17 Tim Wiederhake >=20 > gdb/ChangeLog > * btrace.c: (btrace_insn_get, btrace_insn_get_error, > btrace_insn_number, > btrace_insn_begin, btrace_insn_end, btrace_insn_next, > btrace_insn_prev, > btrace_find_insn_by_number): Replaced function segment pointer with > index. I think this is "Replace function segment ...". More below. > diff --git a/gdb/btrace.c b/gdb/btrace.c > index 31590ce..1e110cc 100644 > --- a/gdb/btrace.c > +++ b/gdb/btrace.c > @@ -2236,8 +2236,8 @@ btrace_insn_get (const struct btrace_insn_iterator = *it) > const struct btrace_function *bfun; > unsigned int index, end; >=20 > - index =3D it->index; > - bfun =3D it->function; > + index =3D it->insn_index; > + bfun =3D VEC_index (btrace_fun_p, it->btinfo->functions, it->call_inde= x); Should we assert that IT->CALL_INDEX lies inside the vector's bounds? More= below. > diff --git a/gdb/btrace.h b/gdb/btrace.h > index c49b114..53df6e9 100644 > --- a/gdb/btrace.h > +++ b/gdb/btrace.h > @@ -196,12 +196,12 @@ struct btrace_insn_iterator > /* The branch trace information for this thread. Will never be NULL. = */ > const struct btrace_thread_info *btinfo; >=20 > - /* The branch trace function segment containing the instruction. > - Will never be NULL. */ > - const struct btrace_function *function; > + /* The index of the function call segment in struct btrace_thread_info= 's > + FUNCTIONS vector. Note that index + 1 =3D=3D number. */ > + unsigned int call_index; The comment is really referring to the iterator's BTINFO field, isn't it? = Why not say "The index in BTINFO->FUNCTIONS". I don't think we need the note on how the index relates to the function number, here. With this change, the btrace_insn_iterator really contains all the fields of btrace_call_iterator. Should we make it actually contain a btrace_call_ite= rator? It might simplify the above code in that it allows us to use btrace_call_ge= t instead of accessing the BTINFO->FUNCTIONS vector directly. > @@ -1692,7 +1692,8 @@ record_btrace_frame_sniffer (const struct > frame_unwind *self, >=20 > replay =3D tp->btrace.replay; > if (replay !=3D NULL) > - bfun =3D replay->function; > + bfun =3D VEC_index (btrace_fun_p, tp->btrace.functions, > + replay->call_index); We should use REPLAY->BTINFO or, even better, btrace_call_get. > @@ -2705,7 +2706,7 @@ record_btrace_set_replay (struct thread_info *tp, >=20 > btinfo =3D &tp->btrace; >=20 > - if (it =3D=3D NULL || it->function =3D=3D NULL) > + if (it =3D=3D NULL) > record_btrace_stop_replaying (tp); IT->FUNCTION =3D=3D NULL checks for the end iterator. I don't think that w= e can simply omit it. Thanks, 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