From patchwork Wed Sep 10 09:21:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keven Boell X-Patchwork-Id: 2722 Received: (qmail 29752 invoked by alias); 10 Sep 2014 09:22:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29703 invoked by uid 89); 10 Sep 2014 09:22:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Sep 2014 09:22:13 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 10 Sep 2014 02:22:10 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 10 Sep 2014 02:22:09 -0700 Received: from ullecvh004g04.iul.intel.com (ullecvh004g04.iul.intel.com [172.28.50.14]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8A9M8Ua008333; Wed, 10 Sep 2014 10:22:08 +0100 Received: from ullecvh004g04.iul.intel.com (ullecvh004g04.iul.intel.com [127.0.0.1]) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8) with ESMTP id s8A9MCtA020688; Wed, 10 Sep 2014 11:22:12 +0200 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id s8A9MB94020687; Wed, 10 Sep 2014 11:22:11 +0200 From: Keven Boell To: gdb-patches@sourceware.org Cc: sanimir.agovic@intel.com, Keven Boell Subject: [V3 01/21] vla: introduce allocated/associated flags Date: Wed, 10 Sep 2014 11:21:49 +0200 Message-Id: <1410340929-20653-2-git-send-email-keven.boell@intel.com> In-Reply-To: <1410340929-20653-1-git-send-email-keven.boell@intel.com> References: <1410340929-20653-1-git-send-email-keven.boell@intel.com> Fortran 90 provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is to read allocated/associated DWARF tags and store them to the main_type. 2014-05-28 Keven Boell Sanimir Agovic * dwarf2read.c (set_die_type): Add reading of allocated/associated flags. * gdbtypes.h (struct main_type): Add allocated/ associated dwarf2_prop attributes. (TYPE_ALLOCATED_PROP): New macro. (TYPE_ASSOCIATED_PROP): New macro. (TYPE_NOT_ALLOCATED): New macro. (TYPE_NOT_ASSOCIATED): New macro. --- gdb/dwarf2read.c | 28 ++++++++++++++++++++++++++++ gdb/gdbtypes.h | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index be32309..03fb3e9 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -21792,6 +21792,34 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) && !HAVE_GNAT_AUX_INFO (type)) INIT_GNAT_SPECIFIC (type); + /* Read DW_AT_allocated and set in type. */ + attr = dwarf2_attr (die, DW_AT_allocated, cu); + if (attr_form_is_block (attr)) + { + struct dynamic_prop prop; + + if (attr_to_dynamic_prop (attr, die, cu, &prop)) + { + TYPE_ALLOCATED_PROP (type) + = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); + *TYPE_ALLOCATED_PROP (type) = prop; + } + } + + /* Read DW_AT_associated and set in type. */ + attr = dwarf2_attr (die, DW_AT_associated, cu); + if (attr_form_is_block (attr)) + { + struct dynamic_prop prop; + + if (attr_to_dynamic_prop (attr, die, cu, &prop)) + { + TYPE_ASSOCIATED_PROP (type) + = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); + *TYPE_ASSOCIATED_PROP (type) = prop; + } + } + /* Read DW_AT_data_location and set in type. */ attr = dwarf2_attr (die, DW_AT_data_location, cu); if (attr_to_dynamic_prop (attr, die, cu, &prop)) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index bd1a0ab..d7be018 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -729,6 +729,18 @@ struct main_type this field yields to the location of the data for an object. */ struct dynamic_prop *data_location; + + /* Structure for DW_AT_allocated. + The presence of this attribute indicates that the object of the type + can be allocated/deallocated. The value can be a dwarf expression, + reference, or a constant. */ + struct dynamic_prop *allocated; + + /* Structure for DW_AT_associated. + The presence of this attribute indicated that the object of the type + can be associated. The value can be a dwarf expression, + reference, or a constant. */ + struct dynamic_prop *associated; }; /* * A ``struct type'' describes a particular instance of a type, with @@ -1217,6 +1229,20 @@ extern void allocate_gnat_aux_type (struct type *); TYPE_DATA_LOCATION (thistype)->data.const_val #define TYPE_DATA_LOCATION_KIND(thistype) \ TYPE_DATA_LOCATION (thistype)->kind +#define TYPE_ALLOCATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->allocated +#define TYPE_ASSOCIATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->associated + +/* Allocated status of type object. If set to non-zero it means the object + is allocated. A zero value means it is not allocated. */ +#define TYPE_NOT_ALLOCATED(t) (TYPE_ALLOCATED_PROP (t) \ + && TYPE_ALLOCATED_PROP (t)->kind == PROP_CONST \ + && !TYPE_ALLOCATED_PROP (t)->data.const_val) + +/* Associated status of type object. If set to non-zero it means the object + is associated. A zero value means it is not associated. */ +#define TYPE_NOT_ASSOCIATED(t) (TYPE_ASSOCIATED_PROP (t) \ + && TYPE_ASSOCIATED_PROP (t)->kind == PROP_CONST \ + && !TYPE_ASSOCIATED_PROP (t)->data.const_val) /* Moto-specific stuff for FORTRAN arrays. */