Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Christian Biesinger <cbiesinger@google.com>,	gdb-patches@sourceware.org
Subject: [review] Replace the MSYMBOL_*_NAME macros with member functions
Date: Thu, 21 Nov 2019 15:15:00 -0000	[thread overview]
Message-ID: <20191121151514.1A86F2816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1574139056000.I65aa529843a9903e174ce799037e41f954a9fcee@gnutoolchain-gerrit.osci.io>

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 <cbiesinger@google.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Thu, 21 Nov 2019 15:15:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


  reply	other threads:[~2019-11-21 15:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  4:51 Christian Biesinger (Code Review)
2019-11-21 15:15 ` Simon Marchi (Code Review) [this message]
2019-11-22  0:17 ` [review v2] " Christian Biesinger (Code Review)
2019-11-22  0:17 ` Christian Biesinger (Code Review)
2019-11-22  1:06 ` Simon Marchi (Code Review)
2019-11-22 18:07 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-22 18:07 ` Sourceware to Gerrit sync (Code Review)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191121151514.1A86F2816F@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox