aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorKeven Boell <keven.boell@linux.intel.com>2015-03-20 17:45:20 -0400
committerJoel Brobecker <brobecker@adacore.com>2015-03-20 17:52:03 -0400
commitd9823cbb391e015f79687f4d17d7f9a32d27b5eb (patch)
treeb54acb333256046c9cf62f69b5c74db80b8bd081 /gdb/gdbtypes.h
parent2e7bf1d7210ee79b93ba9ce4462e22e71097a102 (diff)
[gdb/DWARF] Introduce linked list for dynamic attributes
This patch introduces a linked list for dynamic attributes of a type. This is a pre-work for the Fortran dynamic array support. The Fortran dynamic array support will add more dynamic attributes to a type. As only a few types will have such dynamic attributes set, a linked list is more efficient in terms of memory consumption than adding multiple attributes to main_type. gdb/ChangeLog: * gdbtypes.c (resolve_dynamic_type_internal): Adapt data_location usage to linked list. (resolve_dynamic_type_internal): Adapt data_location to linked list. (get_dyn_prop, add_dyn_prop, copy_dynamic_prop_list): New function. (copy_type_recursive, copy_type): Add copy of linked list. * gdbtypes.h (enum dynamic_prop_node_kind): New enum. (struct dynamic_prop_list): New struct. * dwarf2read.c (set_die_type): Set data_location data.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h55
1 files changed, 49 insertions, 6 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2c5ccf4272..79d72dfeef 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -434,6 +434,26 @@ struct dynamic_prop
union dynamic_prop_data data;
};
+/* * Define a type's dynamic property node kind. */
+enum dynamic_prop_node_kind
+{
+ /* A property providing a type's data location.
+ Evaluating this field yields to the location of an object's data. */
+ DYN_ATTR_DATA_LOCATION,
+};
+
+/* * List for dynamic type attributes. */
+struct dynamic_prop_list
+{
+ /* The kind of dynamic prop in this node. */
+ enum dynamic_prop_node_kind prop_kind;
+
+ /* The dynamic property itself. */
+ struct dynamic_prop *prop;
+
+ /* A pointer to the next dynamic property. */
+ struct dynamic_prop_list *next;
+};
/* * Determine which field of the union main_type.fields[x].loc is
used. */
@@ -719,10 +739,8 @@ struct main_type
union type_specific type_specific;
- /* * Contains a location description value for the current type. Evaluating
- this field yields to the location of the data for an object. */
-
- struct dynamic_prop *data_location;
+ /* * Contains all dynamic type properties. */
+ struct dynamic_prop_list *dyn_prop_list;
};
/* * A ``struct type'' describes a particular instance of a type, with
@@ -1238,9 +1256,9 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_LOW_BOUND_KIND(range_type) \
TYPE_RANGE_DATA(range_type)->low.kind
-/* Attribute accessors for the type data location. */
+/* Property accessors for the type data location. */
#define TYPE_DATA_LOCATION(thistype) \
- TYPE_MAIN_TYPE(thistype)->data_location
+ get_dyn_prop (DYN_ATTR_DATA_LOCATION, thistype)
#define TYPE_DATA_LOCATION_BATON(thistype) \
TYPE_DATA_LOCATION (thistype)->data.baton
#define TYPE_DATA_LOCATION_ADDR(thistype) \
@@ -1248,6 +1266,17 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_DATA_LOCATION_KIND(thistype) \
TYPE_DATA_LOCATION (thistype)->kind
+/* Attribute accessors for dynamic properties. */
+#define TYPE_DYN_PROP_LIST(thistype) \
+ TYPE_MAIN_TYPE(thistype)->dyn_prop_list
+#define TYPE_DYN_PROP_BATON(dynprop) \
+ dynprop->data.baton
+#define TYPE_DYN_PROP_ADDR(dynprop) \
+ dynprop->data.const_val
+#define TYPE_DYN_PROP_KIND(dynprop) \
+ dynprop->kind
+
+
/* Moto-specific stuff for FORTRAN arrays. */
#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
@@ -1767,6 +1796,20 @@ extern struct type *resolve_dynamic_type (struct type *type, CORE_ADDR addr);
/* * Predicate if the type has dynamic values, which are not resolved yet. */
extern int is_dynamic_type (struct type *type);
+/* * Return the dynamic property of the requested KIND from TYPE's
+ list of dynamic properties. */
+extern struct dynamic_prop *get_dyn_prop
+ (enum dynamic_prop_node_kind kind, const struct type *type);
+
+/* * Given a dynamic property PROP of a given KIND, add this dynamic
+ property to the given TYPE.
+
+ This function assumes that TYPE is objfile-owned, and that OBJFILE
+ is the TYPE's objfile. */
+extern void add_dyn_prop
+ (enum dynamic_prop_node_kind kind, struct dynamic_prop prop,
+ struct type *type, struct objfile *objfile);
+
extern struct type *check_typedef (struct type *);
#define CHECK_TYPEDEF(TYPE) \