From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126139 invoked by alias); 22 Apr 2017 06:17:40 -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 126102 invoked by uid 89); 22 Apr 2017 06:17:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*Ad:U*tom, H*RU:67.222.38.55, HTo:D*polymtl.ca, H*RU:sk:gproxy5 X-HELO: gproxy5.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 22 Apr 2017 06:17:36 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy5.mail.unifiedlayer.com (Postfix) with ESMTP id 9729014060A for ; Sat, 22 Apr 2017 00:17:36 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id BJHZ1v0052f2jeq01JHcbX; Sat, 22 Apr 2017 00:17:36 -0600 X-Authority-Analysis: v=2.2 cv=VKStp5HX c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=B40V5LC6XHoew4H7B7AA:9 Received: from 75-166-63-71.hlrn.qwest.net ([75.166.63.71]:35578 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d1oMP-0003AI-04; Sat, 22 Apr 2017 00:17:33 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Use rust_demangle References: <20170418123111.11785-1-tom@tromey.com> Date: Sat, 22 Apr 2017 06:17:00 -0000 In-Reply-To: (Simon Marchi's message of "Fri, 21 Apr 2017 23:52:06 -0400") Message-ID: <87mvb93r0l.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1d1oMP-0003AI-04 X-Source-Sender: 75-166-63-71.hlrn.qwest.net (bapiya) [75.166.63.71]:35578 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-04/txt/msg00625.txt.bz2 >>>>> "Simon" == Simon Marchi writes: Simon> It looks like you got the wrong PR number, I think it should be 20367. Oops. Thanks for catching that. Simon> Here for example, could you provide an example of when things go wrong Simon> (a Rust symbol wrongfully demangled as a C++ symbol)? Sure, there's one in the patch: _ZN34_$LT$bc..X$u20$as$u20$bc..What$GT$4what17hec04869420f7eb7fE The C++ demangler thinks it understands this and transforms it to _$LT$bc..X$u20$as$u20$bc..What$GT$::what::hec04869420f7eb7f However, it's actually the Rust symbol: ::what The issue here is that Rust chose a C++-like mangling. This was probably a mistake. Maybe something can be done about it, maybe not -- but meanwhile I think it's nice if gdb can try to cope. >> * ... and, in light of this change, "set demangle-style" seems a bit >> weird because it allows the setting of styles to things obviously >> not related to C++ at all, hence a change in demangle.c. Simon> If other languages have mangling too, why shouldn't we be able to set Simon> the mangling to that style? For example, why shouldn't we be able to Simon> do "set demangle-style rust"? In my view, "set demangle-style" is not very useful. If you do set it, it affects future symbols only. It doesn't affect the ones already read. And, if you set it to something nonsensical, like "java", then other parts of the C++ support will break, because cp-name-parser only understands the C++ form. Also it mixes the mangled form (like "Lucid") with the output form (like "Java"), which seems odd. >> +char * >> +gdb_demangle_cxx (const char *mangled, int options) >> +{ >> + int style = (DMGL_GNU | DMGL_LUCID | DMGL_ARM >> + | DMGL_HP | DMGL_EDG | DMGL_GNU_V3); >> + >> + if ((current_demangling_style & DMGL_AUTO) == 0) >> + style &= current_demangling_style; Simon> This deserves a comment, what does it accomplish? Restrict the style Simon> to a restricted set of styles? Yes, it tries to obey "set demangle-style". However, if demangle-style is "auto", then there's no need to do anything else. Simon> Shouldn't this be libiberty_demangers[i].demangling_style_name? Yeah. I'll make the other changes. Tom