From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7863 invoked by alias); 21 Nov 2019 15:15:34 -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 7815 invoked by uid 89); 21 Nov 2019 15:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=clash, MSYMBOL_*_NAME, *linkage_name, msymbol_*_name X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Nov 2019 15:15:25 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id CFCD7203A6; Thu, 21 Nov 2019 10:15:19 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 48C9D201F1; Thu, 21 Nov 2019 10:15:14 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 1A86F2816F; Thu, 21 Nov 2019 10:15:14 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Thu, 21 Nov 2019 15:15:00 -0000 From: "Simon Marchi (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review] Replace the MSYMBOL_*_NAME macros with member functions X-Gerrit-Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee X-Gerrit-Change-Number: 688 X-Gerrit-ChangeURL: X-Gerrit-Commit: 77e1745e378488281b5860c976f24465fcce7fa9 In-Reply-To: References: X-Gerrit-Comment-Date: Thu, 21 Nov 2019 10:15:13 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191121151514.1A86F2816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00654.txt.bz2 Simon Marchi has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/688 ...................................................................... Patch Set 1: (2 comments) | --- gdb/symtab.h | +++ gdb/symtab.h | @@ -75,15 +75,19 @@ enum class symbol_name_match_type | SEARCH_NAME, | | /* Expression matching. The same as FULL matching in most | languages. The same as WILD matching in Ada. */ | EXPRESSION, | }; | | +/* Whether to demangle the print name of symbols. */ | + | +extern bool demangle; PS1, Line 84: I was confused with where that came from. It comes from lower in the file (originally line 556). The demangle variable is defined in demangle.c, and there's already a declaration in gdb-demangle.h. gdb-demangle.h is probably the header associated to demangle.c, but named like that to avoid a clash with include/demangle.h. So as a cleanup patch before this one, I would suggest to try to: 1. Rename demangle.c to gdb-demangle.c to match the header file and make it clear they are associated. Rename _initialize_demangler to _initialize_gdb_demangle so the initialize function matches the name of the file. 2. Remove the demangle variable declaration from symtab.h. Hopefully this isn't too difficult. | + | /* Hash the given symbol search name according to LANGUAGE's | rules. */ | extern unsigned int search_name_hash (enum language language, | const char *search_name); | | /* Ada-specific bits of a lookup_name_info object. This is lazily | constructed on demand. */ | ... | @@ -380,2 +384,19 @@ /* This structure is space critical. See space comments at the top. */ | struct general_symbol_info | { | + /* Short version as to when to use which name accessor: | + Use natural_name () to refer to the name of the symbol in the original | + source code. Use linkage_name () if you want to know what the linker | + thinks the symbol's name is. Use print_name () for output. Use | + demangled_name () if you specifically need to know whether natural_name () | + and linkage_name () are different. */ | + | + const char *linkage_name () const { PS1, Line 393: Format these either like: const char *linkage_name () const { return name; } or const char *linkage_name () const { return name; } For the obvious one-liners, I like the second version. I don't think we have an explicit rule for this, but Tromey started doing this when we started with C++ and nobody complained. | + return name; | + } | + | + /* Return SYMBOL's "natural" name, i.e. the name that it was called in | + the original source code. In languages like C++ where symbols may | + be mangled for ease of manipulation by the linker, this is the | + demangled name. */ | + const char *natural_name () const; | + -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee Gerrit-Change-Number: 688 Gerrit-PatchSet: 1 Gerrit-Owner: Christian Biesinger Gerrit-CC: Simon Marchi Gerrit-Comment-Date: Thu, 21 Nov 2019 15:15:13 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment