From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22858 invoked by alias); 29 Apr 2010 22:24:33 -0000 Received: (qmail 22844 invoked by uid 22791); 29 Apr 2010 22:24:32 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Apr 2010 22:24:28 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3TMOPWm060234 for ; Fri, 30 Apr 2010 00:24:25 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [IPv6:2001:660:2402:d::12]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o3TMOOND046396 ; Fri, 30 Apr 2010 00:24:24 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3TMONTw092182 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Fri, 30 Apr 2010 00:24:24 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Pierre Muller'" , References: <000f01cadf9e$a4fd4910$eef7db30$@muller@ics-cnrs.unistra.fr> In-Reply-To: <000f01cadf9e$a4fd4910$eef7db30$@muller@ics-cnrs.unistra.fr> Subject: [PING] [RFC/Windows] Remember last tlb type for re-use in windows_get_tlb_type Date: Thu, 29 Apr 2010 22:24:00 -0000 Message-ID: <002401cae7ea$ba4b48e0$2ee1daa0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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/msg00968.txt.bz2 Nobody reacted to this: http://sourceware.org/ml/gdb-patches/2010-04/msg00552.html It helps avoid some unnecessary recomputation. Pierre > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=E9=A0: Monday, April 19, 2010 11:00 AM > =C0=A0: gdb-patches@sourceware.org > Objet=A0: [RFC/Windows] Remember last tlb type for re-use in > windows_get_tlb_type >=20 > Each time, you examine the convenience variable > $_tlb on Windows executable > the function windows_get_tlb_type is called > and creates a new type. >=20 > 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. >=20 > I do not know if those kind of patches > are regarded as useful. >=20 > Comments welcome. >=20 >=20 > Pierre Muller >=20 > 2010-04-19 Pierre Muller >=20 > * windows-tdep.c (windows_get_tlb_type): Remember > last GDBARCH and created type for re-use. >=20 > Index: windows-tdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D 0; > static struct type * > windows_get_tlb_type (struct gdbarch *gdbarch) > { > + static struct gdbarch *last_gdbarch =3D NULL; > + static struct type *last_tlb_type =3D 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; >=20 > + /* Do not rebuild type if same gdbarch as last time. */ > + if (last_tlb_type && last_gdbarch =3D=3D gdbarch) > + return last_tlb_type; > + > dword_ptr_type =3D arch_integer_type (gdbarch, gdbarch_ptr_bit > (gdbarch), > 1, "DWORD_PTR"); > dword32_type =3D 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) =3D tib_type; >=20 > + last_tlb_type =3D tib_ptr_type; > + last_gdbarch =3D gdbarch; > + > return tib_ptr_type; > } >=20