From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22022 invoked by alias); 28 Mar 2013 09:12:27 -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 21703 invoked by uid 89); 28 Mar 2013 09:12:20 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 09:12:16 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2S9C9rX020218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Mar 2013 05:12:09 -0400 Received: from host2.jankratochvil.net (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2S9C47C022206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 28 Mar 2013 05:12:07 -0400 Date: Thu, 28 Mar 2013 14:38:00 -0000 From: Jan Kratochvil To: "Metzger, Markus T" Cc: Markus Metzger , "gdb-patches@sourceware.org" Subject: Re: [draft patch] unwinder for btrace [Re: [rfc 3/5] record: make it build again] Message-ID: <20130328091204.GA15793@host2.jankratochvil.net> References: <1360337423-27095-1-git-send-email-markus.t.metzger@intel.com> <1360337423-27095-4-git-send-email-markus.t.metzger@intel.com> <20130210221059.GC4819@host2.jankratochvil.net> <20130211141451.GA8962@host2.jankratochvil.net> <20130211171319.GA17524@host2.jankratochvil.net> <9B969C1D-95E8-4AD5-BEF0-E269FF8771DF@gmail.com> <20130328062747.GA27157@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-03/txt/msg01054.txt.bz2 On Thu, 28 Mar 2013 08:44:12 +0100, Metzger, Markus T wrote: > Thanks, I'll try that. Although, in the end, it's really the same as if we made > other frames prologue cache visible. Yes. You can make a separate patch to make it visible but one htab_t may be easier. With public cache pointer someone could misues it inappropriately etc. > > > > Also what's the lifetime of a frame_info and frame_id object? > > > > When the branch trace is cleared, any pointers to it will become > > > > stale. > > > > There is frame_unwind->dealloc_cache, any reinit_frame_cache() call inside GDB > > will clear the prologue cache which is very common. > > > > I see now btrace_thread_info->btrace may change more often - such as during > > each "info record" command. So call reinit_frame_cache() in the cases btrace > > cache may get rebuilt. > > The data structure should only change when there is new trace, which requires > the target to continue. "info record" should, like any other record-btrace command, > fetch the new trace once and then operate on the cached trace data. In non-stop mode I belive there will be new btrace info on each "info record" command, won't be? I have not tried it but it seems so to me. > Is there a guarantee that frame_info and frame_id objects are destroyed > when the target resumes? Or could I trigger their destruction from within > btrace_clear? "trigger frame_info and frame_id destruction" == reinit_frame_cache(). Accessing frame_info after reinit_frame_cache() is always a crash. Accessing frame_id after reinit_frame_cache() is safe but one needs to be prepared frame_find_by_id may return NULL if it is no longer available. When you introduce new reinit_frame_cache() call one just needs to be careful no caller holds that time a frame_info * pointer in a local variable. It would be a bug in such caller to call some non-trivial caller while holding frame_info * but there were many such bugs in GDB. I would not rely on any reinit_frame_cache() calls, calling reinit_frame_cache() more times is zero-cost, I think you should call reinit_frame_cache() from btrace_clear as you ask above. Thanks, Jan