116 lines
4.1 KiB
Diff
116 lines
4.1 KiB
Diff
Subject: [PATCH 03/23] vla: introduce allocated/associated flags
|
|
Message-Id: <1401861266-6240-4-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 <keven.boell@intel.com>
|
|
Sanimir Agovic <sanimir.agovic@intel.com>
|
|
|
|
* 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 <keven.boell@intel.com>
|
|
---
|
|
gdb/dwarf2read.c | 28 ++++++++++++++++++++++++++++
|
|
gdb/gdbtypes.h | 26 ++++++++++++++++++++++++++
|
|
2 files changed, 54 insertions(+)
|
|
|
|
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
|
index 7a0f7f4..ea66602 100644
|
|
--- a/gdb/dwarf2read.c
|
|
+++ b/gdb/dwarf2read.c
|
|
@@ -21514,6 +21514,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_form_is_block (attr))
|
|
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
|
index c6d14d2..52e6233 100644
|
|
--- a/gdb/gdbtypes.h
|
|
+++ b/gdb/gdbtypes.h
|
|
@@ -726,6 +726,18 @@ struct main_type
|
|
/* * Indirection to actual data. */
|
|
|
|
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
|
|
@@ -1214,6 +1226,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. */
|
|
|
|
--
|
|
1.7.9.5
|
|
|