From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by sourceware.org (Postfix) with ESMTPS id 57F7A3857007 for ; Wed, 1 Jul 2020 11:15:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57F7A3857007 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-wm1-x344.google.com with SMTP id 17so22778743wmo.1 for ; Wed, 01 Jul 2020 04:15:38 -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=woFbXyyOAxaOiXwdbHL58eoBKvgBtxXYnuzwZWZlxvI=; b=WHMuEASs4gKUViEObVHAWY3FUmENkdLreQybs/viceJdU6rU3fIRW44qRh1OIwNv6l /4XhKh8yLaTKwy5PiwyjqMIG2bOvnP7gMelAfOpvpfX7i2FXIUsXBkvsJSqFcS4baXz+ l8Swq5DKsb3xTQB1HDg0yt/Y3nUo+qcaxqfQl8Dldrc/v8ZQPs2bU4e7QE/u64cjQz49 Ny7ykwPAbSpLP5T2ESsTUPq1sYQVP866vHGliEkK6rpzzdt7ojcrVoHDJMR9Ad8frV87 99XzK+APjX64tFWzV/v4nc8NfeKrjijrhLsnB/2YXtGPCmqNrHz0Oum+iEcqQOAOrr7H SJEw== 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=woFbXyyOAxaOiXwdbHL58eoBKvgBtxXYnuzwZWZlxvI=; b=VcLJsSRZm3ZUyvpMjF2Rtm/FQMHQC1pjkHkDX8TR5LVeLVhJSuw1xocBbxEWGCaq/F TKPlOJlZ5qXJtY51rBzpt5eyCRpkhjRtBHZdPHTTuRnD32FGB8U7meZqQHjM/wh6yKBZ UIKp1jdAbWA9660p/CTLaWPN148j4kEb/AS1ZY0g0H6X1GdUZEnFr4lxTXhQWWaGjGz2 AUXOLEXzupbnWy9zNDAUf0AI3z9oHG1ODJrlq86vzkZjoOmbmWN5N8oaAU0+c+AnYVgH GR887KYNJyrkNsuF3XrPEqoO6U0gxn/sUjgUvSbP+hN4J4Uja9blzyV1hjEcL+p8q328 hvTg== X-Gm-Message-State: AOAM533KXWe6b+/hyjnLKctFH6btZd0f2WbShSdcMTzALKfDulERtKD+ /dHSUYWZ5U9gO+mIXQqqEoaA08oRe9Y= X-Google-Smtp-Source: ABdhPJz0BDc6kuJ43ZtTqITjeAs1GfIq4fyk9uQV2GSKQe8UCx8C3FzTTQZM228YcIoBrNOpBAwomQ== X-Received: by 2002:a7b:ce87:: with SMTP id q7mr27455235wmj.39.1593602137003; Wed, 01 Jul 2020 04:15:37 -0700 (PDT) Received: from localhost (host109-154-72-253.range109-154.btcentralplus.com. [109.154.72.253]) by smtp.gmail.com with ESMTPSA id c206sm7161461wmf.36.2020.07.01.04.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 04:15:36 -0700 (PDT) Date: Wed, 1 Jul 2020 12:15:35 +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: <20200701111535.GS2737@embecosm.com> References: <20200701082021.GQ2737@embecosm.com> 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: 12:14:56 up 23 days, 1: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 11:15:40 -0000 * Sharma, Alok Kumar [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 > Sent: Wednesday, July 1, 2020 1:50 PM > 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 > > [CAUTION: External Email] > > * 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 >