2004-11-10 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / valops.c
index 575c9a335ea362ec976ef75c14fbe717d4408e8a..3e40a6d4c2fd5852b06a9b57f5d9248cdad6711b 100644 (file)
@@ -212,7 +212,7 @@ value_cast (struct type *type, struct value *arg2)
 
   CHECK_TYPEDEF (type);
   code1 = TYPE_CODE (type);
-  COERCE_REF (arg2);
+  arg2 = coerce_ref (arg2);
   type2 = check_typedef (VALUE_TYPE (arg2));
 
   /* A cast to an undetermined-length array_type, such as (TYPE [])OBJECT,
@@ -253,7 +253,6 @@ value_cast (struct type *type, struct value *arg2)
     arg2 = value_coerce_function (arg2);
 
   type2 = check_typedef (VALUE_TYPE (arg2));
-  COERCE_VARYING_ARRAY (arg2, type2);
   code2 = TYPE_CODE (type2);
 
   if (code1 == TYPE_CODE_COMPLEX)
@@ -411,10 +410,7 @@ value_cast (struct type *type, struct value *arg2)
       return arg2;
     }
   else if (VALUE_LVAL (arg2) == lval_memory)
-    {
-      return value_at_lazy (type, VALUE_ADDRESS (arg2) + VALUE_OFFSET (arg2),
-                           VALUE_BFD_SECTION (arg2));
-    }
+    return value_at_lazy (type, VALUE_ADDRESS (arg2) + VALUE_OFFSET (arg2));
   else if (code1 == TYPE_CODE_VOID)
     {
       return value_zero (builtin_type_void, not_lval);
@@ -452,7 +448,7 @@ value_zero (struct type *type, enum lval_type lv)
    adjustments before or after calling it. */
 
 struct value *
-value_at (struct type *type, CORE_ADDR addr, asection *sect)
+value_at (struct type *type, CORE_ADDR addr)
 {
   struct value *val;
 
@@ -465,7 +461,6 @@ value_at (struct type *type, CORE_ADDR addr, asection *sect)
 
   VALUE_LVAL (val) = lval_memory;
   VALUE_ADDRESS (val) = addr;
-  VALUE_BFD_SECTION (val) = sect;
 
   return val;
 }
@@ -473,7 +468,7 @@ value_at (struct type *type, CORE_ADDR addr, asection *sect)
 /* Return a lazy value with type TYPE located at ADDR (cf. value_at).  */
 
 struct value *
-value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
+value_at_lazy (struct type *type, CORE_ADDR addr)
 {
   struct value *val;
 
@@ -485,7 +480,6 @@ value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
   VALUE_LVAL (val) = lval_memory;
   VALUE_ADDRESS (val) = addr;
   VALUE_LAZY (val) = 1;
-  VALUE_BFD_SECTION (val) = sect;
 
   return val;
 }
@@ -530,13 +524,13 @@ value_assign (struct value *toval, struct value *fromval)
   if (!toval->modifiable)
     error ("Left operand of assignment is not a modifiable lvalue.");
 
-  COERCE_REF (toval);
+  toval = coerce_ref (toval);
 
   type = VALUE_TYPE (toval);
   if (VALUE_LVAL (toval) != lval_internalvar)
     fromval = value_cast (type, fromval);
   else
-    COERCE_ARRAY (fromval);
+    fromval = coerce_array (fromval);
   CHECK_TYPEDEF (type);
 
   /* Since modifying a register can trash the frame chain, and modifying memory
@@ -854,7 +848,6 @@ value_coerce_function (struct value *arg1)
 
   retval = value_from_pointer (lookup_pointer_type (VALUE_TYPE (arg1)),
                               (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
-  VALUE_BFD_SECTION (retval) = VALUE_BFD_SECTION (arg1);
   return retval;
 }
 
@@ -892,7 +885,6 @@ value_addr (struct value *arg1)
   arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (VALUE_ENCLOSING_TYPE (arg1)));
   /* ... and also the relative position of the subobject in the full object */
   VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
-  VALUE_BFD_SECTION (arg2) = VALUE_BFD_SECTION (arg1);
   return arg2;
 }
 
@@ -904,7 +896,7 @@ value_ind (struct value *arg1)
   struct type *base_type;
   struct value *arg2;
 
-  COERCE_ARRAY (arg1);
+  arg1 = coerce_array (arg1);
 
   base_type = check_typedef (VALUE_TYPE (arg1));
 
@@ -917,8 +909,7 @@ value_ind (struct value *arg1)
      BUILTIN_TYPE_LONGEST would seem to be a mistake.  */
   if (TYPE_CODE (base_type) == TYPE_CODE_INT)
     return value_at_lazy (builtin_type_int,
-                         (CORE_ADDR) value_as_long (arg1),
-                         VALUE_BFD_SECTION (arg1));
+                         (CORE_ADDR) value_as_long (arg1));
   else if (TYPE_CODE (base_type) == TYPE_CODE_PTR)
     {
       struct type *enc_type;
@@ -927,9 +918,8 @@ value_ind (struct value *arg1)
       enc_type = check_typedef (VALUE_ENCLOSING_TYPE (arg1));
       enc_type = TYPE_TARGET_TYPE (enc_type);
       /* Retrieve the enclosing object pointed to */
-      arg2 = value_at_lazy (enc_type,
-                  value_as_address (arg1) - VALUE_POINTED_TO_OFFSET (arg1),
-                           VALUE_BFD_SECTION (arg1));
+      arg2 = value_at_lazy (enc_type, (value_as_address (arg1)
+                                      - VALUE_POINTED_TO_OFFSET (arg1)));
       /* Re-adjust type */
       VALUE_TYPE (arg2) = TYPE_TARGET_TYPE (base_type);
       /* Add embedding info */
@@ -1045,7 +1035,6 @@ value_array (int lowbound, int highbound, struct value **elemvec)
                  VALUE_CONTENTS_ALL (elemvec[idx]),
                  typelength);
        }
-      VALUE_BFD_SECTION (val) = VALUE_BFD_SECTION (elemvec[0]);
       return val;
     }
 
@@ -1063,7 +1052,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
 
   /* Create the array type and set up an array value to be evaluated lazily. */
 
-  val = value_at_lazy (arraytype, addr, VALUE_BFD_SECTION (elemvec[0]));
+  val = value_at_lazy (arraytype, addr);
   return (val);
 }
 
@@ -1101,7 +1090,7 @@ value_string (char *ptr, int len)
   addr = allocate_space_in_inferior (len);
   write_memory (addr, ptr, len);
 
-  val = value_at_lazy (stringtype, addr, NULL);
+  val = value_at_lazy (stringtype, addr);
   return (val);
 }
 
@@ -1435,7 +1424,7 @@ find_rt_vbase_offset (struct type *type, struct type *basetype, char *valaddr,
      & use long type */
 
   /* epstein : FIXME -- added param for overlay section. May not be correct */
-  vp = value_at (builtin_type_int, vtbl + 4 * (-skip - index - HP_ACC_VBASE_START), NULL);
+  vp = value_at (builtin_type_int, vtbl + 4 * (-skip - index - HP_ACC_VBASE_START));
   boffset = value_as_long (vp);
   *skip_p = -1;
   *boffset_p = boffset;
@@ -1600,7 +1589,7 @@ value_struct_elt (struct value **argp, struct value **args,
   struct type *t;
   struct value *v;
 
-  COERCE_ARRAY (*argp);
+  *argp = coerce_array (*argp);
 
   t = check_typedef (VALUE_TYPE (*argp));
 
@@ -1611,7 +1600,7 @@ value_struct_elt (struct value **argp, struct value **args,
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
       if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC)
-       COERCE_ARRAY (*argp);
+       *argp = coerce_array (*argp);
       t = check_typedef (VALUE_TYPE (*argp));
     }
 
@@ -1810,7 +1799,7 @@ value_find_oload_method_list (struct value **argp, char *method, int offset,
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
       if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC)
-       COERCE_ARRAY (*argp);
+       *argp = coerce_array (*argp);
       t = check_typedef (VALUE_TYPE (*argp));
     }
 
@@ -2331,7 +2320,7 @@ check_field (struct value *arg1, const char *name)
 {
   struct type *t;
 
-  COERCE_ARRAY (arg1);
+  arg1 = coerce_array (arg1);
 
   t = VALUE_TYPE (arg1);
 
@@ -2642,8 +2631,7 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
      adjusting for the embedded offset of argp if that's what value_rtti_type
      used for its computation. */
   new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
-                          (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)),
-                          VALUE_BFD_SECTION (argp));
+                          (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
   VALUE_TYPE (new_val) = VALUE_TYPE (argp);
   VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
   return new_val;
@@ -2731,7 +2719,6 @@ value_slice (struct value *array, int lowbound, int length)
   struct value *slice;
   struct type *array_type;
   array_type = check_typedef (VALUE_TYPE (array));
-  COERCE_VARYING_ARRAY (array, array_type);
   if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
       && TYPE_CODE (array_type) != TYPE_CODE_STRING
       && TYPE_CODE (array_type) != TYPE_CODE_BITSTRING)
This page took 0.025755 seconds and 4 git commands to generate.