[08/11] Fortran dynamic arrays support: Dynamic array bounds

Jan Kratochvil jan.kratochvil@redhat.com
Fri Nov 16 03:21:00 GMT 2007


Hi,

DW_AT_lower_bound / DW_AT_upper_bound can now have the DW_FORM_block* value.

It also sets TYPE_ARRAY_UPPER_BOUND_TYPE to BOUND_CANNOT_BE_DETERMINED where
appropriate (this is a standalone feature but it is also required for the
Fortran dynamic arrays - POINTERs without passed descriptors - `vart' in the
sample `a5' code).


Regards,
Jan
-------------- next part --------------
2007-11-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2read.c (enum dwarf2_get_attr_constant_value): New.
	(dwarf2_get_attr_constant_value): Update the prototype.
	(read_array_type): Propagate TYPE_ARRAY_UPPER_BOUND_TYPE and
	TYPE_ARRAY_LOWER_BOUND_TYPE from the range type into the array type.
	(read_subrange_type): New variables BYTE_STRIDE_ATTR, BYTE_STRIDE_INT,
	BYTE_STRIDE_TYPE.  Replace the call to CREATE_RANGE_TYPE with a call to
	CREATE_RANGE_TYPE_NFIELDS.  Support DWARF2_ATTR_BLOCK for
	`DW_AT_lower_bound', `DW_AT_upper_bound' and `DW_AT_byte_stride'.
	Fill in TYPE_ARRAY_UPPER_BOUND_TYPE appropriately.
	(dwarf2_get_attr_constant_value): Change the calling convention.
	Support the `DW_FORM_block', `DW_FORM_block1', `DW_FORM_block2' and
	`DW_FORM_block4' detection.  Support the NULL ATTR entry value.
	* gdbtypes.c: Include "dwarf2expr.h".
	(create_range_type): Rename to ...
	(create_range_type_nfields): ... here and add the parameter NFIELDS.
	Move setting TYPE_LOW_BOUND_RAW, TYPE_HIGH_BOUND_RAW and
	TYPE_FLAG_UNSIGNED into ...
	(create_range_type): ... a new function.
	(create_array_type): Remove variable LOW_BOUND and HIGH_BOUND.
	No longer call GET_DISCRETE_BOUNDS, set TYPE_LENGTH only for
	non-dynamic array types.
	(type_length_get_with_address_core): Call TYPE_LOW_BOUND_WITH_ADDRESS
	and TYPE_HIGH_BOUND_WITH_ADDRESS with the variable address instead of
	former TYPE_LOW_BOUND and TYPE_HIGH_BOUND.  New support for
	TYPE_BYTE_STRIDE_WITH_ADDRESS.
	(range_type_any_field_with_address_internal)
	(range_type_byte_stride_with_address_internal): New functions.
	* gdbtypes.h (struct main_type): New field LOC.DWARF_BLOCK.
	Include the range bounds meaning for the field STATIC_KIND.
	(TYPE_LOW_BOUND): Renamed to ...
	(TYPE_LOW_BOUND_RAW): ... here.
	(TYPE_HIGH_BOUND): Renamed to ...
	(TYPE_HIGH_BOUND_RAW): ... here.
	(TYPE_BYTE_STRIDE_RAW, TYPE_LOW_BOUND_WITH_ADDRESS)
	(TYPE_HIGH_BOUND_WITH_ADDRESS, TYPE_BYTE_STRIDE_WITH_ADDRESS)
	(TYPE_LOW_BOUND, TYPE_HIGH_BOUND)
	(TYPE_ARRAY_LOWER_BOUND_VALUE_WITH_ADDRESS)
	(TYPE_ARRAY_UPPER_BOUND_VALUE_WITH_ADDRESS)
	(TYPE_ARRAY_BYTE_STRIDE_VALUE_WITH_ADDRESS, FIELD_DWARF_BLOCK)
	(TYPE_FIELD_DWARF_BLOCK): New macros.
	(TYPE_ARRAY_LOWER_BOUND_VALUE, TYPE_ARRAY_UPPER_BOUND_VALUE): Update to
	call the other provided new primitives.
	(create_range_type_nfields, range_type_any_field_with_address_internal)
	(range_type_byte_stride_with_address_internal): New prototypes.
	* Makefile.in: Update dependencies.

Index: sources/gdb/dwarf2read.c
===================================================================
--- sources.orig/gdb/dwarf2read.c	2007-11-16 02:51:03.000000000 +0100
+++ sources/gdb/dwarf2read.c	2007-11-16 02:52:14.000000000 +0100
@@ -1015,7 +1015,14 @@ static void store_in_ref_table (unsigned
 static unsigned int dwarf2_get_ref_die_offset (struct attribute *,
 					       struct dwarf2_cu *);
 
-static int dwarf2_get_attr_constant_value (struct attribute *, int);
+enum dwarf2_get_attr_constant_value
+  {
+    dwarf2_attr_unknown,
+    dwarf2_attr_const,
+    dwarf2_attr_block
+  };
+static enum dwarf2_get_attr_constant_value dwarf2_get_attr_constant_value
+  (struct attribute *attr, int *val_return);
 
 static struct die_info *follow_die_ref (struct die_info *,
 					struct attribute *,
@@ -4308,14 +4315,27 @@ read_array_type (struct die_info *die, s
 
   if (read_array_order (die, cu) == DW_ORD_col_major)
     {
-      int i = 0;
-      while (i < ndim)
-	type = create_array_type (NULL, type, range_types[i++]);
+      int i;
+      for (i = 0; i < ndim; i++)
+	{
+	  type = create_array_type (NULL, type, range_types[i]);
+	  TYPE_ARRAY_UPPER_BOUND_TYPE (type) =
+	    TYPE_ARRAY_UPPER_BOUND_TYPE (range_types[i]);
+	  TYPE_ARRAY_LOWER_BOUND_TYPE (type) =
+	    TYPE_ARRAY_LOWER_BOUND_TYPE (range_types[i]);
+	}
     }
   else
     {
-      while (ndim-- > 0)
-	type = create_array_type (NULL, type, range_types[ndim]);
+      int i;
+      for (i = ndim - 1; i >= 0; i--)
+	{
+	  type = create_array_type (NULL, type, range_types[i]);
+	  TYPE_ARRAY_UPPER_BOUND_TYPE (type) =
+	    TYPE_ARRAY_UPPER_BOUND_TYPE (range_types[i]);
+	  TYPE_ARRAY_LOWER_BOUND_TYPE (type) =
+	    TYPE_ARRAY_LOWER_BOUND_TYPE (range_types[i]);
+	}
     }
 
   /* Understand Dwarf2 support for vector types (like they occur on
@@ -5037,9 +5057,9 @@ read_subrange_type (struct die_info *die
 {
   struct type *base_type;
   struct type *range_type;
-  struct attribute *attr;
-  int low = 0;
-  int high = -1;
+  struct attribute *attr, *byte_stride_attr;
+  int low, high, byte_stride_int;
+  enum dwarf2_get_attr_constant_value byte_stride_type;
   char *name;
   
   /* If we have already decoded this die, then nothing more to do.  */
@@ -5056,42 +5076,75 @@ read_subrange_type (struct die_info *die
 			   gdbarch_addr_bit (current_gdbarch) / 8, cu);
     }
 
-  if (cu->language == language_fortran)
-    { 
-      /* FORTRAN implies a lower bound of 1, if not given.  */
-      low = 1;
-    }
+  /* DW_AT_bit_stride is unsupported as if it would be non-constant we would
+     have to wrap it by the division by 8 or provide another value type etc.  */
+  byte_stride_attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
+  byte_stride_type = dwarf2_get_attr_constant_value (byte_stride_attr,
+						     &byte_stride_int);
+
+  range_type = create_range_type_nfields
+    (NULL, base_type, byte_stride_type == dwarf2_attr_unknown ? 2 : 3);
 
-  /* FIXME: For variable sized arrays either of these could be
-     a variable rather than a constant value.  We'll allow it,
-     but we don't know how to handle it.  */
   attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
-  if (attr)
-    low = dwarf2_get_attr_constant_value (attr, 0);
+  switch (dwarf2_get_attr_constant_value (attr, &low))
+    {
+    case dwarf2_attr_unknown:
+      if (cu->language == language_fortran)
+	{
+	  /* FORTRAN implies a lower bound of 1, if not given.  */
+	  low = 1;
+	}
+      else
+        {
+	  /* According to DWARF3 we should assume the value 0 only for
+	     LANGUAGE_C and LANGUAGE_CPLUS.  */
+	  low = 0;
+	}
+      /* PASSTHRU */
+    case dwarf2_attr_const:
+      TYPE_LOW_BOUND_RAW (range_type) = low;
+      if (low >= 0)
+	TYPE_FLAGS (range_type) |= TYPE_FLAG_UNSIGNED;
+      break;
+    case dwarf2_attr_block:
+      TYPE_FIELD_STATIC_KIND (range_type, 0) = 1;
+      TYPE_FIELD_DWARF_BLOCK (range_type, 0) = DW_BLOCK (attr);
+      /* For auto-detection of possibly missing DW_AT_upper_bound.  */
+      low = 0;
+      break;
+    }
 
   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
-  if (attr)
-    {       
-      if (attr->form == DW_FORM_block1)
-        {
-          /* GCC encodes arrays with unspecified or dynamic length
-             with a DW_FORM_block1 attribute.
-             FIXME: GDB does not yet know how to handle dynamic
-             arrays properly, treat them as arrays with unspecified
-             length for now.
-
-             FIXME: jimb/2003-09-22: GDB does not really know
-             how to handle arrays of unspecified length
-             either; we just represent them as zero-length
-             arrays.  Choose an appropriate upper bound given
-             the lower bound we've computed above.  */
-          high = low - 1;
-        }
-      else
-        high = dwarf2_get_attr_constant_value (attr, 1);
+  switch (dwarf2_get_attr_constant_value (attr, &high))
+    {
+    case dwarf2_attr_unknown:
+      /* It needs to get propagated to he array type owning us.  */
+      TYPE_ARRAY_UPPER_BOUND_TYPE (range_type) = BOUND_CANNOT_BE_DETERMINED;
+      high = low - 1;
+      /* PASSTHRU */
+    case dwarf2_attr_const:
+      TYPE_HIGH_BOUND_RAW (range_type) = high;
+      break;
+    case dwarf2_attr_block:
+      TYPE_FIELD_STATIC_KIND (range_type, 1) = 1;
+      TYPE_FIELD_DWARF_BLOCK (range_type, 1) = DW_BLOCK (attr);
+      break;
     }
 
-  range_type = create_range_type (NULL, base_type, low, high);
+  switch (byte_stride_type)
+    {
+    case dwarf2_attr_unknown:
+      break;
+    case dwarf2_attr_const:
+      if (byte_stride_int == 0)
+	warning (_("Found DW_AT_byte_stride with unsupported value 0"));
+      TYPE_HIGH_BOUND_RAW (range_type) = byte_stride_int;
+      break;
+    case dwarf2_attr_block:
+      TYPE_FIELD_STATIC_KIND (range_type, 2) = 1;
+      TYPE_FIELD_DWARF_BLOCK (range_type, 2) = DW_BLOCK (byte_stride_attr);
+      break;
+    }
 
   name = dwarf2_name (die, cu);
   if (name)
@@ -9101,26 +9154,35 @@ dwarf2_get_ref_die_offset (struct attrib
   return result;
 }
 
-/* Return the constant value held by the given attribute.  Return -1
-   if the value held by the attribute is not constant.  */
+/* *VAL_RETURN is filled only for DWARF2_ATTR_CONST.  */
 
-static int
-dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
+static enum dwarf2_get_attr_constant_value
+dwarf2_get_attr_constant_value (struct attribute *attr, int *val_return)
 {
+  if (attr == NULL)
+    return dwarf2_attr_unknown;
   if (attr->form == DW_FORM_sdata)
-    return DW_SND (attr);
-  else if (attr->form == DW_FORM_udata
-           || attr->form == DW_FORM_data1
-           || attr->form == DW_FORM_data2
-           || attr->form == DW_FORM_data4
-           || attr->form == DW_FORM_data8)
-    return DW_UNSND (attr);
-  else
     {
-      complaint (&symfile_complaints, _("Attribute value is not a constant (%s)"),
-                 dwarf_form_name (attr->form));
-      return default_value;
+      *val_return = DW_SND (attr);
+      return dwarf2_attr_const;
+    }
+  if (attr->form == DW_FORM_udata
+      || attr->form == DW_FORM_data1
+      || attr->form == DW_FORM_data2
+      || attr->form == DW_FORM_data4
+      || attr->form == DW_FORM_data8)
+    {
+      *val_return = DW_UNSND (attr);
+      return dwarf2_attr_const;
     }
+  if (attr->form == DW_FORM_block
+      || attr->form == DW_FORM_block1
+      || attr->form == DW_FORM_block2
+      || attr->form == DW_FORM_block4)
+    return dwarf2_attr_block;
+  complaint (&symfile_complaints, _("Attribute value is not a constant (%s)"),
+             dwarf_form_name (attr->form));
+  return dwarf2_attr_unknown;
 }
 
 static struct die_info *
Index: sources/gdb/gdbtypes.c
===================================================================
--- sources.orig/gdb/gdbtypes.c	2007-11-16 02:48:40.000000000 +0100
+++ sources/gdb/gdbtypes.c	2007-11-16 02:52:40.000000000 +0100
@@ -38,6 +38,7 @@
 #include "cp-abi.h"
 #include "gdb_assert.h"
 #include "hashtab.h"
+#include "dwarf2expr.h"
 
 /* These variables point to the objects
    representing the predefined C data types.  */
@@ -689,9 +690,11 @@ allocate_stub_method (struct type *type)
    sure it is TYPE_CODE_UNDEF before we bash it into a range type?  */
 
 struct type *
-create_range_type (struct type *result_type, struct type *index_type,
-		   int low_bound, int high_bound)
+create_range_type_nfields (struct type *result_type, struct type *index_type,
+                           int nfields)
 {
+  int fieldno;
+
   if (result_type == NULL)
     {
       result_type = alloc_type (TYPE_OBJFILE (index_type));
@@ -702,17 +705,29 @@ create_range_type (struct type *result_t
     TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
   else
     TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
-  TYPE_NFIELDS (result_type) = 2;
+  TYPE_NFIELDS (result_type) = nfields;
   TYPE_FIELDS (result_type) = (struct field *)
-    TYPE_ALLOC (result_type, 2 * sizeof (struct field));
-  memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field));
-  TYPE_FIELD_BITPOS (result_type, 0) = low_bound;
-  TYPE_FIELD_BITPOS (result_type, 1) = high_bound;
+    TYPE_ALLOC (result_type,
+		TYPE_NFIELDS (result_type) * sizeof (struct field));
+  memset (TYPE_FIELDS (result_type), 0,
+	  TYPE_NFIELDS (result_type) * sizeof (struct field));
+
+  return (result_type);
+}
+
+struct type *
+create_range_type (struct type *result_type, struct type *index_type,
+		   int low_bound, int high_bound)
+{
+  result_type = create_range_type_nfields (result_type, index_type, 2);
+
+  TYPE_LOW_BOUND_RAW (result_type) = low_bound;
+  TYPE_HIGH_BOUND_RAW (result_type) = high_bound;
 
   if (low_bound >= 0)
     TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
 
-  return (result_type);
+  return result_type;
 }
 
 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
@@ -800,19 +815,22 @@ create_array_type (struct type *result_t
 		   struct type *element_type,
 		   struct type *range_type)
 {
-  LONGEST low_bound, high_bound;
-
   if (result_type == NULL)
     {
       result_type = alloc_type (TYPE_OBJFILE (range_type));
     }
   TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
   TYPE_TARGET_TYPE (result_type) = element_type;
-  if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
-    low_bound = high_bound = 0;
   CHECK_TYPEDEF (element_type);
-  TYPE_LENGTH (result_type) =
-    TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);
+  /* Dynamically sized arrays cannot be computed now as we may have forward
+     DWARF references here.  */
+  if (TYPE_FIELD_STATIC_KIND (range_type, 0) == 1
+      || TYPE_FIELD_STATIC_KIND (range_type, 1) == 1)
+    TYPE_LENGTH (result_type) = 0;
+  else
+    TYPE_LENGTH (result_type) = TYPE_LENGTH (element_type)
+				* (TYPE_HIGH_BOUND (range_type)
+				   - TYPE_LOW_BOUND (range_type) + 1);
   TYPE_NFIELDS (result_type) = 1;
   TYPE_FIELDS (result_type) =
     (struct field *) TYPE_ALLOC (result_type, sizeof (struct field));
@@ -845,15 +863,18 @@ type_length_get_with_address_core (struc
     return TYPE_LENGTH (type);
 
   range_type = TYPE_INDEX_TYPE (type);
-  count = 1 + TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type);
+  count = 1 + TYPE_HIGH_BOUND_WITH_ADDRESS (range_type, address)
+          - TYPE_LOW_BOUND_WITH_ADDRESS (range_type, address);
   if (count < 0)
     warning (_("Object count %d < 0"), count);
   if (count <= 0)
     return 0;
   if (full_span || count > 1)
     {
-      byte_stride = type_length_get_with_address_core
-		      (TYPE_TARGET_TYPE (type), address, 1);
+      byte_stride = TYPE_BYTE_STRIDE_WITH_ADDRESS (range_type, address);
+      if (byte_stride == 0)
+        byte_stride = type_length_get_with_address_core
+			(TYPE_TARGET_TYPE (type), address, 1);
     }
   if (full_span)
     return count * byte_stride;
@@ -870,6 +891,32 @@ type_length_get_with_address (struct typ
   return type_length_get_with_address_core (atype, address, 0);
 }
 
+CORE_ADDR range_type_any_field_with_address_internal (struct type *range_type,
+						      int fieldno,
+						      CORE_ADDR address)
+{
+  if (TYPE_FIELD_STATIC_KIND (range_type, (fieldno)) == 1)
+    return dwarf_block_exec (TYPE_FIELD_DWARF_BLOCK (range_type, fieldno),
+			     address);
+  else
+    return TYPE_FIELD_BITPOS (range_type, (fieldno));
+}
+
+CORE_ADDR range_type_byte_stride_with_address_internal (struct type *range_type,
+							CORE_ADDR address)
+{
+  if (TYPE_NFIELDS (range_type) >= 3)
+    return range_type_any_field_with_address_internal (range_type, 2, address);
+  else
+    {
+      /* The caller will need to call something like
+	 `TYPE_LENGTH_GET_WITH_ADDRESS (element_type)
+	  * (TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1)'.
+       */
+      return 0;
+    }
+}
+
 /* Create a string type using either a blank type supplied in
    RESULT_TYPE, or creating a new type.  String types are similar
    enough to array of char types that we can use create_array_type to
Index: sources/gdb/gdbtypes.h
===================================================================
--- sources.orig/gdb/gdbtypes.h	2007-11-16 02:48:40.000000000 +0100
+++ sources/gdb/gdbtypes.h	2007-11-16 02:52:14.000000000 +0100
@@ -458,6 +458,9 @@ struct main_type
 
       CORE_ADDR physaddr;
       char *physname;
+
+      /* For dynamically-sized arrays.  Passed to DWARF_BLOCK_EXEC.  */
+      struct dwarf_block *dwarf_block;
     }
     loc;
 
@@ -468,7 +471,8 @@ struct main_type
 
     /* This flag is zero for non-static fields, 1 for fields whose location
        is specified by the label loc.physname, and 2 for fields whose location
-       is specified by loc.physaddr.  */
+       is specified by loc.physaddr.
+       For range bounds 0 is for loc.bitpos and 1 is for loc.dwarf_block.  */
 
     unsigned int static_kind : 2;
 
@@ -826,8 +830,19 @@ extern CORE_ADDR type_length_get_with_ad
 #define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations
 
 #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
-#define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0)
-#define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1)
+#define TYPE_LOW_BOUND_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 0)
+#define TYPE_HIGH_BOUND_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 1)
+/* `TYPE_NFIELDS (range_type) >= 3' check is required before accessing it:  */
+#define TYPE_BYTE_STRIDE_RAW(range_type) TYPE_FIELD_BITPOS (range_type, 2)
+#define TYPE_LOW_BOUND_WITH_ADDRESS(range_type, address) \
+  ((int) range_type_any_field_with_address_internal ((range_type), 0, (address)))
+#define TYPE_HIGH_BOUND_WITH_ADDRESS(range_type, address) \
+  ((int) range_type_any_field_with_address_internal ((range_type), 1, (address)))
+#define TYPE_BYTE_STRIDE_WITH_ADDRESS(type, address) \
+  range_type_byte_stride_with_address_internal ((type), (address))
+#define TYPE_LOW_BOUND(range_type) TYPE_LOW_BOUND_WITH_ADDRESS (range_type, 0)
+#define TYPE_HIGH_BOUND(range_type) TYPE_HIGH_BOUND_WITH_ADDRESS (range_type, 0)
+/* TYPE_BYTE_STRIDE is not required for the backward compatibility.  */
 
 /* Moto-specific stuff for FORTRAN arrays */
 
@@ -836,11 +851,16 @@ extern CORE_ADDR type_length_get_with_ad
 #define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \
 	TYPE_MAIN_TYPE(thistype)->lower_bound_type
 
-#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
-   (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1))
-
+#define TYPE_ARRAY_LOWER_BOUND_VALUE_WITH_ADDRESS(arraytype, address) \
+  (TYPE_LOW_BOUND_WITH_ADDRESS(TYPE_INDEX_TYPE(arraytype), (address)))
+#define TYPE_ARRAY_UPPER_BOUND_VALUE_WITH_ADDRESS(arraytype, address) \
+  (TYPE_HIGH_BOUND_WITH_ADDRESS(TYPE_INDEX_TYPE(arraytype), (address)))
+#define TYPE_ARRAY_BYTE_STRIDE_VALUE_WITH_ADDRESS(arraytype, address) \
+  (TYPE_BYTE_STRIDE_WITH_ADDRESS(TYPE_INDEX_TYPE(arraytype), (address)))
 #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
-   (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0))
+  TYPE_ARRAY_LOWER_BOUND_VALUE_WITH_ADDRESS ((arraytype), 0)
+#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
+  TYPE_ARRAY_UPPER_BOUND_VALUE_WITH_ADDRESS ((arraytype), 0)
 
 /* C++ */
 
@@ -870,6 +890,7 @@ extern CORE_ADDR type_length_get_with_ad
 #define FIELD_TYPE(thisfld) ((thisfld).type)
 #define FIELD_NAME(thisfld) ((thisfld).name)
 #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
 #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
 #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
 #define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind)
@@ -883,6 +904,7 @@ extern CORE_ADDR type_length_get_with_ad
 #define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
 #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
 #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
+#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK(TYPE_FIELD(thistype,n))
 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
 #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
 #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
@@ -1293,12 +1315,22 @@ extern struct type *make_function_type (
 
 extern struct type *lookup_function_type (struct type *);
 
+extern struct type *create_range_type_nfields (struct type *result_type,
+					       struct type *index_type,
+					       int nfields);
+
 extern struct type *create_range_type (struct type *, struct type *, int,
 				       int);
 
 extern struct type *create_array_type (struct type *, struct type *,
 				       struct type *);
 
+extern CORE_ADDR range_type_any_field_with_address_internal
+  (struct type *range_type, int fieldno, CORE_ADDR address);
+
+extern CORE_ADDR range_type_byte_stride_with_address_internal
+  (struct type *range_type, CORE_ADDR address);
+
 extern struct type *create_string_type (struct type *, struct type *);
 
 extern struct type *create_set_type (struct type *, struct type *);
Index: sources/gdb/Makefile.in
===================================================================
--- sources.orig/gdb/Makefile.in	2007-11-16 02:48:47.000000000 +0100
+++ sources/gdb/Makefile.in	2007-11-16 02:52:14.000000000 +0100
@@ -2084,7 +2084,8 @@ gdb-events.o: gdb-events.c $(defs_h) $(g
 gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
 	$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \
 	$(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \
-	$(gdbcmd_h) $(wrapper_h) $(cp_abi_h) $(gdb_assert_h) $(hashtab_h)
+	$(gdbcmd_h) $(wrapper_h) $(cp_abi_h) $(gdb_assert_h) $(hashtab_h) \
+	$(dwarf2expr_h)
 glibc-tdep.o: glibc-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \
 	$(objfiles_h) $(glibc_tdep_h)
 gnu-nat.o: gnu-nat.c $(gdb_string_h) $(defs_h) $(inferior_h) $(symtab_h) \


More information about the Gdb-patches mailing list