From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8727 invoked by alias); 13 Jun 2016 13:35:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8690 invoked by uid 89); 13 Jun 2016 13:35:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=onward, Hx-languages-length:1278 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 13 Jun 2016 13:35:07 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1F8164388; Mon, 13 Jun 2016 13:35:05 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5DDZ4S1010526; Mon, 13 Jun 2016 09:35:05 -0400 Subject: Re: [RFA 3/3] Move logic out of symbol_find_demangled_name To: Tom Tromey References: <1465051760-25840-1-git-send-email-tom@tromey.com> <1465051760-25840-4-git-send-email-tom@tromey.com> <86mvmywgj1.fsf@gmail.com> <8760tl6xbf.fsf@tromey.com> <9b062e13-3541-b122-2da8-1c61fe7fe55b@redhat.com> <871t496nk4.fsf@tromey.com> Cc: Yao Qi , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <7c3ef506-e9f3-968d-c192-c67c99e00269@redhat.com> Date: Mon, 13 Jun 2016 13:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <871t496nk4.fsf@tromey.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-06/txt/msg00225.txt.bz2 On 06/07/2016 04:11 PM, Tom Tromey wrote: > Pedro> Before, this would set language to language_cplus, even if the > Pedro> symbol's language was Rust. > [...] > Pedro> However, this no longer forces C++, is that intended? > > I think the old code was in error. Actually, AFAICS, the new code does the same thing, because the C++ version and the Rust version are exactly the same. From your latest patch: +/* See cp-support.h. */ + +int +gdb_sniff_from_mangled_name (const char *mangled, char **demangled) +{ + *demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); + return *demangled != NULL; +} +/* la_sniff_from_mangled_name for Rust. */ + +static int +rust_sniff_from_mangled_name (const char *mangled, char **demangled) +{ + *demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); + return *demangled != NULL; +} + ... and, the C++ version always wins, because C++ is listed first in the languages enum. Sounds like rust_sniff_from_mangled_name is not reachable. I think this warrants at least a comment somewhere. IIUC, from Rust 1.9 onward, Rust uses C++ mangling, so basically there's no way to tell a C++ symbol from a Rust symbol from the mangled name alone. Correct? Thanks, Pedro Alves