Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: "Sharma, Alok Kumar" <AlokKumar.Sharma@amd.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"George, Jini Susan" <JiniSusan.George@amd.com>,
	"Achra, Nitika" <Nitika.Achra@amd.com>
Subject: Re: [PATCH] Allow reference form for DW_AT_associated and DW_AT_allocated attributes
Date: Wed, 1 Jul 2020 09:20:21 +0100	[thread overview]
Message-ID: <20200701082021.GQ2737@embecosm.com> (raw)
In-Reply-To: <MW2PR12MB23805BD579EC7461DF3F433B9E6C0@MW2PR12MB2380.namprd12.prod.outlook.com>

* Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-07-01 07:01:53 +0000]:

> Hi All,
> 
> I request you all to please review this patch. Below are the details.
> 
> Problem Description:
>     Currently, GDB rejects the (die) reference form while it accepts exprloc
>     form. It is allowed in DWARF standard. "Table 7.5: Attribute encodings"
>     in DWARF5 standard. Flang compiler assigns (die) reference to
>     DW_AT_associated and DW_AT_allocated for some cases. 
> Resolution:
>     Now ' set_die_type' Is modified to accept reference form as well.
> This change will not impact testsuite for gfortran, and will fix failures for
> Flang compiler with existing testsuite.
> 
>     gdb/ChangeLog
> 
>             * dwarf2/read.c (set_die_type): Allow reference form for
>             DW_AT_associated and DW_AT_allocated attributes.
> 
> Please let me know your valuable comments.
> 
> Regards,
> Alok
>
> From 9a37e9973e513738234b4fed4b66d0ffc1438398 Mon Sep 17 00:00:00 2001
> From: alosharm <AlokKumar.Sharma@amd.com>
> Date: Wed, 1 Jul 2020 11:53:09 +0530
> Subject: [PATCH] Allow reference form for DW_AT_associated and DW_AT_allocated
>  attributes
> 
> Currently, GDB rejects the (die) reference form while it accepts exprloc
> form. It is allowed in DWARF standard. "Table 7.5: Attribute encodings"
> in DWARF5 standard. Flang compiler assigns (die) reference to
> DW_AT_associated and DW_AT_allocated for some cases.
> 
> gdb/ChangeLog
> 
> 	* dwarf2/read.c (set_die_type): Allow reference form for
> 	DW_AT_associated and DW_AT_allocated attributes.
> ---
>  gdb/ChangeLog     | 5 +++++
>  gdb/dwarf2/read.c | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index d64f572e07..75ea79471c 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2020-07-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
> +
> +	* dwarf2/read.c (set_die_type): Allow reference form for
> +	DW_AT_associated and DW_AT_allocated attributes.
> +
>  2020-06-30  Tom Tromey  <tromey@adacore.com>
>  
>  	* dwarf2/read.c (quirk_rust_enum): Correctly call
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index b097f624b6..0fba590184 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -23859,7 +23859,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
>  
>    /* Read DW_AT_allocated and set in type.  */
>    attr = dwarf2_attr (die, DW_AT_allocated, cu);
> -  if (attr != NULL && attr->form_is_block ())
> +  if (attr != NULL && (attr->form_is_block () || attr->form_is_ref ()))
>      {
>        struct type *prop_type = cu->addr_sized_int_type (false);
>        if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))

Looking at attr_to_dynamic_prop we handle block, ref, and constants,
otherwise we give complain about an unexpected attribute type.

I think then that there's no need to check the form of the attribute
here at all, you could just perform a NULL check and proceed to handle
the attribute.  The error in the else block (about incorrect attribute
form) can be deleted.

This applies to both the changes in this patch.

Thanks,
Andrew


> @@ -23874,7 +23874,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
>  
>    /* Read DW_AT_associated and set in type.  */
>    attr = dwarf2_attr (die, DW_AT_associated, cu);
> -  if (attr != NULL && attr->form_is_block ())
> +  if (attr != NULL && (attr->form_is_block () || attr->form_is_ref ()))
>      {
>        struct type *prop_type = cu->addr_sized_int_type (false);
>        if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
> -- 
> 2.17.1



  reply	other threads:[~2020-07-01  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01  7:01 Sharma, Alok Kumar
2020-07-01  8:20 ` Andrew Burgess [this message]
2020-07-01  9:37   ` Sharma, Alok Kumar
2020-07-01 11:15     ` Andrew Burgess

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=20200701082021.GQ2737@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=AlokKumar.Sharma@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=Nitika.Achra@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