From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15215 invoked by alias); 10 Mar 2004 15:08:24 -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 15200 invoked from network); 10 Mar 2004 15:08:23 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 10 Mar 2004 15:08:23 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B15Jn-00086f-CG for ; Wed, 10 Mar 2004 10:08:23 -0500 Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [RFA] minsyms.c: Fix switching to GNU v3 ABI Message-ID: <20040310150822.GA31014@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040310105709.GJ25204@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040310105709.GJ25204@cygbert.vinschen.de> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00230.txt.bz2 On Wed, Mar 10, 2004 at 11:57:09AM +0100, Corinna Vinschen wrote: > Hi, > > I was debugging a situation, in which an C++ object file has been build > using v3 ABI, but GDB did not recognize it and was assuming v2 ABI. The > target system is sh-elf, the compiler gcc 3.4. > > What I found is this: > > - The C++ ABI is set to v2 by default (gnu-v2-abi.c, _initialize_gnu_v2_abi). > > - While reading symbols from the object file, at one point elf_symfile_read() > (elfread.c) is called. > > - elf_symfile_read() calls elf_symtab_read() which calls > record_minimal_symbol() which calls prim_record_minimal_symbol_and_info(). > > - In prim_record_minimal_symbol_and_info(), the symbol language is set to > language_auto unconditionally. > > - After returning from elf_symtab_read(), install_minimal_symbols() is > called. At the end of install_minimal_symbols() a loop over all msymbols > tries to figure out if v3 ABI is used. This is done by requesting the > demangeled name calling SYMBOL_DEMANGLED_NAME. > > The problem is that SYMBOL_LANGUAGE is still set to language_auto and > the demangled name hasn't been generated at this point. This is absolutely not what should happen. prim_record_minimal_symbol_and_info: SYMBOL_SET_NAMES (msymbol, (char *)name, strlen (name), objfile); symbol_set_names: -> symbol_find_demangled_name if (gsymbol->language == language_cplus || gsymbol->language == language_auto) { demangled = cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); if (demangled != NULL) { gsymbol->language = language_cplus; return demangled; } } Please figure out why symbol_find_demangled_name has failed. It sounds to me like you are having a problem with leading underscores, if I remember my sh-elf-foo correctly. > What's especially weird is the comment above install_minimal_symbols(). > It implies that the function will try to demangle all symbols to set > the language correctly, but the function is not doing that. It would > only recognize symbols which has already been demangeled but that just > don't happen. Comment is out of date. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15215 invoked by alias); 10 Mar 2004 15:08:24 -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 15200 invoked from network); 10 Mar 2004 15:08:23 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 10 Mar 2004 15:08:23 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B15Jn-00086f-CG for ; Wed, 10 Mar 2004 10:08:23 -0500 Date: Wed, 10 Mar 2004 15:08:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [RFA] minsyms.c: Fix switching to GNU v3 ABI Message-ID: <20040310150822.GA31014@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040310105709.GJ25204@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040310105709.GJ25204@cygbert.vinschen.de> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03.o/txt/msg00230.txt Message-ID: <20040310150800.uPN1_LSB51I4U-cX-6kHEUUMeUgA0Q-UU7pUy00M7Q0@z> On Wed, Mar 10, 2004 at 11:57:09AM +0100, Corinna Vinschen wrote: > Hi, > > I was debugging a situation, in which an C++ object file has been build > using v3 ABI, but GDB did not recognize it and was assuming v2 ABI. The > target system is sh-elf, the compiler gcc 3.4. > > What I found is this: > > - The C++ ABI is set to v2 by default (gnu-v2-abi.c, _initialize_gnu_v2_abi). > > - While reading symbols from the object file, at one point elf_symfile_read() > (elfread.c) is called. > > - elf_symfile_read() calls elf_symtab_read() which calls > record_minimal_symbol() which calls prim_record_minimal_symbol_and_info(). > > - In prim_record_minimal_symbol_and_info(), the symbol language is set to > language_auto unconditionally. > > - After returning from elf_symtab_read(), install_minimal_symbols() is > called. At the end of install_minimal_symbols() a loop over all msymbols > tries to figure out if v3 ABI is used. This is done by requesting the > demangeled name calling SYMBOL_DEMANGLED_NAME. > > The problem is that SYMBOL_LANGUAGE is still set to language_auto and > the demangled name hasn't been generated at this point. This is absolutely not what should happen. prim_record_minimal_symbol_and_info: SYMBOL_SET_NAMES (msymbol, (char *)name, strlen (name), objfile); symbol_set_names: -> symbol_find_demangled_name if (gsymbol->language == language_cplus || gsymbol->language == language_auto) { demangled = cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); if (demangled != NULL) { gsymbol->language = language_cplus; return demangled; } } Please figure out why symbol_find_demangled_name has failed. It sounds to me like you are having a problem with leading underscores, if I remember my sh-elf-foo correctly. > What's especially weird is the comment above install_minimal_symbols(). > It implies that the function will try to demangle all symbols to set > the language correctly, but the function is not doing that. It would > only recognize symbols which has already been demangeled but that just > don't happen. Comment is out of date. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer