public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Sharma, Alok Kumar via Gdb-patches" <gdb-patches@sourceware.org>
Cc: "Sharma, Alok Kumar" <AlokKumar.Sharma@amd.com>,
	 "George, Jini Susan" <JiniSusan.George@amd.com>
Subject: Re: [PATCH] Enable Access to containing scope variables from nested inlined function
Date: Fri, 14 Oct 2022 13:26:28 -0600	[thread overview]
Message-ID: <87wn92kxzv.fsf@tromey.com> (raw)
In-Reply-To: <CO6PR12MB54919D329BC9BCAC5EF7D4089E929@CO6PR12MB5491.namprd12.prod.outlook.com> (Alok Kumar via Gdb-patches Sharma's message of "Sun, 24 Jul 2022 18:16:23 +0000")

>>>>> Sharma, Alok Kumar via Gdb-patches <gdb-patches@sourceware.org> writes:

> The gcc compiler supports nested (local scoped) function for end user,
> the Clang compiler does not allow nested function for end user but
> compiler itself generates such artificial functions internally ( in
> case of Openmp). General barrier by gdb reduces debug experience,
> current patch enhances debugging in such cases.

It seems to me that allowing access to the locals of the enclosing
function will yield weird behavior in some situations, for example when
the enclosing function shadows some global variable.

Is there any way to detect specifically this Openmp case and only
implement this behavior for it?

> +/* Data structure to contain DIE, generated BLOCK for it and in case
> +   DIE is inlined its ORIG_DIE which is DIE represented by the
> +   DW_AT_abstract_origin attribute.  */
> +
> +struct die_block
> +  {
> +    struct die_info *die;
> +    struct die_info *orig_die;
> +    struct block *block;
> +  };
> +
> +/* List of DIE_BLOCKs   */
> +
> +struct die_block_list
> +  {
> +    struct die_block_list *next;
> +    struct die_block mem;
> +  };

You definitely don't want to reference die_info from generic code.

There's other issues with this part of the patch but I am hoping it's
just not needed.

> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index ac902a4cbbe..0f765e2aec3 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h

> @@ -1399,6 +1409,10 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
 
>    void set_symtab (struct symtab *symtab);
 
> +  /* Original scope (before inlining) block of inlined function.  */
> +
> +  struct block *m_scopeblock;
> +

Adding a field to struct symbol also should be avoided.
Isn't this information already implicit in the block nesting?

Tom

      parent reply	other threads:[~2022-10-14 19:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 18:16 Sharma, Alok Kumar
2022-08-01  5:56 ` Sharma, Alok Kumar
2022-08-07 15:05   ` Sharma, Alok Kumar
2022-08-15  9:45     ` Sharma, Alok Kumar
2022-08-29 11:23       ` Sharma, Alok Kumar
2022-09-12  5:21         ` Sharma, Alok Kumar
2022-09-21  7:08           ` Sharma, Alok Kumar
2022-10-11 14:24             ` Sharma, Alok Kumar
2022-10-14 19:26 ` Tom Tromey [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=87wn92kxzv.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=AlokKumar.Sharma@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=gdb-patches@sourceware.org \
    /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).