From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11572 invoked by alias); 26 Mar 2004 13:57:31 -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 11476 invoked from network); 26 Mar 2004 13:57:23 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 26 Mar 2004 13:57:23 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i2QDvM1X007240 for ; Fri, 26 Mar 2004 08:57:23 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i2QBdaM03157 for ; Fri, 26 Mar 2004 06:39:37 -0500 Received: from cygbert.vinschen.de (vpn50-41.rdu.redhat.com [172.16.50.41]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i2QBdZC19852 for ; Fri, 26 Mar 2004 03:39:35 -0800 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 1E05B5853D; Fri, 26 Mar 2004 12:39:29 +0100 (CET) Date: Fri, 26 Mar 2004 13:57:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFA] minsyms.c: Fix switching to GNU v3 ABI Message-ID: <20040326113928.GG17229@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040310150822.GA31014@nevyn.them.org> <20040310155450.GN25204@cygbert.vinschen.de> <20040310160410.GA410@nevyn.them.org> <20040310161617.GO25204@cygbert.vinschen.de> <20040310162011.GA1067@nevyn.them.org> <20040310163416.GP25204@cygbert.vinschen.de> <20040310163716.GA2114@nevyn.them.org> <20040310175446.GR25204@cygbert.vinschen.de> <20040310182259.GT25204@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i X-RedHat-Spam-Score: 0 X-SW-Source: 2004-03/txt/msg00655.txt.bz2 On Mar 25 15:44, Jim Blandy wrote: > One comment: I notice that we actually remove the leading character > earlier in prim_record_minimal_symbol_and_info, to check if the name > is the same as that of the GCC compilation marker symbol. It would be > nicer if we could just remove the leading character once, at the top > of the function, and then simplify the the "__gnu_compiled" test. > Doing so shouldn't interfere with the GCC_COMPILED_FLAG_SYMBOL tests, > since the code already presumes those both start with 'g'. Well, it could interfere. Assuming that leading char is the underscore. The first test would now find "gcc_compiled.", but not "_gcc_compiled.". When skipping the leading char before testing, the same test would now also find "_gcc_compiled.". If that's ok, I don't have a problem to change it as you like. Otherwise, I'd propose the below patch, which avoids that problem. Corinna * minsyms.c (install_minimal_symbols): Move dropping leading char from linkage name from here... (prim_record_minimal_symbol_and_info): ...to here. Simplify test for "__gnu_compiled*" symbols. Index: minsyms.c =================================================================== RCS file: /cvs/src/src/gdb/minsyms.c,v retrieving revision 1.41 diff -u -p -r1.41 minsyms.c --- minsyms.c 9 Feb 2004 19:13:46 -0000 1.41 +++ minsyms.c 26 Mar 2004 11:28:46 -0000 @@ -580,26 +580,23 @@ prim_record_minimal_symbol_and_info (con struct msym_bunch *new; struct minimal_symbol *msymbol; - if (ms_type == mst_file_text) - { - /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into - the minimal symbols, because if there is also another symbol - at the same address (e.g. the first function of the file), - lookup_minimal_symbol_by_pc would have no way of getting the - right one. */ - if (name[0] == 'g' - && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0 - || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)) - return (NULL); - - { - const char *tempstring = name; - if (tempstring[0] == get_symbol_leading_char (objfile->obfd)) - ++tempstring; - if (strncmp (tempstring, "__gnu_compiled", 14) == 0) - return (NULL); - } - } + /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into + the minimal symbols, because if there is also another symbol + at the same address (e.g. the first function of the file), + lookup_minimal_symbol_by_pc would have no way of getting the + right one. */ + if (ms_type == mst_file_text && name[0] == 'g' + && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0 + || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)) + return (NULL); + + /* It's save to strip the leading char here once, since the name + is also stored stripped in the minimal symbol table. */ + if (name[0] == get_symbol_leading_char (objfile->obfd)) + ++name; + + if (ms_type == mst_file_text && strncmp (name, "__gnu_compiled", 14) == 0) + return (NULL); if (msym_bunch_index == BUNCH_SIZE) { @@ -831,7 +828,6 @@ install_minimal_symbols (struct objfile struct msym_bunch *bunch; struct minimal_symbol *msymbols; int alloc_count; - char leading_char; if (msym_count > 0) { @@ -859,18 +855,11 @@ install_minimal_symbols (struct objfile each bunch is full. */ mcount = objfile->minimal_symbol_count; - leading_char = get_symbol_leading_char (objfile->obfd); for (bunch = msym_bunch; bunch != NULL; bunch = bunch->next) { for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++) - { - msymbols[mcount] = bunch->contents[bindex]; - if (SYMBOL_LINKAGE_NAME (&msymbols[mcount])[0] == leading_char) - { - SYMBOL_LINKAGE_NAME (&msymbols[mcount])++; - } - } + msymbols[mcount] = bunch->contents[bindex]; msym_bunch_index = BUNCH_SIZE; } -- Corinna Vinschen Cygwin Developer Red Hat, Inc.