[PATCH] Allow reference form for DW_AT_associated and DW_AT_allocated attributes
Andrew Burgess
andrew.burgess@embecosm.com
Wed Jul 1 11:15:35 GMT 2020
* Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-07-01 09:37:37 +0000]:
> Thanks for your comment/suggestion. Please find updated patch as an attachment.
>
> gdb/ChangeLog
>
> * dwarf2/read.c (set_die_type): Removed conditions to restrict
> forms for DW_AT_associated and DW_AT_allocated attributes,
> which is already checked in function attr_to_dynamic_prop.
>
> Regards,
> Alok
Looks good. Please go ahead and apply.
Thanks,
Andrew
>
> -----Original Message-----
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Sent: Wednesday, July 1, 2020 1:50 PM
> To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>
> Cc: 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
>
> [CAUTION: External Email]
>
> * 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
>
More information about the Gdb-patches
mailing list