From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by sourceware.org (Postfix) with ESMTPS id 7689D3857010 for ; Wed, 1 Jul 2020 08:20:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7689D3857010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x444.google.com with SMTP id a6so22856390wrm.4 for ; Wed, 01 Jul 2020 01:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SVszahP4EvAzmq2lJTUJketTpb2raTjJ7t80mpawxtk=; b=MmYsIaGyNtamfb+tAxigz3lJUmMdXcpCHxA5aalK05ycGFuPVqYTQxJNGkGFO1rQcu SWLnp2TVJ29ljAkw4RAoT/5TVwzC1LdWzoJei2HRdpzfqF5d56UFDPTga1zsTGeVlj8O TnVuO4mxezlqdgEkeCcXdKCwYGB/dYBtQQS3u5pjUmhAs2DQXnarq4Y4wOqqI7S7Xk5W vUDAXHr5bpib8TneOqOFNkIQzmc8z8QHxgs/5DojrXz6oitK63HQjf3j/cY4kkHREB3/ txI2nat8IFwITTMbWzxPlmAmwedK+pnkzG6NQ8S/joAKq2rMWLA2snz4NWtxHLhx6q5Z gGRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SVszahP4EvAzmq2lJTUJketTpb2raTjJ7t80mpawxtk=; b=J1qghvVU7bgM+hs9eqVWv1cZ8NHd8KNN7Yp8oK2hSSiITZwItwjtcghWFm8oLfMltx Pdv0jEX4iM24gRGv6fNjqGyBcQDs+rnXsHoUdkORk164IyQ5czv/g3THXVULX7NpVyRS ARveb7EFYdQ9diNxB7r+yTYJ/FFZ7/+bleNmJaki8RdoU4yKW6XiqAPO1JDmzR8vgsy5 MuXk5xbVivQFD2s3ODwAuji4gZ1KElyXFl0XMFP/lJeClUMUCwpxfmSGhipPEXnPDsQv uXTZ4hcQYe8eB+83KaKgeocndLn0L/SNBxTJlw8fSZxmpi3/Kj7n8nVCq+NhUvIOpur7 024g== X-Gm-Message-State: AOAM532wof96naeNpDDd0WW8V7tBaHQrRMWjcKSnBjuS/IpMl6VVnZwl QhKNd9cYNBg/tY3IOBG80u3JfA== X-Google-Smtp-Source: ABdhPJykSCsOi1OY4Q+P5rlmSDYBRlJOPSjVkaJiTS0sw7BwV4nWBo6DDD91j57BT2uBUM6WKjJBgw== X-Received: by 2002:a5d:504b:: with SMTP id h11mr25053724wrt.160.1593591623524; Wed, 01 Jul 2020 01:20:23 -0700 (PDT) Received: from localhost (host109-154-72-253.range109-154.btcentralplus.com. [109.154.72.253]) by smtp.gmail.com with ESMTPSA id q7sm6711341wrs.27.2020.07.01.01.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 01:20:22 -0700 (PDT) Date: Wed, 1 Jul 2020 09:20:21 +0100 From: Andrew Burgess To: "Sharma, Alok Kumar" Cc: "gdb-patches@sourceware.org" , "George, Jini Susan" , "Achra, Nitika" Subject: Re: [PATCH] Allow reference form for DW_AT_associated and DW_AT_allocated attributes Message-ID: <20200701082021.GQ2737@embecosm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux/5.6.15-200.fc31.x86_64 (x86_64) X-Uptime: 09:14:37 up 22 days, 22:21, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 08:20:31 -0000 * Sharma, Alok Kumar [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 > 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 > + > + * dwarf2/read.c (set_die_type): Allow reference form for > + DW_AT_associated and DW_AT_allocated attributes. > + > 2020-06-30 Tom Tromey > > * 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