From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39607 invoked by alias); 19 Dec 2019 19:35:31 -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 39299 invoked by uid 89); 19 Dec 2019 19:35:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-29.7 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=sk:andrew., offers X-HELO: mail-oi1-f196.google.com Received: from mail-oi1-f196.google.com (HELO mail-oi1-f196.google.com) (209.85.167.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2019 19:35:30 +0000 Received: by mail-oi1-f196.google.com with SMTP id v140so3588571oie.0 for ; Thu, 19 Dec 2019 11:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9IZ9BjW4B/Y7a8QZ6WH34w/sG36KzMdCfjjykQYnXHQ=; b=jD/OdsywxmmoFWSvkxWJPZb+ZmiUXx0APbbRPJWZoeMlYn1KXlUYDpB03tXg0CbBT1 JySjwsRoUELy/YaAvZg5ZjUn6bIn+HOA5Vk/hyxXBw0Hluvfa+tzoVXd+TtetQ6H1t27 fx3KTiWsv6oe5NxC56a4pJ9mYPbftqPbaFuffQyVn1WyZHPEBCYcSkcHwhooLiTArG+U ncY6dpHEyTZxtSxSkHyDeASaIE3szgH7sRJtqv25NiX7PskdfvUFxuKUowa02ZaZ5ElK s8sLxx+hMzFEz0kkKSExro1sL1XRQv9BoQBI+WCCO791Rmtg0vvsD+YpQZaDSE7xoedQ HqcQ== MIME-Version: 1.0 References: <20191219014238.85498-1-cbiesinger@google.com> <20191219095825.GB3865@embecosm.com> In-Reply-To: <20191219095825.GB3865@embecosm.com> From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Thu, 19 Dec 2019 19:35:00 -0000 Message-ID: Subject: Re: [PATCH] Remove completion_list_add_msymbol To: Andrew Burgess Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00837.txt.bz2 On Thu, Dec 19, 2019 at 3:58 AM Andrew Burgess wrote: > > * Christian Biesinger via gdb-patches [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 > > > > * 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 > >