* ada-lang.c (assign_component): Use platform-specific integer type
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 2 Jul 2009 12:20:18 +0000 (12:20 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Thu, 2 Jul 2009 12:20:18 +0000 (12:20 +0000)
instead of builtin_type_int32 type.
(ada_evaluate_subexp) [OP_ATR_SIZE]: Likewise.

* ax-gdb.c (gen_expr) [UNOP_NEG]: Use platform-specific integer type
instead of builtin_type_int8 type.
* valarith.c (value_x_unop): Likewise.
* python/python-value.c (valpy_absolute): Avoid reference to
builtin_type_int8 type.

* eval.c (evaluate_subexp_standard): Use platform-specific integer
type instead of builtin_type_int8 as EVAL_SKIP return value type.
* ada-lang.c (ada_evaluate_subexp): Likewise.
* jv-lang.c (evaluate_subexp_java): Likewise.
* m2-lang.c (evaluate_subexp_modula2): Likewise.
* scm-lang.c (evaluate_exp): Likewise.

* value.h (value_bitstring): Add INDEX_TYPE argument.
* valops.c (value_bitstring): Add INDEX_TYPE argument, use it instead
of builtin_type_int32 as base range type.
* eval.c (evaluate_subexp_standard): Update value_bitstring call.

gdb/ChangeLog
gdb/ada-lang.c
gdb/ax-gdb.c
gdb/eval.c
gdb/jv-lang.c
gdb/m2-lang.c
gdb/python/python-value.c
gdb/scm-lang.c
gdb/valarith.c
gdb/valops.c
gdb/value.h

index bd617d5128aa6f13ba3aa2f1cfbb995765f113dc..f7daf3afb198dc4d8107eaaa810d6ba076d4f41a 100644 (file)
@@ -1,3 +1,27 @@
+2009-07-02  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * ada-lang.c (assign_component): Use platform-specific integer type
+       instead of builtin_type_int32 type.
+       (ada_evaluate_subexp) [OP_ATR_SIZE]: Likewise.
+
+       * ax-gdb.c (gen_expr) [UNOP_NEG]: Use platform-specific integer type
+       instead of builtin_type_int8 type.
+       * valarith.c (value_x_unop): Likewise.
+       * python/python-value.c (valpy_absolute): Avoid reference to
+       builtin_type_int8 type.
+
+       * eval.c (evaluate_subexp_standard): Use platform-specific integer
+       type instead of builtin_type_int8 as EVAL_SKIP return value type.
+       * ada-lang.c (ada_evaluate_subexp): Likewise.
+       * jv-lang.c (evaluate_subexp_java): Likewise.
+       * m2-lang.c (evaluate_subexp_modula2): Likewise.
+       * scm-lang.c (evaluate_exp): Likewise.
+
+       * value.h (value_bitstring): Add INDEX_TYPE argument.
+       * valops.c (value_bitstring): Add INDEX_TYPE argument, use it instead
+       of builtin_type_int32 as base range type.
+       * eval.c (evaluate_subexp_standard): Update value_bitstring call.
+
 2009-07-02  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gdbtypes.c (lookup_array_range_type): Add prototype.
index 520b40136302a38df5c36cb71153276216b1949f..7bda72cff2eee2e2554951a88b9b0b1063ad7104 100644 (file)
@@ -7990,7 +7990,8 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
   struct value *elt;
   if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY)
     {
-      struct value *index_val = value_from_longest (builtin_type_int32, index);
+      struct type *index_type = builtin_type (exp->gdbarch)->builtin_int;
+      struct value *index_val = value_from_longest (index_type, index);
       elt = unwrap_value (ada_value_subscript (lhs, 1, &index_val));
     }
   else
@@ -9235,9 +9236,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (builtin_type_int32, not_lval);
+        return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
       else
-        return value_from_longest (builtin_type_int32,
+        return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
                                    TARGET_CHAR_BIT * TYPE_LENGTH (type));
 
     case OP_ATR_VAL:
@@ -9422,7 +9423,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
     }
 
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
 }
 \f
 
index 80f6cbfde74ab96622517e98912891b55eed6cf2..4edf8f25b179342de0de91c4219c2aa54b9a69dd 100644 (file)
@@ -1642,7 +1642,8 @@ gen_expr (struct expression *exp, union exp_element **pc,
     case UNOP_NEG:
       (*pc)++;
       /* -FOO is equivalent to 0 - FOO.  */
-      gen_int_literal (ax, &value1, (LONGEST) 0, builtin_type_int8);
+      gen_int_literal (ax, &value1, 0,
+                      builtin_type (exp->gdbarch)->builtin_int);
       gen_usual_unary (exp, ax, &value1);      /* shouldn't do much */
       gen_expr (exp, pc, ax, &value2);
       gen_usual_unary (exp, ax, &value2);
index 4a35c93253a332527b87f8b4629c7d03a5b9b011..531ad76fdc332aef720adbdc3dd861bfdcd98aed 100644 (file)
@@ -805,7 +805,8 @@ evaluate_subexp_standard (struct type *expect_type,
        += 3 + BYTES_TO_EXP_ELEM ((tem + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
       if (noside == EVAL_SKIP)
        goto nosideret;
-      return value_bitstring (&exp->elts[pc + 2].string, tem);
+      return value_bitstring (&exp->elts[pc + 2].string, tem,
+                             builtin_type (exp->gdbarch)->builtin_int);
       break;
 
     case OP_ARRAY:
@@ -2515,7 +2516,7 @@ GDB does not (yet) know how to evaluate that kind of expression"));
     }
 
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
 }
 \f
 /* Evaluate a subexpression of EXP, at index *POS,
index e522a462312e76f016bbf6e03df40f6c78397b0c..9d2484503b4d198c7873f4663e4d999cb940691f 100644 (file)
@@ -967,7 +967,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
 standard:
   return evaluate_subexp_standard (expect_type, exp, pos, noside);
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
 }
 
 static char *java_demangle (const char *mangled, int options)
index 85fa1237d6fde6aacf1aefcc8b0fb2fa427229ee..90c3b2f8081e7901dff36e8ffe90da56d8eb9a78 100644 (file)
@@ -275,7 +275,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
     }
 
  nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
 }
 \f
 
index ab8984259bbbbe17f8d1b84246d7be58fb63c509..ebc15dca8e1f5c8e80a415ce2a6b5f0ad41c0175 100644 (file)
@@ -551,8 +551,8 @@ valpy_positive (PyObject *self)
 static PyObject *
 valpy_absolute (PyObject *self)
 {
-  if (value_less (((value_object *) self)->value,
-                 value_from_longest (builtin_type_int8, 0)))
+  struct value *value = ((value_object *) self)->value;
+  if (value_less (value, value_zero (value_type (value), not_lval)))
     return valpy_negative (self);
   else
     return valpy_positive (self);
index b1d7865cea78afe04dbccce609b0211364119e02..66f293bd152199ccf5a4d17689f5f7db486fe087 100644 (file)
@@ -222,7 +222,7 @@ evaluate_exp (struct type *expect_type, struct expression *exp,
     }
   return evaluate_subexp_standard (expect_type, exp, pos, noside);
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
 }
 
 const struct exp_descriptor exp_descriptor_scm = 
index f2b7ef768077579dd930bc0113b27cb900baeac4..0ee25d2b4807a00284ef6cd96af51a8b091c7fc9 100644 (file)
@@ -471,6 +471,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
 struct value *
 value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   struct value **argvec;
   char *ptr, *mangle_ptr;
   char tstr[13], mangle_tstr[13];
@@ -505,13 +506,13 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
       break;
     case UNOP_POSTINCREMENT:
       strcpy (ptr, "++");
-      argvec[2] = value_from_longest (builtin_type_int8, 0);
+      argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
       argvec[3] = 0;
       nargs ++;
       break;
     case UNOP_POSTDECREMENT:
       strcpy (ptr, "--");
-      argvec[2] = value_from_longest (builtin_type_int8, 0);
+      argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
       argvec[3] = 0;
       nargs ++;
       break;
index 52debbec9af76b5dea40438b2f6855a3fe196e38..1f71a143c517288440e9ea9bdac26be84179aa12 100644 (file)
@@ -1378,14 +1378,12 @@ value_string (char *ptr, int len, struct type *char_type)
 }
 
 struct value *
-value_bitstring (char *ptr, int len)
+value_bitstring (char *ptr, int len, struct type *index_type)
 {
   struct value *val;
-  struct type *domain_type = create_range_type (NULL, 
-                                               builtin_type_int32,
-                                               0, len - 1);
-  struct type *type = create_set_type ((struct type *) NULL, 
-                                      domain_type);
+  struct type *domain_type
+    = create_range_type (NULL, index_type, 0, len - 1);
+  struct type *type = create_set_type (NULL, domain_type);
   TYPE_CODE (type) = TYPE_CODE_BITSTRING;
   val = allocate_value (type);
   memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type));
index e3574c1db38d8ca667e0e7f298d1a70ef2534cc8..6258d9fbb0922865a35c51bc883949cf99ff49ee 100644 (file)
@@ -384,7 +384,8 @@ extern struct value *value_cstring (char *ptr, int len,
                                    struct type *char_type);
 extern struct value *value_string (char *ptr, int len,
                                   struct type *char_type);
-extern struct value *value_bitstring (char *ptr, int len);
+extern struct value *value_bitstring (char *ptr, int len,
+                                     struct type *index_type);
 
 extern struct value *value_array (int lowbound, int highbound,
                                  struct value **elemvec);
This page took 0.04284 seconds and 4 git commands to generate.