From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3129 invoked by alias); 2 Oct 2002 20:43:39 -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 3094 invoked from network); 2 Oct 2002 20:43:38 -0000 Received: from unknown (HELO mail.cdt.org) (206.112.85.61) by sources.redhat.com with SMTP; 2 Oct 2002 20:43:38 -0000 Received: from dberlin.org (pool-138-88-127-54.res.east.verizon.net [138.88.127.54]) by mail.cdt.org (Postfix) with ESMTP id 22964490072; Wed, 2 Oct 2002 16:19:55 -0400 (EDT) Received: from [192.168.0.91] (account dberlin HELO dberlin.org) by dberlin.org (CommuniGate Pro SMTP 4.0b9a) with ESMTP id 431176; Wed, 02 Oct 2002 16:43:34 -0400 Date: Wed, 02 Oct 2002 13:43:00 -0000 Subject: Re: RFA: Search for symbol names the same way they're hashed. Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v546) Cc: David Carlton , gdb-patches@sources.redhat.com To: Jim Blandy From: Daniel Berlin In-Reply-To: Message-Id: <9E984716-D647-11D6-B6DC-000393575BCC@dberlin.org> Content-Transfer-Encoding: 7bit X-SW-Source: 2002-10/txt/msg00074.txt.bz2 On Wednesday, October 2, 2002, at 03:18 PM, Jim Blandy wrote: > > I just did a quick survey of the uses of SYMBOL_SOURCE_NAME. They all > fall into two categories: > - printing symbol names, and > - sort comparison functions. > > The first usage is exactly correct: the way a symbol prints should > respect the current demangling setting. > > The second usage seems wrong to me: if you sort under one demangling > setting, but then search under a different one, well, ... duh. SYMBOL_SOURCE_NAME changes won't help here, it'll only fix half the problem. Try setting a demangling style that is wrong (say EDG), then loading a C++ file (ie reading it's symbols), then setting the right demangling style. Observe: [dberlin@dberlin gdb]$ ./gdb GNU gdb 2002-08-15-cvs Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu". Setting up the environment for debugging gdb. .gdbinit:5: Error in sourced command file: No symbol table is loaded. Use the "file" command. (gdb) set demangle-style edg (gdb) file a.out Reading symbols from a.out...done. (gdb) info func bob All functions matching regular expression "bob": File testcpp.cpp: int _Z3bobv(void); (gdb) set demangle-style gnu gnu gnu-v3 (gdb) set demangle-style gnu-v3 (gdb) info func bob All functions matching regular expression "bob": File testcpp.cpp: int _Z3bobv(void); (gdb) b bob Function "bob" not defined. (gdb) Even after you set the right demangling style, it's too late. The symbols in the symbol table will have the wrong demangled names, so even if you made SYMBOL_DEMANGLEST or whatever, it will still be wrong. We need to make demangling-style only affect *printout* and *user entered strings*, and during symbol reading, force it to auto, so it always gets the right names in the symbol table in the first place. > The source code name of a symbol does not depend depend on the current > demangling setting; And to enforce this, you have to make the readers *not* honor the demangling style. If you just fix SYMBOL_SOURCE_NAME, SYMBOL_INIT_DEMANGLED_NAME will still be only called once, and it'll have the wrong demangling style when it calls cplus_demangle, resulting in the symbol having the wrong demangled name forevermore.