public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Willgerodt, Felix" <felix.willgerodt@intel.com>
To: Tom Tromey <tom@tromey.com>,
	Felix Willgerodt via Gdb-patches <gdb-patches@sourceware.org>
Subject: RE: [PATCH 1/1] gdb: Enable complete to show members of anonymous classes/structs.
Date: Thu, 24 Nov 2022 12:58:54 +0000	[thread overview]
Message-ID: <MN2PR11MB4566237F84CC09B0CABE89B88E0F9@MN2PR11MB4566.namprd11.prod.outlook.com> (raw)
In-Reply-To: <877czsq9yf.fsf@tromey.com>

> Felix> Not knowing too much about LOC_COMPUTED, I am assuming that this
> is the right
> Felix> symbol class for this case and that we should adjust
> Felix> completion_list_add_fields() for it.
> Felix> But it could very well be that I missed something.  Any comments
> welcome!
> 
> I don't think there's any requirement that 'this' be LOC_COMPUTED.
> 
> LOC_COMPUTED just means that the symbol's address is computed via some
> function call (normally into the DWARF code to handle an exprloc).
> However, nothing says it couldn't be LOC_REGISTER or LOC_ARG or
> something.

Why is the code in completion_list_add_fields() restricted to LOC_TYPEDEF
currently? That is what I don't understand at all, and why I (over-) cautiously
added LOC_COMPUTED in the first place.


> Felix> +  if (sym->aclass () == LOC_TYPEDEF
> Felix> +      || (sym->aclass () == LOC_COMPUTED && t->code () ==
> TYPE_CODE_PTR))
> 
> It seems like this could match many local symbols -- like, nearly any
> local variable that has pointer type.  But, completing on these fields
> is not desirable; instead you only want to examine 'this'.
> 
> Instead you probably want something like what lookup_symbol_aux does:
> 
>   if (is_a_field_of_this != NULL && domain != STRUCT_DOMAIN)
>     {
>       result = lookup_language_this (langdef, block);
> 
>       if (result.symbol)
> 
> That is, use the current language (or in this case perhaps some search
> language, I don't really know) to find the name of 'this', then use it
> if this symbol matches.  Probably this should be done in the caller to
> avoid a lot of repeated calls.

So we need to compare the symbol from lookup_language_this() with the
symbol we are currently looking at? Okay, I will try to find a solution
that is not repeating the call per symbol basis, but per block basis in the caller.
I will try to post a new revision soon, but it might take a bit.

Thanks,
Felix
 
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

      reply	other threads:[~2022-11-24 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  7:21 Felix Willgerodt
2022-09-06 14:41 ` Bruno Larsen
2022-09-20  9:48 ` [Ping] " Willgerodt, Felix
2022-10-17  8:33 ` [Ping v2] " Willgerodt, Felix
2022-10-26 12:06 ` [Ping v3] " Willgerodt, Felix
2022-11-08 11:00 ` [Ping v4] " Willgerodt, Felix
2022-11-18 20:33 ` Tom Tromey
2022-11-24 12:58   ` Willgerodt, Felix [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=MN2PR11MB4566237F84CC09B0CABE89B88E0F9@MN2PR11MB4566.namprd11.prod.outlook.com \
    --to=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).