From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105274 invoked by alias); 18 Jul 2017 17:33:51 -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 105253 invoked by uid 89); 18 Jul 2017 17:33:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jul 2017 17:33:48 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7535F7A168 for ; Tue, 18 Jul 2017 17:33:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7535F7A168 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=keiths@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7535F7A168 Received: from valrhona.uglyboxes.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DFF3173D2; Tue, 18 Jul 2017 17:33:47 +0000 (UTC) Subject: Re: [PATCH 24/40] Per-language symbol name hashing algorithm To: Pedro Alves , gdb-patches@sourceware.org References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-25-git-send-email-palves@redhat.com> From: Keith Seitz Message-ID: <596E467A.9040401@redhat.com> Date: Tue, 18 Jul 2017 17:33:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1496406158-12663-25-git-send-email-palves@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00261.txt.bz2 On 06/02/2017 05:22 AM, Pedro Alves wrote: > > This patch starts fixing this, by doing two things: > > #1 - adds a language vector method to let each language decide how to > compute a symbol name hash. > > #2 - makes dictionaries know the language of the symbols they hold, > and then use the dictionaries language to decide which hashing > method to use. Me likey! :-) Again, just the usual trivial comments. > > diff --git a/gdb/buildsym.c b/gdb/buildsym.c > index cbad027..15f65a8 100644 > --- a/gdb/buildsym.c > +++ b/gdb/buildsym.c > @@ -1047,11 +1055,11 @@ prepare_for_building (const char *name, CORE_ADDR start_addr) > > struct compunit_symtab * > start_symtab (struct objfile *objfile, const char *name, const char *comp_dir, > - CORE_ADDR start_addr) > + CORE_ADDR start_addr, enum language language) Unlike start_buildsym_compunit, this function is exported. IMO, `language' should be mentioned in the comment. > diff --git a/gdb/coffread.c b/gdb/coffread.c > index 9db4792..db0b77a 100644 > --- a/gdb/coffread.c > +++ b/gdb/coffread.c > @@ -394,7 +394,9 @@ coff_start_symtab (struct objfile *objfile, const char *name) > NULL, > /* The start address is irrelevant, since we set > last_source_start_addr in coff_end_symtab. */ > - 0); > + 0, > + /* Let buildsym.c deduce the language for this symtab. */ > + language_unknown); re: "deduce the language" if language == language_unknown... That's not obvious from start_symtab's documentation, so I think that deserves a mention there. > diff --git a/gdb/dictionary.h b/gdb/dictionary.h > index 4f4f160..ef5fbed 100644 > --- a/gdb/dictionary.h > +++ b/gdb/dictionary.h > @@ -45,6 +45,7 @@ struct pending; > initialized from SYMBOL_LIST. */ > > extern struct dictionary *dict_create_hashed (struct obstack *obstack, > + enum language language, > const struct pending > *symbol_list); > > @@ -53,7 +54,8 @@ extern struct dictionary *dict_create_hashed (struct obstack *obstack, > it, call dict_add_symbol(). Call dict_free() when you're done with > it. */ > > -extern struct dictionary *dict_create_hashed_expandable (void); > +extern struct dictionary * > + dict_create_hashed_expandable (enum language language); > > /* Create a dictionary implemented via a fixed-size array. All memory > it uses is allocated on OBSTACK; the environment is initialized > @@ -61,6 +63,7 @@ extern struct dictionary *dict_create_hashed_expandable (void); > that they're found in SYMBOL_LIST. */ > > extern struct dictionary *dict_create_linear (struct obstack *obstack, > + enum language language, > const struct pending > *symbol_list); > > @@ -69,8 +72,8 @@ extern struct dictionary *dict_create_linear (struct obstack *obstack, > it, call dict_add_symbol(). Call dict_free() when you're done with > it. */ > > -extern struct dictionary *dict_create_linear_expandable (void); > - > +extern struct dictionary * > + dict_create_linear_expandable (enum language language); > > /* The functions providing the interface to dictionaries. Note that > the most common parts of the interface, namely symbol lookup, are All of the above functions are exported, so I think our custom is to document all formal parameters, no? > diff --git a/gdb/symtab.h b/gdb/symtab.h > index fffe0f87..20904e4 100644 > --- a/gdb/symtab.h > +++ b/gdb/symtab.h > @@ -277,6 +277,9 @@ extern const char *symbol_search_name (const struct general_symbol_info *); > #define SYMBOL_MATCHES_SEARCH_NAME(symbol, name) \ > (strcmp_iw (SYMBOL_SEARCH_NAME (symbol), (name)) == 0) > > +extern unsigned int search_name_hash (enum language language, > + const char *search_name); > + symtab.c says, "See symtab.h." Missing comment here. Keith