Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sanimir Agovic <sanimir.agovic@intel.com>
To: brobecker@adacore.com
Cc: gdb-patches@sourceware.org, tromey@redhat.com
Subject: [PATCH v6 01/15] refactoring: rename create_range_type to create_static_range_type
Date: Thu, 10 Apr 2014 12:42:00 -0000	[thread overview]
Message-ID: <1397133617-26681-2-git-send-email-sanimir.agovic@intel.com> (raw)
In-Reply-To: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com>

2013-12-19  Sanimir Agovic  <sanimir.agovic@intel.com>
            Keven Boell <keven.boell@intel.com>

	* gdbtypes.c (create_static_range_type): Renamed from create_range_type.
	* gdbtypes.h (create_static_range_type): Renamed from create_range_type.
	* ada-lang.c: All uses of create_range_type updated.
	* coffread.c: All uses of create_range_type updated.
	* dwarf2read.c: All uses of create_range_type updated.
	* f-exp.y: All uses of create_range_type updated.
	* m2-valprint.c: All uses of create_range_type updated.
	* mdebugread.c: All uses of create_range_type updated.
	* stabsread.c: All uses of create_range_type updated.
	* valops.c: All uses of create_range_type updated.
	* valprint.c: All uses of create_range_type updated.


Signed-off-by: Sanimir Agovic <sanimir.agovic@intel.com>
---
 gdb/ada-lang.c    | 31 ++++++++++++++++---------------
 gdb/coffread.c    |  6 +++---
 gdb/dwarf2read.c  |  6 +++---
 gdb/f-exp.y       |  9 ++++++---
 gdb/gdbtypes.c    |  6 +++---
 gdb/gdbtypes.h    |  4 ++--
 gdb/m2-valprint.c |  2 +-
 gdb/mdebugread.c  |  4 ++--
 gdb/stabsread.c   | 11 ++++++-----
 gdb/valops.c      | 16 ++++++++--------
 gdb/valprint.c    |  2 +-
 11 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 786ca7a..d08e116 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1875,9 +1875,9 @@ ada_type_of_array (struct value *arr, int bounds)
           struct value *high = desc_one_bound (descriptor, arity, 1);
 
           arity -= 1;
-          create_range_type (range_type, value_type (low),
-                             longest_to_int (value_as_long (low)),
-                             longest_to_int (value_as_long (high)));
+          create_static_range_type (range_type, value_type (low),
+				    longest_to_int (value_as_long (low)),
+				    longest_to_int (value_as_long (high)));
           elt_type = create_array_type (array_type, elt_type, range_type);
 
 	  if (ada_is_unconstrained_packed_array_type (value_type (arr)))
@@ -2648,9 +2648,10 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
   CORE_ADDR base = value_as_address (array_ptr)
     + ((low - ada_discrete_type_low_bound (TYPE_INDEX_TYPE (type0)))
        * TYPE_LENGTH (TYPE_TARGET_TYPE (type0)));
-  struct type *index_type =
-    create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type0)),
-                       low, high);
+  struct type *index_type
+    = create_static_range_type (NULL,
+				TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type0)),
+				low, high);
   struct type *slice_type =
     create_array_type (NULL, TYPE_TARGET_TYPE (type0), index_type);
 
@@ -2662,8 +2663,8 @@ static struct value *
 ada_value_slice (struct value *array, int low, int high)
 {
   struct type *type = ada_check_typedef (value_type (array));
-  struct type *index_type =
-    create_range_type (NULL, TYPE_INDEX_TYPE (type), low, high);
+  struct type *index_type
+    = create_static_range_type (NULL, TYPE_INDEX_TYPE (type), low, high);
   struct type *slice_type =
     create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
 
@@ -2871,9 +2872,9 @@ static struct value *
 empty_array (struct type *arr_type, int low)
 {
   struct type *arr_type0 = ada_check_typedef (arr_type);
-  struct type *index_type =
-    create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type0)),
-                       low, low - 1);
+  struct type *index_type
+    = create_static_range_type
+        (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type0)),  low, low - 1);
   struct type *elt_type = ada_array_element_type (arr_type0, 1);
 
   return allocate_value (create_array_type (NULL, elt_type, index_type));
@@ -10853,9 +10854,8 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
       if (L < INT_MIN || U > INT_MAX)
 	return raw_type;
       else
-	return create_range_type (alloc_type_copy (raw_type), raw_type,
-				  ada_discrete_type_low_bound (raw_type),
-				  ada_discrete_type_high_bound (raw_type));
+	return create_static_range_type (alloc_type_copy (raw_type), raw_type,
+					 L, U);
     }
   else
     {
@@ -10918,7 +10918,8 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
             }
         }
 
-      type = create_range_type (alloc_type_copy (raw_type), base_type, L, U);
+      type = create_static_range_type (alloc_type_copy (raw_type),
+				       base_type, L, U);
       TYPE_NAME (type) = name;
       return type;
     }
diff --git a/gdb/coffread.c b/gdb/coffread.c
index b49e30c..6a19e8b 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1841,9 +1841,9 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
 
 	  base_type = decode_type (cs, new_c_type, aux, objfile);
 	  index_type = objfile_type (objfile)->builtin_int;
-	  range_type =
-	    create_range_type ((struct type *) NULL, 
-			       index_type, 0, n - 1);
+	  range_type
+	    = create_static_range_type ((struct type *) NULL,
+					index_type, 0, n - 1);
 	  type =
 	    create_array_type ((struct type *) NULL, 
 			       base_type, range_type);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1c7dfc5..4ba25ff 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13231,7 +13231,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
   if (die->child == NULL)
     {
       index_type = objfile_type (objfile)->builtin_int;
-      range_type = create_range_type (NULL, index_type, 0, -1);
+      range_type = create_static_range_type (NULL, index_type, 0, -1);
       type = create_array_type (NULL, element_type, range_type);
       return set_die_type (die, type, cu);
     }
@@ -13935,7 +13935,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
     }
 
   index_type = objfile_type (objfile)->builtin_int;
-  range_type = create_range_type (NULL, index_type, 1, length);
+  range_type = create_static_range_type (NULL, index_type, 1, length);
   char_type = language_string_char_type (cu->language_defn, gdbarch);
   type = create_string_type (NULL, char_type, range_type);
 
@@ -14400,7 +14400,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
     high |= negative_mask;
 
-  range_type = create_range_type (NULL, orig_base_type, low, high);
+  range_type = create_static_range_type (NULL, orig_base_type, low, high);
 
   /* Mark arrays with dynamic length at least as an array of unspecified
      length.  GDB could check the boundary but before it gets implemented at
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 567cd00..af8de68 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -558,10 +558,13 @@ ptype	:	typebase
 			array_size = pop_type_int ();
 			if (array_size != -1)
 			  {
+			    struct type *index_type;
+
+			    index_type = parse_f_type->builtin_integer;
 			    range_type =
-			      create_range_type ((struct type *) NULL,
-						 parse_f_type->builtin_integer,
-						 0, array_size - 1);
+			      create_static_range_type((struct type *) NULL,
+						       index_type,
+						       0, array_size - 1);
 			    follow_type =
 			      create_array_type ((struct type *) NULL,
 						 follow_type, range_type);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2470304..807e18e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -809,8 +809,8 @@ 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,
-		   LONGEST low_bound, LONGEST high_bound)
+create_static_range_type (struct type *result_type, struct type *index_type,
+			  LONGEST low_bound, LONGEST high_bound)
 {
   if (result_type == NULL)
     result_type = alloc_type_copy (index_type);
@@ -998,7 +998,7 @@ lookup_array_range_type (struct type *element_type,
   struct gdbarch *gdbarch = get_type_arch (element_type);
   struct type *index_type = builtin_type (gdbarch)->builtin_int;
   struct type *range_type
-    = create_range_type (NULL, index_type, low_bound, high_bound);
+    = create_static_range_type (NULL, index_type, low_bound, high_bound);
 
   return create_array_type (NULL, element_type, range_type);
 }
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index c7bef5f..0396078 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1526,8 +1526,8 @@ extern struct type *lookup_function_type_with_arguments (struct type *,
 							 int,
 							 struct type **);
 
-extern struct type *create_range_type (struct type *, struct type *, LONGEST,
-				       LONGEST);
+extern struct type *create_static_range_type (struct type *, struct type *,
+					      LONGEST, LONGEST);
 
 extern struct type *create_array_type (struct type *, struct type *,
 				       struct type *);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index f8a8f75..12c38a5 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -475,7 +475,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 			address, stream, recurse, original_value, options);
 	  break;
 	}
-      /* FIXME: create_range_type does not set the unsigned bit in a
+      /* FIXME: create_static_range_type does not set the unsigned bit in a
          range type (I think it probably should copy it from the target
          type), so we won't print values which are too large to
          fit in a signed integer correctly.  */
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index bbeea12..b0ba3ee 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1869,8 +1869,8 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
       ax++;
       rf = AUX_GET_WIDTH (bigend, ax);	/* bit size of array element */
 
-      range = create_range_type ((struct type *) NULL, indx,
-				 lower, upper);
+      range = create_static_range_type ((struct type *) NULL, indx,
+					lower, upper);
 
       t = create_array_type ((struct type *) NULL, *tpp, range);
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 0046772..b8e36d4 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -863,9 +863,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
 	    /* NULL terminate the string.  */
 	    string_local[ind] = 0;
 	    range_type
-	      = create_range_type (NULL,
-				   objfile_type (objfile)->builtin_int,
-				   0, ind);
+	      = create_static_range_type (NULL,
+					  objfile_type (objfile)->builtin_int,
+					  0, ind);
 	    SYMBOL_TYPE (sym) = create_array_type (NULL,
 				  objfile_type (objfile)->builtin_char,
 				  range_type);
@@ -3615,7 +3615,7 @@ read_array_type (char **pp, struct type *type,
     }
 
   range_type =
-    create_range_type ((struct type *) NULL, index_type, lower, upper);
+    create_static_range_type ((struct type *) NULL, index_type, lower, upper);
   type = create_array_type (type, element_type, range_type);
 
   return type;
@@ -4245,7 +4245,8 @@ handle_true_range:
       index_type = objfile_type (objfile)->builtin_int;
     }
 
-  result_type = create_range_type ((struct type *) NULL, index_type, n2, n3);
+  result_type
+    = create_static_range_type ((struct type *) NULL, index_type, n2, n3);
   return (result_type);
 }
 
diff --git a/gdb/valops.c b/gdb/valops.c
index d43c758..5c7bb89 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -415,10 +415,10 @@ value_cast (struct type *type, struct value *arg2)
 		       "divide object size in cast"));
 	  /* FIXME-type-allocation: need a way to free this type when
 	     we are done with it.  */
-	  range_type = create_range_type ((struct type *) NULL,
-					  TYPE_TARGET_TYPE (range_type),
-					  low_bound,
-					  new_length + low_bound - 1);
+	  range_type = create_static_range_type ((struct type *) NULL,
+						 TYPE_TARGET_TYPE (range_type),
+						 low_bound,
+						 new_length + low_bound - 1);
 	  deprecated_set_value_type (arg2, 
 				     create_array_type ((struct type *) NULL,
 							element_type, 
@@ -3569,10 +3569,10 @@ value_slice (struct value *array, int lowbound, int length)
 
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
-  slice_range_type = create_range_type ((struct type *) NULL,
-					TYPE_TARGET_TYPE (range_type),
-					lowbound, 
-					lowbound + length - 1);
+  slice_range_type = create_static_range_type ((struct type *) NULL,
+					       TYPE_TARGET_TYPE (range_type),
+					       lowbound,
+					       lowbound + length - 1);
 
     {
       struct type *element_type = TYPE_TARGET_TYPE (array_type);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 7ebcdfd..b178109 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -597,7 +597,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_RANGE:
-      /* FIXME: create_range_type does not set the unsigned bit in a
+      /* FIXME: create_static_range_type does not set the unsigned bit in a
          range type (I think it probably should copy it from the
          target type), so we won't print values which are too large to
          fit in a signed integer correctly.  */
-- 
1.8.4.2


  reply	other threads:[~2014-04-10 12:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 12:42 [PATCH v6 00/15] Please have a final look Sanimir Agovic
2014-04-10 12:42 ` Sanimir Agovic [this message]
2014-04-10 12:43 ` [PATCH v6 02/15] vla: introduce new bound type abstraction adapt uses Sanimir Agovic
2014-04-10 12:44 ` [PATCH v6 03/15] type: add c99 variable length array support Sanimir Agovic
2014-04-10 14:21   ` Joel Brobecker
2014-04-10 12:44 ` [PATCH v6 04/15] vla: enable sizeof operator to work with variable length arrays Sanimir Agovic
2014-04-10 12:45 ` [PATCH v6 05/15] vla: enable sizeof operator for indirection Sanimir Agovic
2014-04-10 12:46 ` [PATCH v6 06/15] vla: update type from newly created value Sanimir Agovic
2014-04-10 12:47 ` [PATCH v6 07/15] vla: print "variable length" for unresolved dynamic bounds Sanimir Agovic
2014-04-10 12:48 ` [PATCH v6 08/15] vla: support for DW_AT_count Sanimir Agovic
2014-04-10 12:48 ` [PATCH v6 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence Sanimir Agovic
2014-04-10 14:22   ` Joel Brobecker
2014-04-10 12:49 ` [PATCH v6 10/15] vla: evaluate operand of sizeof if its type is a vla Sanimir Agovic
2014-04-10 14:31   ` Joel Brobecker
2014-04-10 12:49 ` [PATCH v6 11/15] test: cover subranges with present DW_AT_count attribute Sanimir Agovic
2014-04-10 12:50 ` [PATCH v6 12/15] test: multi-dimensional c99 vla Sanimir Agovic
2014-04-10 12:51 ` [PATCH v6 13/15] test: evaluate pointers to C99 vla correctly Sanimir Agovic
2014-04-10 12:52 ` [PATCH v6 14/15] test: basic c99 vla tests for C primitives Sanimir Agovic
2014-04-10 12:53 ` [PATCH v6 15/15] test: add mi vla test Sanimir Agovic
2014-04-10 14:39 ` [PATCH v6 00/15] Please have a final look Joel Brobecker
2014-04-10 14:46   ` Joel Brobecker
2014-04-22 15:33     ` Agovic, Sanimir
2014-04-22 16:58       ` Eli Zaretskii
2014-04-11 12:50   ` Agovic, Sanimir
2014-04-11 20:03     ` Keith Seitz
2014-04-11 20:27       ` Joel Brobecker
2014-04-11 20:33         ` Keith Seitz
2014-04-11 21:13           ` Joel Brobecker
2014-04-11 21:19             ` Keith Seitz
2014-04-11 22:33             ` Joel Brobecker
2014-04-14  8:34               ` Agovic, Sanimir
2014-04-14 17:13                 ` [vla v7 pushed] " Joel Brobecker
2014-04-14 17:13                   ` [PATCH 03/12] vla: enable sizeof operator for indirection Joel Brobecker
2014-04-14 17:13                   ` [PATCH 05/12] vla: print "variable length" for unresolved dynamic bounds Joel Brobecker
2014-04-14 17:13                   ` [PATCH 08/12] vla: evaluate operand of sizeof if its type is a vla Joel Brobecker
2014-04-14 17:13                   ` [PATCH 02/12] vla: enable sizeof operator to work with variable length arrays Joel Brobecker
2014-04-14 17:13                   ` [PATCH 01/12] type: add c99 variable length array support Joel Brobecker
2014-04-18 19:06                     ` Joel Brobecker
2014-04-14 17:13                   ` [PATCH 04/12] vla: update type from newly created value Joel Brobecker
2014-04-14 17:13                   ` [PATCH 07/12] vla: resolve dynamic bounds if value contents is a constant byte-sequence Joel Brobecker
2014-04-14 17:13                   ` [PATCH 06/12] vla: support for DW_AT_count Joel Brobecker
2014-04-14 17:14                   ` [PATCH 11/12] test: basic c99 vla tests for C primitives Joel Brobecker
2014-04-14 17:14                   ` [PATCH 10/12] test: evaluate pointers to C99 vla correctly Joel Brobecker
2014-04-14 17:14                   ` [PATCH 09/12] test: cover subranges with present DW_AT_count attribute Joel Brobecker
2014-04-14 17:14                   ` [PATCH 12/12] test: add mi vla test Joel Brobecker
2014-04-14 17:36                   ` [vla v7 pushed] Re: [PATCH v6 00/15] Please have a final look Agovic, Sanimir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397133617-26681-2-git-send-email-sanimir.agovic@intel.com \
    --to=sanimir.agovic@intel.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox