From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21619 invoked by alias); 9 Dec 2005 23:13:34 -0000 Received: (qmail 21611 invoked by uid 22791); 9 Dec 2005 23:13:33 -0000 X-Spam-Check-By: sourceware.org Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.203) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Dec 2005 23:13:31 +0000 Received: by zproxy.gmail.com with SMTP id l1so1041557nzf for ; Fri, 09 Dec 2005 15:13:30 -0800 (PST) Received: by 10.36.250.41 with SMTP id x41mr3966938nzh; Fri, 09 Dec 2005 15:13:29 -0800 (PST) Received: by 10.37.2.6 with HTTP; Fri, 9 Dec 2005 15:13:29 -0800 (PST) Message-ID: <8f2776cb0512091513s41aea52cu531da8f5dcaa8a9@mail.gmail.com> Date: Sat, 10 Dec 2005 05:07:00 -0000 From: Jim Blandy To: Andrew STUBBS , Jim Blandy , gdb-patches@sources.redhat.com Subject: Re: [RFC] Alternate approach to keeping convenience variables In-Reply-To: <20051209205923.GA21331@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4381DC75.80800@st.com> <8f2776cb0511212138g2adef40cr1632365c00e3bebc@mail.gmail.com> <43835114.5060401@st.com> <20051209205923.GA21331@nevyn.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00186.txt.bz2 On 12/9/05, Daniel Jacobowitz wrote: > 2005-12-09 Daniel Jacobowitz > > * Makefile.in (gdbtypes_h, gdbtypes.o, utils.o): Update. > * defs.h (hashtab_obstack_allocate, dummy_obstack_deallocate): Add > prototypes. > * dwarf2read.c (read_subroutine_type): Use TYPE_ZALLOC. > (hashtab_obstack_allocate, dummy_obstack_deallocate): Moved to... > * utils.c (hashtab_obstack_allocate, dummy_obstack_deallocate): > ...here. > * gdbtypes.c: Include "hashtab.h". > (build_gdbtypes): Remove extra prototype. > (struct type_pair, type_pair_hash, type_pair_eq) > (create_copied_types_hash, copy_type_recursive): New. > * gdbtypes.h: Include "hashtab.h". > (TYPE_ZALLOC): New. > (create_copied_types_hash, copy_type_recursive): New prototypes. > * objfiles.c (free_objfile): Call preserve_values. > * symfile.c (reread_symbols): Likewise. > (clear_symtab_users): Remove calls to clear_value_history and > clear_internalvars. > * value.c (clear_value_history, clear_internalvars): Removed. > (preserve_one_value, preserve_values): New functions. > * value.h (clear_value_history, clear_internalvars): Removed. > (preserve_values): New prototype. > > * tracepoint.c (_initialize_tracepoint): Do not initialize conven= ience > variables here. Well, that's a head-on attack. I think Mr. Stubbs will be pleased when he comes back. I don't understand what the tracepoint.c change has to do with the rest of the patch. Commit the removal of the extra build_gdbtypes prototype as a separate obvious change. Same for TYPE_ZALLOC. Make this a function, not a macro. It would be nice if the comments for hashtab_obstack_allocate and the dummy free actually explained what sort of DATA argument they expect. copy_type_recursive undoes the sharing given a bunch of 'struct type' objects all referring to a given 'struct main_type' object. You could just stick both kinds of pointers in the type hash, at the cost of some static typing. And it doesn't preserve 'pointer_type', 'reference_type', or 'chain' groupings. Go ahead and expand the comment in copy_type_recursive to spell out why it is *necessary* to add the type pair to the hash table before the type is completely constructed. Don't just point out that we do it where we do it. Because they would have different lifetimes, we should never have a type in one objfile pointing to a type in another objfile. And if we ever did, then that assert would catch it. Good. There should be a comment to that effect in some appropriate place. preserve_values also needs a comment indicating that it's meant to be called only when we're about to free the given objfile, which ensures that we never make more than one copy of a given type.