From patchwork Wed Jan 14 13:49:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keven Boell X-Patchwork-Id: 4664 Received: (qmail 26493 invoked by alias); 14 Jan 2015 13:49:53 -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 26369 invoked by uid 89); 14 Jan 2015 13:49:51 -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, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga03.intel.com Received: from mga03.intel.com (HELO mga03.intel.com) (134.134.136.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Jan 2015 13:49:47 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 14 Jan 2015 05:46:06 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 14 Jan 2015 05:36:51 -0800 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 t0EDnhno006840; Wed, 14 Jan 2015 13:49:44 GMT 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 t0EDnrcv024051; Wed, 14 Jan 2015 14:49:53 +0100 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id t0EDnq7c024050; Wed, 14 Jan 2015 14:49:52 +0100 From: Keven Boell To: gdb-patches@sourceware.org Cc: Keven Boell Subject: [V4 01/18] vla: introduce allocated/associated flags Date: Wed, 14 Jan 2015 14:49:33 +0100 Message-Id: <1421243390-24015-2-git-send-email-keven.boell@intel.com> In-Reply-To: <1421243390-24015-1-git-send-email-keven.boell@intel.com> References: <1421243390-24015-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. 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 86c3a73..df3ada1 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -21857,6 +21857,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 7c06a4f..6a8a74d 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -720,6 +720,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 @@ -1208,6 +1220,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. */