From patchwork Fri Jul 11 09:21:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keven Boell X-Patchwork-Id: 2010 Received: (qmail 29296 invoked by alias); 11 Jul 2014 09:21:45 -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 29147 invoked by uid 89); 11 Jul 2014 09:21:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Jul 2014 09:21:42 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 11 Jul 2014 02:16:07 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 11 Jul 2014 02:21:39 -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 s6B9Lcis020709; Fri, 11 Jul 2014 10:21:38 +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 s6B9LdPH007005; Fri, 11 Jul 2014 11:21:39 +0200 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id s6B9LdkD007004; Fri, 11 Jul 2014 11:21:39 +0200 From: Keven Boell To: gdb-patches@sourceware.org Cc: keven.boell@intel.com, sanimir.agovic@intel.com Subject: [V2 03/23] vla: introduce allocated/associated flags Date: Fri, 11 Jul 2014 11:21:15 +0200 Message-Id: <1405070495-6948-4-git-send-email-keven.boell@intel.com> In-Reply-To: <1405070495-6948-1-git-send-email-keven.boell@intel.com> References: <1405070495-6948-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. Change-Id: I44a9e21986de16de061b3ea2a7689f1bfa28ed2e Signed-off-by: Keven Boell --- gdb/dwarf2read.c | 28 ++++++++++++++++++++++++++++ gdb/gdbtypes.h | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 20886b0..f612cd8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -21689,6 +21689,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 17b9fe0..bf0ae81 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -730,6 +730,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 @@ -1218,6 +1230,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. */