2005-02-07 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Mon, 7 Feb 2005 23:51:03 +0000 (23:51 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 7 Feb 2005 23:51:03 +0000 (23:51 +0000)
* value.h (deprecated_set_value_type): Declare.
* value.c (deprecated_set_value_type): Define.
* hpacc-abi.c, gnu-v2-abi.c, cp-valprint.c: Update.
* c-valprint.c, jv-lang.c, objc-lang.c, ada-lang.c: Update.
* infcall.c, printcmd.c, valops.c, eval.c, p-exp.y: Update.
* ax-gdb.c, tracepoint.c: Update.

17 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ax-gdb.c
gdb/c-valprint.c
gdb/cp-valprint.c
gdb/eval.c
gdb/gnu-v2-abi.c
gdb/hpacc-abi.c
gdb/infcall.c
gdb/jv-lang.c
gdb/objc-lang.c
gdb/p-exp.y
gdb/printcmd.c
gdb/tracepoint.c
gdb/valops.c
gdb/value.c
gdb/value.h

index 7d35eb81faf28a6452c97e835ef0fb9993f9629d..fca3e11ec1c91b5169729d719f3d7b9fffd6e9fb 100644 (file)
@@ -1,5 +1,12 @@
 2005-02-07  Andrew Cagney  <cagney@gnu.org>
 
+       * value.h (deprecated_set_value_type): Declare.
+       * value.c (deprecated_set_value_type): Define.
+       * hpacc-abi.c, gnu-v2-abi.c, cp-valprint.c: Update.
+       * c-valprint.c, jv-lang.c, objc-lang.c, ada-lang.c: Update.
+       * infcall.c, printcmd.c, valops.c, eval.c, p-exp.y: Update.
+       * ax-gdb.c, tracepoint.c: Update.
+
        * value.h (deprecated_value_lval_hack)
        (deprecated_value_address_hack) 
        (deprecated_value_internalvar_hack) 
index 222ead4283bcd4a67ca290b9b1ce9c5d4c7b4f66..35265057ee16f40cb88f81faee4357107fcd71cc 100644 (file)
@@ -1547,7 +1547,7 @@ ada_coerce_to_simple_array_type (struct type *type)
   struct value *mark = value_mark ();
   struct value *dummy = value_from_longest (builtin_type_long, 0);
   struct type *result;
-  dummy->type = type;
+  deprecated_set_value_type (dummy, type);
   result = ada_type_of_array (dummy, 0);
   value_free_to_mark (mark);
   return result;
@@ -2041,7 +2041,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
       val = value_copy (toval);
       memcpy (value_contents_raw (val), value_contents (fromval),
               TYPE_LENGTH (type));
-      val->type = type;
+      deprecated_set_value_type (val, type);
 
       return val;
     }
@@ -7047,7 +7047,7 @@ coerce_for_assign (struct type *type, struct value *val)
           || TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
           != TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
         error (_("Incompatible types in assignment"));
-      val->type = type;
+      deprecated_set_value_type (val, type);
     }
   return val;
 }
index eb971ae07bd2982e4d336185fece369dce14bae5..98d9ef59d5154a8b63ee5978d6c3a318f61b5be7 100644 (file)
@@ -1424,7 +1424,7 @@ gen_repeat (union exp_element **pc, struct agent_expr *ax,
 
     if (!v)
       error (_("Right operand of `@' must be a constant, in agent expressions."));
-    if (TYPE_CODE (v->type) != TYPE_CODE_INT)
+    if (TYPE_CODE (value_type (v)) != TYPE_CODE_INT)
       error (_("Right operand of `@' must be an integer."));
     length = value_as_long (v);
     if (length <= 0)
index a18ef0ff685af564464d32fcd1ad9b441b0ebb73..948f5d87dd4b3ed0cb23b6ce2aa8a52bf197e608 100644 (file)
@@ -531,7 +531,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
               */
              struct value *temparg;
              temparg=value_copy(val);
-             temparg->type = lookup_pointer_type (TYPE_TARGET_TYPE(type));
+             deprecated_set_value_type (temparg, lookup_pointer_type (TYPE_TARGET_TYPE(type)));
              val=temparg;
            }
          /* Pointer to class, check real type of object */
index 42a07fc4dbbc49288b731f77729cb7b92ae89d14..2cff8e7df5ac3f703c445d881275aab65d7f3cfb 100644 (file)
@@ -786,7 +786,8 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
          /* adjust by offset */
          vf->aligner.contents[0] += 4 * (HP_ACC_VFUNC_START + vx);
          vf = value_ind (vf);  /* get the entry */
-         vf->type = value_type (v);    /* make it a pointer */
+         /* make it a pointer */
+         deprecated_set_value_type (vf, value_type (v));
 
          /* print out the entry */
          val_print (value_type (vf), value_contents (vf), 0, 0,
index 79a8ffd329ec4533ae63d1f56cb7c82f023aa7af..4f1f25a6374cfd0f064524d8c3fdd51fbf3bbd3b 100644 (file)
@@ -945,8 +945,8 @@ evaluate_subexp_standard (struct type *expect_type,
        if (gnu_runtime && (method != NULL))
          {
            /* Function objc_msg_lookup returns a pointer.  */
-           argvec[0]->type
-             = lookup_function_type (lookup_pointer_type (value_type (argvec[0])));
+           deprecated_set_value_type (argvec[0],
+                                      lookup_function_type (lookup_pointer_type (value_type (argvec[0]))));
            argvec[0] = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
          }
 
@@ -1030,7 +1030,7 @@ evaluate_subexp_standard (struct type *expect_type,
            }
          else
            {
-             arg1->type = lookup_pointer_type (TYPE_TARGET_TYPE (value_type (arg1)));
+             deprecated_set_value_type (arg1, lookup_pointer_type (TYPE_TARGET_TYPE (value_type (arg1))));
            }
        got_it:
 
@@ -1688,7 +1688,7 @@ evaluate_subexp_standard (struct type *expect_type,
           type, this will ensure that value_subscript()
           returns the correct type value */
 
-       arg1->type = tmp_type;
+       deprecated_set_value_type (arg1, tmp_type);
        return value_ind (value_add (value_coerce_array (arg1), arg2));
       }
 
index c5557860f024486c0e2e60272067e530915b44c5..87f4e9c7226f018febf6ef193ae5f036bfefe2f7 100644 (file)
@@ -177,7 +177,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
   else
     error ("I'm confused:  virtual function table has bad type");
   /* Reinstantiate the function pointer with the correct type.  */
-  vfn->type = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
+  deprecated_set_value_type (vfn, lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)));
 
   *arg1p = arg1;
   return vfn;
index 9f86c1532dbd6f96358678d4909b37d7bec92e3f..a0836e0565d64565a2001017a93d9c5c62d8cda1 100644 (file)
@@ -168,7 +168,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
 
   /* Wrap this addr in a value and return pointer */
   vp = allocate_value (ftype);
-  vp->type = ftype;
+  deprecated_set_value_type (vp, ftype);
   VALUE_ADDRESS (vp) = coreptr;
 
   /* pai: (temp) do we need the value_ind stuff in value_fn_field? */
index 667a07fad0855151ed76796a438f73117120a5f6..f91777c4dae13fe1f44539bf9803f754d7b365aa 100644 (file)
@@ -96,7 +96,7 @@ value_arg_coerce (struct value *arg, struct type *param_type,
          && TYPE_CODE (arg_type) != TYPE_CODE_PTR)
        {
          arg = value_addr (arg);
-         arg->type = param_type;
+         deprecated_set_value_type (arg, param_type);
          return arg;
        }
       break;
index bc2264f10c4f584edc2bad07b30233654f54031a..230ee86140a22c215769ac6338b9547ea49b1568 100644 (file)
@@ -320,7 +320,7 @@ type_from_class (struct value *clas)
       temp = clas;
       /* Set array element type. */
       temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure");
-      temp->type = lookup_pointer_type (value_type (clas));
+      deprecated_set_value_type (temp, lookup_pointer_type (value_type (clas)));
       TYPE_TARGET_TYPE (type) = type_from_class (temp);
     }
 
@@ -890,7 +890,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
          /* Get CLASS_ELEMENT_TYPE of the array type. */
          temp = value_struct_elt (&temp, NULL, "methods",
                                   NULL, "structure");
-         temp->type = value_type (clas);
+         deprecated_set_value_type (temp, value_type (clas));
          el_type = type_from_class (temp);
          if (TYPE_CODE (el_type) == TYPE_CODE_STRUCT)
            el_type = lookup_pointer_type (el_type);
index 8ddffa819089b3293b1f877690398c70a583472e..41dd8e85cc3de867584bf3eb81391b569e394711 100644 (file)
@@ -204,7 +204,7 @@ value_nsstring (char *ptr, int len)
   else
     error ("NSString: internal error -- no way to create new NSString");
 
-  nsstringValue->type = type;
+  deprecated_set_value_type (nsstringValue, type);
   return nsstringValue;
 }
 
index a80f8e9275b0263dde58d8c1684414355284db6f..5a61276fb3baa95bf0b6c795a75849c63bb85692 100644 (file)
@@ -521,7 +521,7 @@ exp :       THIS
                          /* we need type of this */
                          this_val = value_of_this (0); 
                          if (this_val)
-                           this_type = this_val->type;
+                           this_type = value_type (this_val);
                          else
                            this_type = NULL;
                          if (this_type)
@@ -672,7 +672,7 @@ variable:   name_not_typename
                              /* we need type of this */
                              this_val = value_of_this (0); 
                              if (this_val)
-                               this_type = this_val->type;
+                               this_type = value_type (this_val);
                              else
                                this_type = NULL;
                              if (this_type)
index c735d2ca5bfa6bb28bba3b0f09131071aba8aa64..524dd39c1837d48324d7345d2df7f19a538bbb45 100644 (file)
@@ -1904,9 +1904,9 @@ printf_command (char *arg, int from_tty)
          {
            struct type *type = value_type (val_args[nargs]);
            if (TYPE_LENGTH (type) == sizeof (float))
-             val_args[nargs]->type = builtin_type_float;
+             deprecated_set_value_type (val_args[nargs], builtin_type_float);
            if (TYPE_LENGTH (type) == sizeof (double))
-             val_args[nargs]->type = builtin_type_double;
+             deprecated_set_value_type (val_args[nargs], builtin_type_double);
          }
        nargs++;
        s = s1;
index 74a0d554f76e5ca9b20e51a0a23aa915a0370efb..6de409e586f8cc474f301207aa941cc79dfcad4c 100644 (file)
@@ -296,7 +296,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
       func_string = create_array_type (func_string,
                                       builtin_type_char, func_range);
       func_val = allocate_value (func_string);
-      func_val->type = func_string;
+      deprecated_set_value_type (func_val, func_string);
       memcpy (value_contents_raw (func_val),
              DEPRECATED_SYMBOL_NAME (traceframe_fun),
              len);
@@ -318,7 +318,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
       file_string = create_array_type (file_string,
                                       builtin_type_char, file_range);
       file_val = allocate_value (file_string);
-      file_val->type = file_string;
+      deprecated_set_value_type (file_val, file_string);
       memcpy (value_contents_raw (file_val),
              traceframe_sal.symtab->filename,
              len);
index 942ef16a5f7717eb136381bc3ce6820218636803..56e464536e61d4ad902221ed1e1679a80b5dd652 100644 (file)
@@ -240,8 +240,8 @@ value_cast (struct type *type, struct value *arg2)
                                          TYPE_TARGET_TYPE (range_type),
                                          low_bound,
                                          new_length + low_bound - 1);
-         arg2->type = create_array_type ((struct type *) NULL,
-                                         element_type, range_type);
+         deprecated_set_value_type (arg2, create_array_type ((struct type *) NULL,
+                                                             element_type, range_type));
          return arg2;
        }
     }
@@ -282,7 +282,7 @@ value_cast (struct type *type, struct value *arg2)
                                         arg2, 0, type2, 1);
       if (v)
        {
-         v->type = type;
+         deprecated_set_value_type (v, type);
          return v;
        }
     }
@@ -380,7 +380,7 @@ value_cast (struct type *type, struct value *arg2)
                  if (v)
                    {
                      v = value_addr (v);
-                     v->type = type;
+                     deprecated_set_value_type (v, type);
                      return v;
                    }
                }
@@ -405,7 +405,7 @@ value_cast (struct type *type, struct value *arg2)
            }
          /* No superclass found, just fall through to change ptr type.  */
        }
-      arg2->type = type;
+      deprecated_set_value_type (arg2, type);
       arg2 = value_change_enclosing_type (arg2, type);
       set_value_pointed_to_offset (arg2, 0);   /* pai: chk_val */
       return arg2;
@@ -730,7 +730,7 @@ value_assign (struct value *toval, struct value *fromval)
   val = value_copy (toval);
   memcpy (value_contents_raw (val), value_contents (fromval),
          TYPE_LENGTH (type));
-  val->type = type;
+  deprecated_set_value_type (val, type);
   val = value_change_enclosing_type (val, value_enclosing_type (fromval));
   set_value_embedded_offset (val, value_embedded_offset (fromval));
   set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
@@ -855,7 +855,7 @@ value_addr (struct value *arg1)
          We keep the same location information, which is efficient,
          and allows &(&X) to get the location containing the reference. */
       arg2 = value_copy (arg1);
-      arg2->type = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+      deprecated_set_value_type (arg2, lookup_pointer_type (TYPE_TARGET_TYPE (type)));
       return arg2;
     }
   if (TYPE_CODE (type) == TYPE_CODE_FUNC)
@@ -911,7 +911,7 @@ value_ind (struct value *arg1)
       arg2 = value_at_lazy (enc_type, (value_as_address (arg1)
                                       - value_pointed_to_offset (arg1)));
       /* Re-adjust type */
-      arg2->type = TYPE_TARGET_TYPE (base_type);
+      deprecated_set_value_type (arg2, TYPE_TARGET_TYPE (base_type));
       /* Add embedding info */
       arg2 = value_change_enclosing_type (arg2, enc_type);
       set_value_embedded_offset (arg2, value_pointed_to_offset (arg1));
@@ -2625,7 +2625,7 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
      used for its computation. */
   new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
                           (using_enc ? 0 : value_embedded_offset (argp)));
-  new_val->type = value_type (argp);
+  deprecated_set_value_type (new_val, value_type (argp));
   set_value_embedded_offset (new_val, (using_enc
                                       ? top + value_embedded_offset (argp)
                                       : top));
index 1a8796e332cd985d8e5ceed9e4e0f71544d2d451..e338dd2d73bbcba849aa247f818566903c42c2f9 100644 (file)
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/* Hack so that value.h can detect when it's being included by
+   value.c.  */
+#define VALUE_C
+
 #include "defs.h"
 #include "gdb_string.h"
 #include "symtab.h"
@@ -128,6 +132,11 @@ value_type (struct value *value)
 {
   return value->type;
 }
+void
+deprecated_set_value_type (struct value *value, struct type *type)
+{
+  value->type = type;
+}
 
 int
 value_offset (struct value *value)
index 3905b1af07864431e85360b41801fdec7673f283..762f1f2a3b84af7fd447011b384910a3fe77d3fe 100644 (file)
@@ -80,7 +80,11 @@ struct value
   struct frame_id frame_id;
 
   /* Type of the value.  */
+#ifdef VALUE_C
   struct type *type;
+#else
+  struct type *xtype;
+#endif
 
   /* If a value represents a C++ object, then the `type' field gives
      the object's compile-time type.  If the object actually belongs
@@ -174,6 +178,11 @@ struct value
 
 
 extern struct type *value_type (struct value *);
+/* This is being used to change the type of an existing value, that
+   code should instead be creating a new value with the changed type
+   (but possibly shared content).  */
+extern void deprecated_set_value_type (struct value *value,
+                                      struct type *type);
 extern int value_bitsize (struct value *);
 extern int value_bitpos (struct value *);
 extern int value_offset (struct value *);
This page took 0.041994 seconds and 4 git commands to generate.