public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: sami wagiaalla <swagiaal@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] create and use symbol_set_language
Date: Wed, 04 Aug 2010 21:56:00 -0000	[thread overview]
Message-ID: <AANLkTimB2ME5zDOtHZzw0eRm+FX1KkQv6c3QiYE2oNqL@mail.gmail.com> (raw)
In-Reply-To: <6308127460174723176@unknownmsgid>

On Wed, Aug 4, 2010 at 12:27 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
> Hi Sami,
>
>  I just looked at your patch, which seems
> quite straightforward.
>
>  Nevertheless, it seems that
> it contains a change that is not commented:
>
> @@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct
> general_symbol_info *gsymbol)
>  /* Initialize the language dependent portion of a symbol
>    depending upon the language for the symbol. */
>  void
> -symbol_init_language_specific (struct general_symbol_info *gsymbol,
> -                              enum language language)
> +symbol_set_language (struct general_symbol_info *gsymbol,
> +                     enum language language)
>  {
> -
>   gsymbol->language = language;
> -  if (gsymbol->language == language_cplus
> -      || gsymbol->language == language_d
> +  if (gsymbol->language == language_d
>       || gsymbol->language == language_java
>       || gsymbol->language == language_objc
>       || gsymbol->language == language_fortran)
>
>  The removal of the 'gsymbol->language == language_cplus'
> condition seems to be outside of the scope of the patch you
> describe, which seems otherwise quite straightforward.
>
>  Could you please comment on the reason of that specific change?
> Is it really part of that patch or shouldn't it be submitted
> separately? I must confess that I didn't even try to
> look at the source code after the 'if', but just reacted quickly
> on something that seem 'off topic' as compared to
> your patch description.

Yeah.  This part of the patch is correct, it just needs a ChangeLog entry.
[One could submit it separately, but I don't mind it being included here.]
What's happening here is that language_cplus is being checked for twice.
Here's the current definition of the function.

void
symbol_init_language_specific (struct general_symbol_info *gsymbol,
                               enum language language)
{

  gsymbol->language = language;
  if (gsymbol->language == language_cplus
      || gsymbol->language == language_d
      || gsymbol->language == language_java
      || gsymbol->language == language_objc
      || gsymbol->language == language_fortran)
    {
      symbol_set_demangled_name (gsymbol, NULL, NULL);
    }
  else if (gsymbol->language == language_cplus)
    gsymbol->language_specific.cplus_specific = NULL;
  else
    {
      memset (&gsymbol->language_specific, 0,
              sizeof (gsymbol->language_specific));
    }
}

The patch is generally ok, but a bit more is required:

- the additional ChangeLog entry to mention fixing test of language_cplus

- after applying the patch, grepping for SYMBOL_INIT still has a few
hits that need to be addressed:

gdb$ grep SYMBOL_INIT *.[ch]
buildsym.c:#include "demangle.h"                /* Needed by
SYMBOL_INIT_DEMANGLED_NAME.  */
symtab.h:   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc.

- one potential formatting nit:

diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index b62156c..ea9d1e0 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -704,7 +704,7 @@ define_symbol (CORE_ADDR valu, char *string, int
desc, int type,
   else
     {
     normal:
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+    SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
 	{
 	  char *name = alloca (p - string + 1);

I'm happy with the patch with those changes.

  parent reply	other threads:[~2010-08-04 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 14:56 sami wagiaalla
2010-08-04  7:27 ` Pierre Muller
2010-08-05 15:36   ` sami wagiaalla
     [not found] ` <6308127460174723176@unknownmsgid>
2010-08-04 21:56   ` Doug Evans [this message]
2010-08-04 22:01     ` Doug Evans
2010-08-05 19:05     ` sami wagiaalla

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=AANLkTimB2ME5zDOtHZzw0eRm+FX1KkQv6c3QiYE2oNqL@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    --cc=swagiaal@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).