Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sharma, Alok Kumar" <AlokKumar.Sharma@amd.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "George, Jini Susan" <JiniSusan.George@amd.com>,
	"Achra, Nitika" <Nitika.Achra@amd.com>
Subject: [PATCH] Allow reference form for DW_AT_associated and DW_AT_allocated attributes
Date: Wed, 1 Jul 2020 07:01:53 +0000	[thread overview]
Message-ID: <MW2PR12MB23805BD579EC7461DF3F433B9E6C0@MW2PR12MB2380.namprd12.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

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




[-- Attachment #2: 0001-Allow-reference-form-for-DW_AT_associated-and-DW_AT_.patch --]
[-- Type: application/octet-stream, Size: 2215 bytes --]

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))
@@ -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  7:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01  7:01 Sharma, Alok Kumar [this message]
2020-07-01  8:20 ` Andrew Burgess
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=MW2PR12MB23805BD579EC7461DF3F433B9E6C0@MW2PR12MB2380.namprd12.prod.outlook.com \
    --to=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