Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Remove completion_list_add_msymbol
Date: Thu, 19 Dec 2019 19:35:00 -0000	[thread overview]
Message-ID: <CAPTJ0XHcRDJtb9bAgLmO6TTdG8QiKpWN0cTRd=+ODNiXkd_pVQ@mail.gmail.com> (raw)
In-Reply-To: <20191219095825.GB3865@embecosm.com>

On Thu, Dec 19, 2019 at 3:58 AM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
>
> * Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> [2019-12-18 19:42:38 -0600]:
>
> > Now that both symbol and minimal_symbol inherit from general_symbol_info,
> > we can use the same function for both here.
> >
> > gdb/ChangeLog:
> >
> > 2019-12-18  Christian Biesinger  <cbiesinger@google.com>
> >
> >       * symtab.c (completion_list_add_symbol): Update.
> >       (completion_list_add_msymbol): Remove.
> >       (default_collect_symbol_completion_matches_break_on): Update.
>
> I have a change I'm currently working on that I think will add some
> additional code to completion_list_add_symbol but not
> completion_list_add_msymbol, however, it might take me a week or so to
> finish up the change.
>
> I'm happy for this patch to go in, but just a warning I might end up
> having to reverse this as part of my work when I get it finished.

Oh, in that case there's no point in landing this just to get it reverted.

(I still think it's confusing that the same symbol can have an msymbol
and a psymbol/symbol referring to it. I would really like to do
"something" about that; but not sure exactly what....)

Christian

> In case you (or anyone) is interested, the problem I'm trying to fix
> is something that has annoyed me for ages.  Consider this C++ code:
>
>   struct object { int a; };
>   typedef object *object_p;
>
>   static int
>   get_value (object_p obj)
>   {
>     return obj->a;
>   }
>
>   int
>   main ()
>   {
>     object obj;
>     obj.a = 0;
>
>     int val = get_value (&obj);
>     return val;
>   }
>
> Now in GDB:
>
>   (gdb) complete break get_va
>   break get_value(object*)
>   break get_value(object_p)
>
> Those two completions, that's what drives me mad.  I now have GDB
> basically fixed up so that it only offers `break get_value(object_p)`
> as a completion (though you can manually type either if you wish), but
> I just have one more issue left to resolve.
>
> Thanks,
> Andrew
>
>
> >
> > Change-Id: Ifa01837d5f7e3438e7e6599c08baf1a2e7f086c9
> > ---
> >  gdb/symtab.c | 22 ++++------------------
> >  1 file changed, 4 insertions(+), 18 deletions(-)
> >
> > diff --git a/gdb/symtab.c b/gdb/symtab.c
> > index 26551372cb..a76c5d304f 100644
> > --- a/gdb/symtab.c
> > +++ b/gdb/symtab.c
> > @@ -5250,11 +5250,11 @@ completion_list_add_name (completion_tracker &tracker,
> >    }
> >  }
> >
> > -/* completion_list_add_name wrapper for struct symbol.  */
> > +/* completion_list_add_name wrapper for struct general_symbol_info.  */
> >
> >  static void
> >  completion_list_add_symbol (completion_tracker &tracker,
> > -                         symbol *sym,
> > +                         general_symbol_info *sym,
> >                           const lookup_name_info &lookup_name,
> >                           const char *text, const char *word)
> >  {
> > @@ -5263,20 +5263,6 @@ completion_list_add_symbol (completion_tracker &tracker,
> >                           lookup_name, text, word);
> >  }
> >
> > -/* completion_list_add_name wrapper for struct minimal_symbol.  */
> > -
> > -static void
> > -completion_list_add_msymbol (completion_tracker &tracker,
> > -                          minimal_symbol *sym,
> > -                          const lookup_name_info &lookup_name,
> > -                          const char *text, const char *word)
> > -{
> > -  completion_list_add_name (tracker, sym->language (),
> > -                         sym->natural_name (),
> > -                         lookup_name, text, word);
> > -}
> > -
> > -
> >  /* ObjC: In case we are completing on a selector, look as the msymbol
> >     again and feed all the selectors into the mill.  */
> >
> > @@ -5614,8 +5600,8 @@ default_collect_symbol_completion_matches_break_on
> >             if (completion_skip_symbol (mode, msymbol))
> >               continue;
> >
> > -           completion_list_add_msymbol (tracker, msymbol, lookup_name,
> > -                                        sym_text, word);
> > +           completion_list_add_symbol (tracker, msymbol, lookup_name,
> > +                                       sym_text, word);
> >
> >             completion_list_objc_symbol (tracker, msymbol, lookup_name,
> >                                          sym_text, word);
> > --
> > 2.24.1.735.g03f4e72817-goog
> >


      reply	other threads:[~2019-12-19 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19  1:42 Christian Biesinger via gdb-patches
2019-12-19  9:58 ` Andrew Burgess
2019-12-19 19:35   ` Christian Biesinger via gdb-patches [this message]

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='CAPTJ0XHcRDJtb9bAgLmO6TTdG8QiKpWN0cTRd=+ODNiXkd_pVQ@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=andrew.burgess@embecosm.com \
    --cc=cbiesinger@google.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