From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22822 invoked by alias); 8 Jan 2003 00:13:54 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 22814 invoked from network); 8 Jan 2003 00:13:53 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by 209.249.29.67 with SMTP; 8 Jan 2003 00:13:53 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id h080DdK24048; Tue, 7 Jan 2003 16:13:39 -0800 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: Paul Hilfinger Cc: Elena Zannoni , Adam Fedor , GDB Patches , Daniel Jacobowitz Subject: Re: Demangling and searches References: <200301072354.PAA18230@tully.CS.Berkeley.EDU> From: David Carlton Date: Wed, 08 Jan 2003 00:13:00 -0000 In-Reply-To: <200301072354.PAA18230@tully.CS.Berkeley.EDU> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00068.txt.bz2 On Tue, 07 Jan 2003 15:54:36 -0800, Paul Hilfinger said: > For some time, I've been meaning to ask a basic question about GDB > search strategy: for language implementations that mangle their > identifiers, the standard procedure in GDB at the moment is to > search for the demangled identifier among the demangled identifiers > of the symbol table, and to speed this search up by precomputing and > storing the demangled symbol names. Why? > We used to do that for Ada mode in GDB, but subsequently changed our > approach entirely. For Ada, we MANGLE the symbol we're searching > for and then search among the MANGLED (i.e., raw, unmodified, > warm-from- the-executable) names. I'm curious: in Ada, what does the mangling do? In particular, how much type info does it contain? In C++, the mangled name contains type info for the arguments for functions; I don't see how, using GDB's current data structures, to allow us to allow users to, say, break on a function without requiring them to specify the types of the arguments, if we took your approach. (Though it might be possible to modify GDB's data structures to allow that.) Also, C++ debugging really takes place in a mixed C/C++ environment (which is really inherent to the nature of C++, given the possibility of 'extern "C"') so it can be hard to tell if mangling is required in the first place. Come to think of it, anonymous namespaces would make life pretty difficult, too. It's amusing that you raise the issue right now, because several of us are arguing about this off-list: I'd rather not deal with the fact that sometimes we demangle and sometimes (partial symbols) we don't, but other people say that demangling partial symbols would be too expensive. Daniel Jacobowitz might be coming up with a nice compromise that allows us to share data when appropriate. I don't see how to reasonably avoid doing quite a lot of demangling (at the very least demangling all minimal symbols when loading them in), but maybe it's possible if you folks are doing it. David Carlton carlton@math.stanford.edu