From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17786 invoked by alias); 2 Sep 2010 16:02:30 -0000 Received: (qmail 17740 invoked by uid 22791); 2 Sep 2010 16:02:27 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Sep 2010 16:02:21 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o82G2JPk007327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Sep 2010 12:02:19 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o82G2G19015124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 2 Sep 2010 12:02:18 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o82G2GF6011274; Thu, 2 Sep 2010 18:02:16 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o82G2G83011273; Thu, 2 Sep 2010 18:02:16 +0200 Date: Thu, 02 Sep 2010 17:13:00 -0000 From: Jan Kratochvil To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix DW_OP_call2 and DW_OP_call4 for max-cache-age 0 Message-ID: <20100902160216.GA10848@host1.dyn.jankratochvil.net> References: <20100823185008.GA2926@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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 X-SW-Source: 2010-09/txt/msg00100.txt.bz2 On Mon, 23 Aug 2010 21:30:06 +0200, Doug Evans wrote: > On Mon, Aug 23, 2010 at 11:50 AM, Jan Kratochvil wrote: > > as discussed on #gdb when you set max-cache-age 0 DW_OP_call{2,4} crashed GDB. [...] > > --- a/gdb/dwarf2read.c > > +++ b/gdb/dwarf2read.c > > @@ -1636,6 +1636,11 @@ dw2_do_instantiate_symtab (struct objfile *objfile, > >  { > >   struct cleanup *back_to; > > > > +  /* Age the cache, releasing compilation units that have not been used > > +     recently.  Age them first so that we do not age out the requested PER_CU > > +     unit if DWARF2_MAX_CACHE_AGE is too low.  */ > > +  age_cached_comp_units (); > > Aging cached units first feels weird (if not wrong at least weird); we > may toss out something we're about to want. > At the least IWBN to elaborate on why this fixes things. As otherwise we will age out what we have found (on max-cache-age 0). One could forbid value zero for max-cache-age but that also does not seem right to me. There is such a general cleanup moment when GDB is fully idle - prepare_execute_command() - shouldn't age_cached_comp_units be called there? But that way sooner or later we will age out every CU. This may occur a bit even nowadays, the default value 5 is also very low. max-cache-age as "how long" is IMO not userful to the user. There could be more a setting "how many" CUs can be loaded at once. CU age would be then just an internal indicator to maintain the count under the "how many" limit. I would change "max-cache-age" to "max-cache-size" and call it from prepare_execute_command() instead. I will provide a patch if not replied. Thanks, Jan