From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2226 invoked by alias); 19 Oct 2004 19:43:16 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2152 invoked from network); 19 Oct 2004 19:43:10 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 19 Oct 2004 19:43:10 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.10) with ESMTP id i9JJh91T026463 for ; Tue, 19 Oct 2004 15:43:10 -0400 Received: from zenia.home.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i9JJh8r01038; Tue, 19 Oct 2004 15:43:09 -0400 To: Elena Zannoni Cc: gdb-patches@sources.redhat.com, Ton van Overbeek Subject: Re: PATCH: Step down from maintainerships References: <16752.3082.255249.837515@localhost.redhat.com> From: Jim Blandy Date: Tue, 19 Oct 2004 19:43:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-10/txt/msg00322.txt.bz2 Jim Blandy writes: > - Demangling language needs to be stored in demangled name cache, > along with demangled name: > > http://sources.redhat.com/ml/gdb-patches/2004-08/msg00479.html > > The patch proposed there would undo prior optimizations, which I > explain here: > > http://sources.redhat.com/ml/gdb-patches/2004-09/msg00263.html > > (That message is not part of the same thread, since it's in a > different month, so don't miss it.) For what it's worth, I have a tentative patch for this. It's not tested, but it could be a starting point. (Ton van Overbeek originally reported the problem, and has offered to test patches.) 2004-10-19 Jim Blandy * symtab.c (symbol_set_names): Store the demangling language, as well as the demangled name, in the demangling cache. Use it to set the language on symbols whose names we find in the cache. * objfiles.h (struct objfile): Doc fix. Index: gdb/objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.39 diff -c -p -r1.39 objfiles.h *** gdb/objfiles.h 2 Sep 2004 03:05:46 -0000 1.39 --- gdb/objfiles.h 19 Oct 2004 19:23:20 -0000 *************** struct objfile *** 267,275 **** /* Hash table for mapping symbol names to demangled names. Each entry in the hash table is actually two consecutive strings, ! both null-terminated; the first one is a mangled or linkage ! name, and the second is the demangled name or just a zero byte ! if the name doesn't demangle. */ struct htab *demangled_names_hash; /* Vectors of all partial symbols read in from file. The actual data --- 267,280 ---- /* Hash table for mapping symbol names to demangled names. Each entry in the hash table is actually two consecutive strings, ! both null-terminated, possibly followed by a byte: ! - the first string is a mangled or linkage name, ! - the second string is the demangled name, or just a zero byte ! if the name doesn't demangle, and ! - if the demangled name is non-empty, the byte after the second ! null character is the 'enum language' value for the ! demangling regimen we used. If the demangled name is empty, ! the byte is absent. */ struct htab *demangled_names_hash; /* Vectors of all partial symbols read in from file. The actual data Index: gdb/symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.140 diff -c -p -r1.140 symtab.c *** gdb/symtab.c 2 Oct 2004 09:55:15 -0000 1.140 --- gdb/symtab.c 19 Oct 2004 19:23:21 -0000 *************** symbol_set_names (struct general_symbol_ *** 576,598 **** Otherwise, just place a second zero byte after the end of the mangled name. */ *slot = obstack_alloc (&objfile->objfile_obstack, ! lookup_len + demangled_len + 2); memcpy (*slot, lookup_name, lookup_len + 1); if (demangled_name != NULL) { memcpy (*slot + lookup_len + 1, demangled_name, demangled_len + 1); xfree (demangled_name); } else (*slot)[lookup_len + 1] = '\0'; } gsymbol->name = *slot + lookup_len - len; ! if ((*slot)[lookup_len + 1] != '\0') ! gsymbol->language_specific.cplus_specific.demangled_name ! = &(*slot)[lookup_len + 1]; ! else ! gsymbol->language_specific.cplus_specific.demangled_name = NULL; } /* Initialize the demangled name of GSYMBOL if possible. Any required space --- 576,624 ---- Otherwise, just place a second zero byte after the end of the mangled name. */ *slot = obstack_alloc (&objfile->objfile_obstack, ! lookup_len + 1 + demangled_len + 1 + 1); memcpy (*slot, lookup_name, lookup_len + 1); if (demangled_name != NULL) { memcpy (*slot + lookup_len + 1, demangled_name, demangled_len + 1); xfree (demangled_name); + /* Record the language we used to demangle the name, too. */ + (*slot)[lookup_len + 1 + demangled_len + 1] = gsymbol->language; } else (*slot)[lookup_len + 1] = '\0'; } + else + { + /* This is what symbol_find_demangled_name does when we don't + find a hash table entry, so we should do it when we do find + one as well. */ + if (gsymbol->language == language_unknown) + gsymbol->language = language_auto; + } + /* At this point we've definitely got a hash table entry, whether + prexisting or just created. Make gsymbol share its name with + the hash table entry. */ gsymbol->name = *slot + lookup_len - len; ! ! /* Share the demangled name as well, if there is one. */ ! { ! char *demangled_name = *slot + lookup_len + 1; ! ! if (demangled_name != '\0') ! { ! size_t demangled_len = strlen (demangled_name); ! ! gsymbol->language_specific.cplus_specific.demangled_name ! = demangled_name; ! ! /* Set gsymbol's language from the byte after the demangled name. */ ! gsymbol->language = (enum language) demangled_name[demangled_len + 1]; ! } ! else ! gsymbol->language_specific.cplus_specific.demangled_name = NULL; ! } } /* Initialize the demangled name of GSYMBOL if possible. Any required space