From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 680 invoked by alias); 30 Apr 2010 14:53:46 -0000 Received: (qmail 668 invoked by uid 22791); 30 Apr 2010 14:53:45 -0000 X-Spam-Check-By: sourceware.org Received: from pool-173-76-55-5.bstnma.fios.verizon.net (HELO cgf.cx) (173.76.55.5) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Fri, 30 Apr 2010 14:53:40 +0000 Received: from ednor.cgf.cx (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 6D49913C061; Fri, 30 Apr 2010 10:53:38 -0400 (EDT) Received: by ednor.cgf.cx (Postfix, from userid 201) id 5F9A22B352; Fri, 30 Apr 2010 10:53:38 -0400 (EDT) Date: Fri, 30 Apr 2010 14:53:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org, Pierre Muller Subject: Re: [PING] [RFC/Windows] Remember last tlb type for re-use in windows_get_tlb_type Message-ID: <20100430145338.GA11512@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org, Pierre Muller References: <000f01cadf9e$a4fd4910$eef7db30$@muller@ics-cnrs.unistra.fr> <002401cae7ea$ba4b48e0$2ee1daa0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002401cae7ea$ba4b48e0$2ee1daa0$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.20 (2009-06-14) 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-04/txt/msg00988.txt.bz2 On Fri, Apr 30, 2010 at 12:24:26AM +0200, Pierre Muller wrote: >Nobody reacted to this: >http://sourceware.org/ml/gdb-patches/2010-04/msg00552.html > >It helps avoid some unnecessary recomputation. Looks ok but is this computation really so onerous that we need to add the extra code? cgf >Pierre > >> -----Message d'origine----- >> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches- >> owner@sourceware.org] De la part de Pierre Muller >> Envoy??: Monday, April 19, 2010 11:00 AM >> ??: gdb-patches@sourceware.org >> Objet?: [RFC/Windows] Remember last tlb type for re-use in >> windows_get_tlb_type >> >> Each time, you examine the convenience variable >> $_tlb on Windows executable >> the function windows_get_tlb_type is called >> and creates a new type. >> >> I copied this behavior from the internal variable _siginfo, >> but I think that it is a big waste of time and memory to >> regenerate it each time. >> Nevertheless, with multi-target GDB, you can possibly create >> a type of windows-32 bit another for windows 64-bit >> or even one for windows-CE. >> Thus I remember the last gdbarch passed >> and return the remember type only if gdbarch did not change, >> which is most of the time. >> >> I do not know if those kind of patches >> are regarded as useful. >> >> Comments welcome. >> >> >> Pierre Muller >> >> 2010-04-19 Pierre Muller >> >> * windows-tdep.c (windows_get_tlb_type): Remember >> last GDBARCH and created type for re-use. >> >> Index: windows-tdep.c >> =================================================================== >> RCS file: /cvs/src/src/gdb/windows-tdep.c,v >> retrieving revision 1.6 >> diff -u -p -r1.6 windows-tdep.c >> --- windows-tdep.c 16 Apr 2010 07:49:35 -0000 1.6 >> +++ windows-tdep.c 19 Apr 2010 08:45:27 -0000 >> @@ -97,12 +97,18 @@ static int maint_display_all_tib = 0; >> static struct type * >> windows_get_tlb_type (struct gdbarch *gdbarch) >> { >> + static struct gdbarch *last_gdbarch = NULL; >> + static struct type *last_tlb_type = NULL; >> struct type *dword_ptr_type, *dword32_type, *void_ptr_type; >> struct type *peb_ldr_type, *peb_ldr_ptr_type; >> struct type *peb_type, *peb_ptr_type, *list_type, *list_ptr_type; >> struct type *module_list_ptr_type; >> struct type *tib_type, *seh_type, *tib_ptr_type, *seh_ptr_type; >> >> + /* Do not rebuild type if same gdbarch as last time. */ >> + if (last_tlb_type && last_gdbarch == gdbarch) >> + return last_tlb_type; >> + >> dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit >> (gdbarch), >> 1, "DWORD_PTR"); >> dword32_type = arch_integer_type (gdbarch, 32, >> @@ -210,6 +216,9 @@ windows_get_tlb_type (struct gdbarch *gd >> TYPE_LENGTH (void_ptr_type), NULL); >> TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; >> >> + last_tlb_type = tib_ptr_type; >> + last_gdbarch = gdbarch; >> + >> return tib_ptr_type; >> } >> > > >