2005-02-06 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Mon, 7 Feb 2005 00:09:56 +0000 (00:09 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 7 Feb 2005 00:09:56 +0000 (00:09 +0000)
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.

43 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ada-valprint.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/breakpoint.c
gdb/c-valprint.c
gdb/cli/cli-dump.c
gdb/cp-valprint.c
gdb/cris-tdep.c
gdb/eval.c
gdb/f-valprint.c
gdb/frv-tdep.c
gdb/hpacc-abi.c
gdb/hppa-tdep.c
gdb/ia64-tdep.c
gdb/jv-valprint.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m88k-tdep.c
gdb/mi/mi-main.c
gdb/mips-tdep.c
gdb/p-valprint.c
gdb/ppc-sysv-tdep.c
gdb/printcmd.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/scm-exp.c
gdb/scm-valprint.c
gdb/sh-tdep.c
gdb/sh64-tdep.c
gdb/sparc-tdep.c
gdb/sparc64-tdep.c
gdb/stack.c
gdb/valarith.c
gdb/valops.c
gdb/value.c
gdb/value.h
gdb/varobj.c
gdb/xstormy16-tdep.c

index 325de50..33ac6bb 100644 (file)
@@ -1,3 +1,22 @@
+2005-02-06  Andrew Cagney  <cagney@gnu.org>
+
+       * value.c (value_contents, value_contents_writeable): New
+       functions.
+       * value.h (VALUE_CONTENTS): Delete macro.
+       (value_contents, value_contents_writeable): Declare.
+       * xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
+       * stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
+       * sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
+       * rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
+       * ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
+       * m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
+       * jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
+       * hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
+       * c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
+       * cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
+       * arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
+       * ada-valprint.c, ada-lang.c: Update.
+
 2005-02-03  Andrew Cagney  <cagney@gnu.org>
 
        * utils.c (xzalloc): New function.
index 3228fe5..799d01f 100644 (file)
@@ -455,7 +455,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
           || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
         VALUE_LAZY (result) = 1;
       else
-        memcpy (value_contents_raw (result), VALUE_CONTENTS (val),
+        memcpy (value_contents_raw (result), value_contents (val),
                 TYPE_LENGTH (type));
       return result;
     }
@@ -1821,7 +1821,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
   else
     {
       v = allocate_value (type);
-      bytes = (unsigned char *) VALUE_CONTENTS (obj) + offset;
+      bytes = (unsigned char *) value_contents (obj) + offset;
     }
 
   if (obj != NULL)
@@ -1840,7 +1840,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
     }
   else
     v->bitsize = bit_size;
-  unpacked = (unsigned char *) VALUE_CONTENTS (v);
+  unpacked = (unsigned char *) value_contents (v);
 
   srcBitsLeft = bit_size;
   nsrc = len;
@@ -1935,7 +1935,8 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
    TARGET, starting at bit offset TARG_OFFSET.  SOURCE and TARGET must
    not overlap.  */
 static void
-move_bits (char *target, int targ_offset, char *source, int src_offset, int n)
+move_bits (bfd_byte *target, int targ_offset, const bfd_byte *source,
+          int src_offset, int n)
 {
   unsigned int accum, mask;
   int accum_bits, chunk_size;
@@ -2028,17 +2029,17 @@ ada_value_assign (struct value *toval, struct value *fromval)
       read_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len);
       if (BITS_BIG_ENDIAN)
         move_bits (buffer, value_bitpos (toval),
-                   VALUE_CONTENTS (fromval),
+                   value_contents (fromval),
                    TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT -
                    bits, bits);
       else
-        move_bits (buffer, value_bitpos (toval), VALUE_CONTENTS (fromval),
+        move_bits (buffer, value_bitpos (toval), value_contents (fromval),
                    0, bits);
       write_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer,
                     len);
 
       val = value_copy (toval);
-      memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
+      memcpy (value_contents_raw (val), value_contents (fromval),
               TYPE_LENGTH (type));
       val->type = type;
 
@@ -3543,7 +3544,7 @@ convert_actual (struct value *actual, struct type *formal_type0,
               actual_type = ada_check_typedef (value_type (actual));
               val = allocate_value (actual_type);
               memcpy ((char *) value_contents_raw (val),
-                      (char *) VALUE_CONTENTS (actual),
+                      (char *) value_contents (actual),
                       TYPE_LENGTH (actual_type));
               actual = ensure_lval (val, sp);
             }
@@ -3574,11 +3575,11 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
 
   for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1)
     {
-      modify_general_field (VALUE_CONTENTS (bounds),
+      modify_general_field (value_contents_writeable (bounds),
                             value_as_long (ada_array_bound (arr, i, 0)),
                             desc_bound_bitpos (bounds_type, i, 0),
                             desc_bound_bitsize (bounds_type, i, 0));
-      modify_general_field (VALUE_CONTENTS (bounds),
+      modify_general_field (value_contents_writeable (bounds),
                             value_as_long (ada_array_bound (arr, i, 1)),
                             desc_bound_bitpos (bounds_type, i, 1),
                             desc_bound_bitsize (bounds_type, i, 1));
@@ -3586,12 +3587,12 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
 
   bounds = ensure_lval (bounds, sp);
 
-  modify_general_field (VALUE_CONTENTS (descriptor),
+  modify_general_field (value_contents_writeable (descriptor),
                         VALUE_ADDRESS (ensure_lval (arr, sp)),
                         fat_pntr_data_bitpos (desc_type),
                         fat_pntr_data_bitsize (desc_type));
 
-  modify_general_field (VALUE_CONTENTS (descriptor),
+  modify_general_field (value_contents_writeable (descriptor),
                         VALUE_ADDRESS (bounds),
                         fat_pntr_bounds_bitpos (desc_type),
                         fat_pntr_bounds_bitsize (desc_type));
@@ -5327,7 +5328,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
       int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
       int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
 
-      return ada_value_primitive_packed_val (arg1, VALUE_CONTENTS (arg1),
+      return ada_value_primitive_packed_val (arg1, value_contents (arg1),
                                              offset + bit_pos / 8,
                                              bit_pos % 8, bit_size, type);
     }
@@ -5535,7 +5536,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
       if (TYPE_CODE (t) == TYPE_CODE_PTR)
         address = value_as_address (arg);
       else
-        address = unpack_pointer (t, VALUE_CONTENTS (arg));
+        address = unpack_pointer (t, value_contents (arg));
 
       t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL);
       if (find_struct_field (name, t1, 0,
@@ -6415,7 +6416,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const bfd_byte *valaddr,
 
   which =
     ada_which_variant_applies (var_type,
-                               value_type (dval), VALUE_CONTENTS (dval));
+                               value_type (dval), value_contents (dval));
 
   if (which < 0)
     return empty_record (TYPE_OBJFILE (var_type));
@@ -7124,7 +7125,7 @@ ada_value_equal (struct value *arg1, struct value *arg2)
          and do not have user-defined equality.  */
       return
         TYPE_LENGTH (value_type (arg1)) == TYPE_LENGTH (value_type (arg2))
-        && memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2),
+        && memcmp (value_contents (arg1), value_contents (arg2),
                    TYPE_LENGTH (value_type (arg1))) == 0;
     }
   return value_equal (arg1, arg2);
index a6e30f2..52e1440 100644 (file)
@@ -189,13 +189,13 @@ val_print_packed_array_elements (struct type *type, const bfd_byte *valaddr,
                                               (i * bitsize) / HOST_CHAR_BIT,
                                               (i * bitsize) % HOST_CHAR_BIT,
                                               bitsize, elttype);
-         if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) != 0)
+         if (memcmp (value_contents (v0), value_contents (v1), eltlen) != 0)
            break;
        }
 
       if (i - i0 > repeat_count_threshold)
        {
-         val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format,
+         val_print (elttype, value_contents (v0), 0, 0, stream, format,
                     0, recurse + 1, pretty);
          annotate_elt_rep (i - i0);
          fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
@@ -220,7 +220,7 @@ val_print_packed_array_elements (struct type *type, const bfd_byte *valaddr,
                    }
                  wrap_here (n_spaces (2 + 2 * recurse));
                }
-             val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format,
+             val_print (elttype, value_contents (v0), 0, 0, stream, format,
                         0, recurse + 1, pretty);
              annotate_elt ();
            }
@@ -609,7 +609,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
          retn = 0;
        }
       else
-       retn = ada_val_print_1 (value_type (val), VALUE_CONTENTS (val), 0,
+       retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
                                VALUE_ADDRESS (val), stream, format,
                                deref_ref, recurse, pretty);
       value_free_to_mark (mark);
@@ -675,7 +675,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
                                       call_function_by_hand (func, 1,
                                                              &val)));
 
-             fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val));
+             fprintf_filtered (stream, "%s", value_contents (printable_val));
              return 0;
            }
          /* No special printing function.  Do as best we can.  */
@@ -692,7 +692,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
              struct value *v = value_cast (target_type,
                                            value_from_contents_and_address
                                            (type, valaddr, 0));
-             return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0,
+             return ada_val_print_1 (target_type, value_contents (v), 0, 0,
                                      stream, format, 0, recurse + 1, pretty);
            }
          else
@@ -856,7 +856,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
                                   (lookup_pointer_type (elttype),
                                    deref_val_int));
                  val_print (value_type (deref_val),
-                            VALUE_CONTENTS (deref_val), 0,
+                            value_contents (deref_val), 0,
                             VALUE_ADDRESS (deref_val), stream, format,
                             deref_ref, recurse + 1, pretty);
                }
@@ -896,7 +896,7 @@ int
 ada_value_print (struct value *val0, struct ui_file *stream, int format,
                 enum val_prettyprint pretty)
 {
-  char *valaddr = VALUE_CONTENTS (val0);
+  const bfd_byte *valaddr = value_contents (val0);
   CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
   struct type *type =
     ada_to_fixed_type (value_type (val0), valaddr, address, NULL);
@@ -947,7 +947,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format,
       return 0;
     }
   
-  return (val_print (type, VALUE_CONTENTS (val), 0, address,
+  return (val_print (type, value_contents (val), 0, address,
                     stream, format, 1, 0, pretty));
 }
 
@@ -1077,7 +1077,7 @@ print_field_values (struct type *type, const bfd_byte *valaddr,
                                                  bit_pos % HOST_CHAR_BIT,
                                                  bit_size,
                                                  TYPE_FIELD_TYPE (type, i));
-             val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0,
+             val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
                         stream, format, 0, recurse + 1, pretty);
            }
        }
index d75aebc..5b01051 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -333,7 +334,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              sp = (sp & -16) - 16;
 
              /* Write the real data into the stack.  */
-             write_memory (sp, VALUE_CONTENTS (arg), 16);
+             write_memory (sp, value_contents (arg), 16);
 
              /* Construct the indirection.  */
              arg_type = lookup_pointer_type (arg_type);
@@ -354,7 +355,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              sp = (sp & -16) - 16;
 
              /* Write the real data into the stack.  */
-             write_memory (sp, VALUE_CONTENTS (arg), 32);
+             write_memory (sp, value_contents (arg), 32);
 
              /* Construct the indirection.  */
              arg_type = lookup_pointer_type (arg_type);
@@ -368,7 +369,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       m_arg->len = TYPE_LENGTH (arg_type);
       m_arg->offset = accumulate_size;
       accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
-      m_arg->contents = VALUE_CONTENTS (arg);
+      m_arg->contents = value_contents_writeable (arg);
     }
 
   /* Determine required argument register loads, loading an argument register
index 0ddface..4eae88b 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for AMD64.
 
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-   Contributed by Jiri Smid, SuSE Labs.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+   Inc.  Contributed by Jiri Smid, SuSE Labs.
 
    This file is part of GDB.
 
@@ -581,7 +581,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
       else
        {
          /* The argument will be passed in registers.  */
-         char *valbuf = VALUE_CONTENTS (args[i]);
+         const bfd_byte *valbuf = value_contents (args[i]);
          char buf[8];
 
          gdb_assert (len <= 16);
@@ -630,7 +630,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
   for (i = 0; i < num_stack_args; i++)
     {
       struct type *type = value_type (stack_args[i]);
-      char *valbuf = VALUE_CONTENTS (stack_args[i]);
+      const bfd_byte *valbuf = value_contents (stack_args[i]);
       int len = TYPE_LENGTH (type);
 
       write_memory (sp + element * 8, valbuf, len);
index d486b80..3b7699d 100644 (file)
@@ -1,5 +1,7 @@
 /* GNU/Linux on ARM target support.
-   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -153,7 +155,7 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
       target_type = TYPE_TARGET_TYPE (arg_type);
       len = TYPE_LENGTH (arg_type);
       typecode = TYPE_CODE (arg_type);
-      val = (char *) VALUE_CONTENTS (args[argnum]);
+      val = (char *) value_contents (args[argnum]);
 
       /* ANSI C code passes float arguments as integers, K&R code
          passes float arguments as doubles.  The .stabs record for 
index 0da3eba..b016b70 100644 (file)
@@ -1,6 +1,7 @@
 /* Common target dependent code for GDB on ARM systems.
-   Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+   Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999,
+   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1222,13 +1223,13 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *arg_type;
       struct type *target_type;
       enum type_code typecode;
-      char *val;
+      bfd_byte *val;
 
       arg_type = check_typedef (value_type (args[argnum]));
       len = TYPE_LENGTH (arg_type);
       target_type = TYPE_TARGET_TYPE (arg_type);
       typecode = TYPE_CODE (arg_type);
-      val = VALUE_CONTENTS (args[argnum]);
+      val = value_contents_writeable (args[argnum]);
 
       /* If the argument is a pointer to a function, and it is a
         Thumb function, create a LOCAL copy of the value and set
index a89585c..6229047 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for Atmel AVR, for GDB.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1081,10 +1082,8 @@ struct stack_item
   void *data;
 };
 
-static struct stack_item *push_stack_item (struct stack_item *prev,
-                                          void *contents, int len);
 static struct stack_item *
-push_stack_item (struct stack_item *prev, void *contents, int len)
+push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
 {
   struct stack_item *si;
   si = xmalloc (sizeof (struct stack_item));
@@ -1173,7 +1172,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int j;
       struct value *arg = args[i];
       struct type *type = check_typedef (value_type (arg));
-      char *contents = VALUE_CONTENTS (arg);
+      const bfd_byte *contents = value_contents (arg);
       int len = TYPE_LENGTH (type);
 
       /* Calculate the potential last register needed. */
index bf8a29f..8c0d429 100644 (file)
@@ -931,7 +931,7 @@ insert_bp_location (struct bp_location *bpt,
             laziness to determine what memory GDB actually needed
             in order to compute the value of the expression.  */
          v = evaluate_expression (bpt->owner->exp);
-         VALUE_CONTENTS (v);
+         value_contents (v);
          value_release_to_mark (mark);
 
          bpt->owner->val_chain = v;
index 6f10619..64f0f42 100644 (file)
@@ -233,7 +233,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
                      wtype = TYPE_TARGET_TYPE (type);
                    }
                  vt_val = value_at (wtype, vt_address);
-                 val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0,
+                 val_print (value_type (vt_val), value_contents (vt_val), 0,
                             VALUE_ADDRESS (vt_val), stream, format,
                             deref_ref, recurse + 1, pretty);
                  if (pretty)
@@ -284,7 +284,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
               unpack_pointer (lookup_pointer_type (builtin_type_void),
                               valaddr + embedded_offset));
              val_print (value_type (deref_val),
-                        VALUE_CONTENTS (deref_val),
+                        value_contents (deref_val),
                         0,
                         VALUE_ADDRESS (deref_val),
                         stream,
@@ -446,7 +446,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
     case TYPE_CODE_METHOD:
       {
        struct value *v = value_at (type, address);
-       cp_print_class_method (VALUE_CONTENTS (value_addr (v)),
+       cp_print_class_method (value_contents (value_addr (v)),
                               lookup_pointer_type (type), stream);
        break;
       }
index 5622f5f..4030a85 100644 (file)
@@ -300,7 +300,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
   /* Have everything.  Open/write the data.  */
   if (file_format == NULL || strcmp (file_format, "binary") == 0)
     {
-      dump_binary_file (filename, mode, VALUE_CONTENTS (val), 
+      dump_binary_file (filename, mode, value_contents (val), 
                        TYPE_LENGTH (value_type (val)));
     }
   else
@@ -318,7 +318,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
        }
 
       dump_bfd_file (filename, mode, file_format, vaddr, 
-                    VALUE_CONTENTS (val), 
+                    value_contents (val), 
                     TYPE_LENGTH (value_type (val)));
     }
 
index 4079b8f..8624e25 100644 (file)
@@ -358,7 +358,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
                    (TYPE_FIELD_TYPE (type, i), 
                     unpack_field_as_long (type, valaddr + offset, i));
 
-                 val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v),
+                 val_print (TYPE_FIELD_TYPE (type, i), value_contents (v),
                             0, 0, stream, format, 0, recurse + 1, pretty);
                }
            }
@@ -423,7 +423,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
       v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long),
                              *(unsigned long *) (valaddr + offset));
 
-      val_print (value_type (v), VALUE_CONTENTS (v), 0, 0,
+      val_print (value_type (v), value_contents (v), 0, 0,
                 stream, format, 0, recurse + 1, pretty);
       fields_seen = 1;
 
@@ -789,7 +789,7 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
          vf->type = value_type (v);    /* make it a pointer */
 
          /* print out the entry */
-         val_print (value_type (vf), VALUE_CONTENTS (vf), 0, 0,
+         val_print (value_type (vf), value_contents (vf), 0, 0,
                     stream, format, 0, recurse + 1, pretty);
          field_physname
            = TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi);
index 84f9402..5a31b8b 100644 (file)
@@ -1,6 +1,7 @@
 /* Target dependent code for CRIS, for GDB, the GNU debugger.
 
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+   Inc.
 
    Contributed by Axis Communications AB.
    Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg.
@@ -892,7 +893,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int i;
       
       len = TYPE_LENGTH (value_type (args[argnum]));
-      val = (char *) VALUE_CONTENTS (args[argnum]);
+      val = (char *) value_contents (args[argnum]);
       
       /* How may registers worth of storage do we need for this argument?  */
       reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
index 0a727ef..0bcfdf6 100644 (file)
@@ -209,7 +209,7 @@ evaluate_struct_tuple (struct value *struct_val,
       struct value *val = NULL;
       int nlabels = 0;
       int bitpos, bitsize;
-      char *addr;
+      bfd_byte *addr;
 
       /* Skip past the labels, and count them. */
       while (get_label (exp, pos) != NULL)
@@ -315,12 +315,12 @@ evaluate_struct_tuple (struct value *struct_val,
          bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
          if (variantno >= 0)
            bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno);
-         addr = VALUE_CONTENTS (struct_val) + bitpos / 8;
+         addr = value_contents_writeable (struct_val) + bitpos / 8;
          if (bitsize)
            modify_field (addr, value_as_long (val),
                          bitpos % 8, bitsize);
          else
-           memcpy (addr, VALUE_CONTENTS (val),
+           memcpy (addr, value_contents (val),
                    TYPE_LENGTH (value_type (val)));
        }
       while (--nlabels > 0);
@@ -362,7 +362,7 @@ init_array_element (struct value *array, struct value *element,
        {
          memcpy (value_contents_raw (array)
                  + (index - low_bound) * element_size,
-                 VALUE_CONTENTS (element), element_size);
+                 value_contents (element), element_size);
        }
     }
   else
@@ -371,7 +371,7 @@ init_array_element (struct value *array, struct value *element,
       if (index < low_bound || index > high_bound)
        error ("tuple index out of range");
       memcpy (value_contents_raw (array) + (index - low_bound) * element_size,
-             VALUE_CONTENTS (element), element_size);
+             value_contents (element), element_size);
     }
   return index;
 }
@@ -546,7 +546,7 @@ evaluate_subexp_standard (struct type *expect_type,
                    error ("Too many array elements");
                  memcpy (value_contents_raw (array)
                          + (index - low_bound) * element_size,
-                         VALUE_CONTENTS (element),
+                         value_contents (element),
                          element_size);
                }
              index++;
@@ -1442,7 +1442,7 @@ evaluate_subexp_standard (struct type *expect_type,
          if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) &&
              (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_MEMBER))
            {
-             unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (arg2);       /* forces evaluation */
+             unsigned int *ptr = (unsigned int *) value_contents (arg2);       /* forces evaluation */
              *ptr |= 0x20000000;       /* set 29th bit */
            }
        }
@@ -1939,7 +1939,7 @@ evaluate_subexp_standard (struct type *expect_type,
              (TYPE_CODE (value_type (retvalp)) == TYPE_CODE_PTR) &&
              (TYPE_CODE (TYPE_TARGET_TYPE (value_type (retvalp))) == TYPE_CODE_MEMBER))
            {
-             unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (retvalp);    /* forces evaluation */
+             unsigned int *ptr = (unsigned int *) value_contents (retvalp);    /* forces evaluation */
              *ptr |= 0x20000000;       /* set 29th bit */
            }
          return retvalp;
index fcbe44b..6196628 100644 (file)
@@ -441,7 +441,7 @@ f_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
               unpack_pointer (lookup_pointer_type (builtin_type_void),
                               valaddr + embedded_offset));
              val_print (value_type (deref_val),
-                        VALUE_CONTENTS (deref_val),
+                        value_contents (deref_val),
                         0,
                         VALUE_ADDRESS (deref_val),
                         stream,
index e175700..844cccb 100644 (file)
@@ -1,5 +1,6 @@
 /* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger.
-   Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+
+   Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1180,7 +1181,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          store_unsigned_integer
            (valbuf, 4,
             find_func_descr (gdbarch,
-                             extract_unsigned_integer (VALUE_CONTENTS (arg),
+                             extract_unsigned_integer (value_contents (arg),
                                                        4)));
          typecode = TYPE_CODE_PTR;
          len = 4;
@@ -1188,7 +1189,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        }
       else
        {
-         val = (char *) VALUE_CONTENTS (arg);
+         val = (char *) value_contents (arg);
        }
 
       while (len > 0)
index 79b4c69..ff1d29d 100644 (file)
@@ -103,7 +103,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
 
   /* pai: FIXME -- 32x64 possible problem? */
   /* First word (4 bytes) in object layout is the vtable pointer */
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (argp));    /* pai: (temp)  */
+  coreptr = *(CORE_ADDR *) (value_contents (argp));    /* pai: (temp)  */
   /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
 
   if (!coreptr)
@@ -132,7 +132,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
                     coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) +
                                    HP_ACC_VFUNC_START));
 
-      coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+      coreptr = *(CORE_ADDR *) (value_contents (vp));
       /* coreptr now contains the address of the virtual function */
       /* (Actually, it contains the pointer to the plabel for the function. */
     }
@@ -153,10 +153,10 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
       /* Indirect once more, offset by function index */
       /* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */
       coreptr =
-       *(CORE_ADDR *) (VALUE_CONTENTS (vp) +
+       *(CORE_ADDR *) (value_contents (vp) +
                        4 * TYPE_FN_FIELD_VOFFSET (f, j));
       vp = value_at (builtin_type_int, coreptr);
-      coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+      coreptr = *(CORE_ADDR *) (value_contents (vp));
 
       /* coreptr now contains the address of the virtual function */
       /* (Actually, it contains the pointer to the plabel for the function.) */
@@ -241,7 +241,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
   vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET);
   /* Indirect through the typeinfo pointer and retrieve the pointer
    * to the string name */
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+  coreptr = *(CORE_ADDR *) (value_contents (vp));
   if (!coreptr)
     error ("Retrieved null typeinfo pointer in trying to determine "
            "run-time type");
@@ -249,7 +249,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
   vp = value_at (builtin_type_int, coreptr + 4);
   /* FIXME possible 32x64 problem */
 
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+  coreptr = *(CORE_ADDR *) (value_contents (vp));
 
   read_memory_string (coreptr, rtti_type_name, 256);
 
index 7b12e7d..8469bd6 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for the HP PA architecture, for GDB.
 
    Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
    Foundation, Inc.
 
    Contributed by the Center for Software Science at the
@@ -723,7 +723,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              param_len = 4;
              struct_ptr += align_up (TYPE_LENGTH (type), 8);
              if (write_pass)
-               write_memory (struct_end - struct_ptr, VALUE_CONTENTS (arg),
+               write_memory (struct_end - struct_ptr, value_contents (arg),
                              TYPE_LENGTH (type));
              store_unsigned_integer (param_val, 4, struct_end - struct_ptr);
            }
@@ -735,13 +735,13 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              param_len = align_up (TYPE_LENGTH (type), 4);
              store_unsigned_integer (param_val, param_len,
                                      unpack_long (type,
-                                                  VALUE_CONTENTS (arg)));
+                                                  value_contents (arg)));
            }
          else if (TYPE_CODE (type) == TYPE_CODE_FLT)
             {
              /* Floating point value store, right aligned.  */
              param_len = align_up (TYPE_LENGTH (type), 4);
-             memcpy (param_val, VALUE_CONTENTS (arg), param_len);
+             memcpy (param_val, value_contents (arg), param_len);
             }
          else
            {
@@ -749,7 +749,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
              /* Small struct value are stored right-aligned.  */
              memcpy (param_val + param_len - TYPE_LENGTH (type),
-                     VALUE_CONTENTS (arg), TYPE_LENGTH (type));
+                     value_contents (arg), TYPE_LENGTH (type));
 
              /* Structures of size 5, 6 and 7 bytes are special in that
                 the higher-ordered word is stored in the lower-ordered
@@ -901,7 +901,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct value *arg = args[i];
       struct type *type = value_type (arg);
       int len = TYPE_LENGTH (type);
-      char *valbuf;
+      const bfd_byte *valbuf;
       int regnum;
 
       /* "Each parameter begins on a 64-bit (8-byte) boundary."  */
@@ -960,7 +960,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                     the right halves of the floating point registers;
                     the left halves are unused."  */
                  regcache_cooked_write_part (regcache, regnum, offset % 8,
-                                             len, VALUE_CONTENTS (arg));
+                                             len, value_contents (arg));
                }
            }
        }
@@ -978,9 +978,9 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        }
 
       /* Always store the argument in memory.  */
-      write_memory (sp + offset, VALUE_CONTENTS (arg), len);
+      write_memory (sp + offset, value_contents (arg), len);
 
-      valbuf = VALUE_CONTENTS (arg);
+      valbuf = value_contents (arg);
       regnum = HPPA_ARG0_REGNUM - offset / 8;
       while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0)
        {
index 065356a..48fd0d1 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the IA-64 for GDB, the GNU debugger.
 
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -3089,7 +3089,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          char val_buf[8];
 
          store_unsigned_integer (val_buf, 8,
-                                 find_func_descr (extract_unsigned_integer (VALUE_CONTENTS (arg), 8),
+                                 find_func_descr (extract_unsigned_integer (value_contents (arg), 8),
                                                   &funcdescaddr));
          if (slotnum < rseslots)
            write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
@@ -3111,7 +3111,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          char val_buf[8];
 
          memset (val_buf, 0, 8);
-         memcpy (val_buf, VALUE_CONTENTS (arg) + argoffset, (len > 8) ? 8 : len);
+         memcpy (val_buf, value_contents (arg) + argoffset, (len > 8) ? 8 : len);
 
          if (slotnum < rseslots)
            write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
@@ -3132,7 +3132,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          while (len > 0 && floatreg < IA64_FR16_REGNUM)
            {
              char to[MAX_REGISTER_SIZE];
-             convert_typed_floating (VALUE_CONTENTS (arg) + argoffset, float_elt_type,
+             convert_typed_floating (value_contents (arg) + argoffset, float_elt_type,
                                      to, builtin_type_ia64_ext);
              regcache_cooked_write (regcache, floatreg, (void *)to);
              floatreg++;
index 9582343..040b303 100644 (file)
@@ -54,7 +54,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 
       /* Get the run-time type, and cast the object into that */
 
-      obj_addr = unpack_pointer (type, VALUE_CONTENTS (val));
+      obj_addr = unpack_pointer (type, value_contents (val));
 
       if (obj_addr != 0)
        {
@@ -172,7 +172,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
                {
                  VALUE_LAZY (next_v) = 1;
                  next_v->offset += TYPE_LENGTH (el_type);
-                 if (memcmp (VALUE_CONTENTS (v), VALUE_CONTENTS (next_v),
+                 if (memcmp (value_contents (v), value_contents (next_v),
                              TYPE_LENGTH (el_type)) != 0)
                    break;
                }
@@ -182,7 +182,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
              else
                fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
 
-             val_print (value_type (v), VALUE_CONTENTS (v), 0, 0,
+             val_print (value_type (v), value_contents (v), 0, 0,
                         stream, format, 2, 1, pretty);
 
              things_printed++;
@@ -235,7 +235,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
       return 0;
     }
 
-  return (val_print (type, VALUE_CONTENTS (val), 0, address,
+  return (val_print (type, value_contents (val), 0, address,
                     stream, format, 1, 0, pretty));
 }
 
@@ -384,7 +384,7 @@ java_print_value_fields (struct type *type, const bfd_byte *valaddr,
                  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
                                   unpack_field_as_long (type, valaddr, i));
 
-                 val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0,
+                 val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0,
                             0, stream, format, 0, recurse + 1, pretty);
                }
            }
@@ -405,7 +405,7 @@ java_print_value_fields (struct type *type, const bfd_byte *valaddr,
                      if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
                        v = value_addr (v);
                      val_print (value_type (v),
-                                VALUE_CONTENTS (v), 0, VALUE_ADDRESS (v),
+                                value_contents (v), 0, VALUE_ADDRESS (v),
                                 stream, format, 0, recurse + 1, pretty);
                    }
                }
index 5e19050..b3a5c18 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for Renesas M32R, for GDB.
 
-   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-   Foundation, Inc.
+   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+   Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -726,11 +726,11 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        {
          /* value gets right-justified in the register or stack word */
          memcpy (valbuf + (register_size (gdbarch, argreg) - len),
-                 (char *) VALUE_CONTENTS (args[argnum]), len);
+                 (char *) value_contents (args[argnum]), len);
          val = valbuf;
        }
       else
-       val = (char *) VALUE_CONTENTS (args[argnum]);
+       val = (char *) value_contents (args[argnum]);
 
       while (len > 0)
        {
index 74b15f3..069ced5 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Motorola 68HC11 & 68HC12
 
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
    Foundation, Inc.
 
    Contributed by Stephane Carrez, stcarrez@nerim.fr
@@ -1203,7 +1203,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
         {
           ULONGEST v;
 
-          v = extract_unsigned_integer (VALUE_CONTENTS (args[0]), len);
+          v = extract_unsigned_integer (value_contents (args[0]), len);
           first_stack_argnum = 1;
 
           regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
@@ -1227,7 +1227,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
           sp--;
           write_memory (sp, &zero, 1);
         }
-      val = (char*) VALUE_CONTENTS (args[argnum]);
+      val = (char*) value_contents (args[argnum]);
       sp -= len;
       write_memory (sp, val, len);
     }
index 7f6fe33..db443e9 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Motorola 88000 series.
 
-   Copyright 2004 Free Software Foundation, Inc.
+   Copyright 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -306,7 +306,7 @@ m88k_store_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      char *valbuf = VALUE_CONTENTS (args[i]);
+      const bfd_byte *valbuf = value_contents (args[i]);
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
       int stack_word = num_stack_words;
index 7351d1e..8afd262 100644 (file)
@@ -1,7 +1,7 @@
 /* MI Command Set.
 
-   Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
-   Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+   Foundation, Inc.
 
    Contributed by Cygnus Solutions (a Red Hat company).
 
@@ -679,7 +679,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
   val = evaluate_expression (expr);
 
   /* Print the result of the expression evaluation. */
-  val_print (value_type (val), VALUE_CONTENTS (val),
+  val_print (value_type (val), value_contents (val),
             VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
             stb->stream, 0, 0, 0, 0);
 
index 33ad1e9..68164e7 100644 (file)
@@ -2455,7 +2455,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
            fprintf_unfiltered (gdb_stdlog, " push");
        }
       else
-       val = (char *) VALUE_CONTENTS (arg);
+       val = (char *) value_contents (arg);
 
       /* 32-bit ABIs always start floating point arguments in an
          even-numbered floating point register.  Round the FP register
@@ -2723,7 +2723,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                            "mips_n32n64_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
-      val = (char *) VALUE_CONTENTS (arg);
+      val = (char *) value_contents (arg);
 
       if (fp_register_arg_p (typecode, arg_type)
          && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
@@ -3063,7 +3063,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                            "mips_o32_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
-      val = (char *) VALUE_CONTENTS (arg);
+      val = (char *) value_contents (arg);
 
       /* 32-bit ABIs always start floating point arguments in an
          even-numbered floating point register.  Round the FP register
@@ -3517,7 +3517,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                            "mips_o64_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
-      val = (char *) VALUE_CONTENTS (arg);
+      val = (char *) value_contents (arg);
 
       /* 32-bit ABIs always start floating point arguments in an
          even-numbered floating point register.  Round the FP register
index 336c1df..f3a9496 100644 (file)
@@ -239,7 +239,7 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
                      wtype = TYPE_TARGET_TYPE (type);
                    }
                  vt_val = value_at (wtype, vt_address);
-                 val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0,
+                 val_print (value_type (vt_val), value_contents (vt_val), 0,
                             VALUE_ADDRESS (vt_val), stream, format,
                             deref_ref, recurse + 1, pretty);
                  if (pretty)
@@ -292,7 +292,7 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
               unpack_pointer (lookup_pointer_type (builtin_type_void),
                               valaddr + embedded_offset));
              val_print (value_type (deref_val),
-                        VALUE_CONTENTS (deref_val), 0,
+                        value_contents (deref_val), 0,
                         VALUE_ADDRESS (deref_val), stream, format,
                         deref_ref, recurse + 1, pretty);
            }
@@ -565,7 +565,7 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
          fprintf_filtered (stream, ") ");
        }
     }
-  return val_print (type, VALUE_CONTENTS (val), VALUE_EMBEDDED_OFFSET (val),
+  return val_print (type, value_contents (val), VALUE_EMBEDDED_OFFSET (val),
                    VALUE_ADDRESS (val) + value_offset (val),
                    stream, format, 1, 0, pretty);
 }
@@ -846,7 +846,7 @@ pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
                  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
                                   unpack_field_as_long (type, valaddr, i));
 
-                 val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0,
+                 val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
                             stream, format, 0, recurse + 1, pretty);
                }
            }
@@ -1041,11 +1041,11 @@ pascal_object_print_static_field (struct type *type, struct value *val,
                    sizeof (CORE_ADDR));
 
       CHECK_TYPEDEF (type);
-      pascal_object_print_value_fields (type, VALUE_CONTENTS (val), VALUE_ADDRESS (val),
+      pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
                                  stream, format, recurse, pretty, NULL, 1);
       return;
     }
-  val_print (type, VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val),
+  val_print (type, value_contents (val), 0, VALUE_ADDRESS (val),
             stream, format, 0, recurse, pretty);
 }
 
index 7913c2c..9d9d1f4 100644 (file)
@@ -1,7 +1,8 @@
 /* Target-dependent code for PowerPC systems using the SVR4 ABI
    for GDB, the GNU debugger.
 
-   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -99,7 +100,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          struct value *arg = args[argno];
          struct type *type = check_typedef (value_type (arg));
          int len = TYPE_LENGTH (type);
-         char *val = VALUE_CONTENTS (arg);
+         const bfd_byte *val = value_contents (arg);
 
          if (TYPE_CODE (type) == TYPE_CODE_FLT
              && ppc_floating_point_unit_p (current_gdbarch) && len <= 8)
@@ -635,7 +636,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        {
          struct value *arg = args[argno];
          struct type *type = check_typedef (value_type (arg));
-         char *val = VALUE_CONTENTS (arg);
+         const bfd_byte *val = value_contents (arg);
          if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8)
            {
              /* Floats and Doubles go in f1 .. f13.  They also
index 1efd5d3..c735d2c 100644 (file)
@@ -1,8 +1,8 @@
 /* Print values for GNU debugger GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-   Foundation, Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -321,7 +321,7 @@ print_formatted (struct value *val, int format, int size,
        /* User specified format, so don't look to the
         * the type to tell us what to do.
         */
-       print_scalar_formatted (VALUE_CONTENTS (val), type,
+       print_scalar_formatted (value_contents (val), type,
                                format, size, stream);
     }
 }
index 5c46615..e095626 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -1497,7 +1497,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
          regcache_cooked_write (regcache,
                                 tdep->ppc_fp0_regnum + 1 + f_argno,
-                                VALUE_CONTENTS (arg));
+                                value_contents (arg));
          ++f_argno;
        }
 
@@ -1510,7 +1510,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              char word[MAX_REGISTER_SIZE];
              memset (word, 0, reg_size);
              memcpy (word,
-                     ((char *) VALUE_CONTENTS (arg)) + argbytes,
+                     ((char *) value_contents (arg)) + argbytes,
                      (len - argbytes) > reg_size
                        ? reg_size : len - argbytes);
              regcache_cooked_write (regcache,
@@ -1531,7 +1531,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          char word[MAX_REGISTER_SIZE];
 
          memset (word, 0, reg_size);
-         memcpy (word, VALUE_CONTENTS (arg), len);
+         memcpy (word, value_contents (arg), len);
          regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
        }
       ++argno;
@@ -1589,7 +1589,7 @@ ran_out_of_registers_for_arguments:
       if (argbytes)
        {
          write_memory (sp + 24 + (ii * 4),
-                       ((char *) VALUE_CONTENTS (arg)) + argbytes,
+                       ((char *) value_contents (arg)) + argbytes,
                        len - argbytes);
          ++argno;
          ii += ((len - argbytes + 3) & -4) / 4;
@@ -1613,12 +1613,12 @@ ran_out_of_registers_for_arguments:
 
              regcache_cooked_write (regcache,
                                     tdep->ppc_fp0_regnum + 1 + f_argno,
-                                    VALUE_CONTENTS (arg));
+                                    value_contents (arg));
              ++f_argno;
            }
 
          write_memory (sp + 24 + (ii * 4),
-                        (char *) VALUE_CONTENTS (arg),
+                        (char *) value_contents (arg),
                         len);
          ii += ((len + 3) & -4) / 4;
        }
index 71d9b37..b09abae 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for GDB, the GNU debugger.
 
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+   Inc.
 
    Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
    for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -2434,10 +2435,10 @@ extend_simple_arg (struct value *arg)
      register / memory word.  It's not really right to extract them as
      an integer, but it does take care of the extension.  */
   if (TYPE_UNSIGNED (type))
-    return extract_unsigned_integer (VALUE_CONTENTS (arg),
+    return extract_unsigned_integer (value_contents (arg),
                                      TYPE_LENGTH (type));
   else
-    return extract_signed_integer (VALUE_CONTENTS (arg),
+    return extract_signed_integer (value_contents (arg),
                                    TYPE_LENGTH (type));
 }
 
@@ -2518,7 +2519,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
         {
           sp -= length;
           sp = align_down (sp, alignment_of (type));
-          write_memory (sp, VALUE_CONTENTS (arg), length);
+          write_memory (sp, value_contents (arg), length);
           copy_addr[i] = sp;
         }
     }
@@ -2578,7 +2579,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                /* When we store a single-precision value in an FP register,
                   it occupies the leftmost bits.  */
                regcache_cooked_write_part (regcache, S390_F0_REGNUM + fr,
-                                           0, length, VALUE_CONTENTS (arg));
+                                           0, length, value_contents (arg));
                fr += 2;
              }
            else
@@ -2586,7 +2587,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                /* When we store a single-precision value in a stack slot,
                   it occupies the rightmost bits.  */
                starg = align_up (starg + length, word_size);
-                write_memory (starg - length, VALUE_CONTENTS (arg), length);
+                write_memory (starg - length, value_contents (arg), length);
              }
          }
        else if (s390_function_arg_integer (type) && length <= word_size)
@@ -2611,9 +2612,9 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
            if (gr <= 5)
              {
                regcache_cooked_write (regcache, S390_R0_REGNUM + gr,
-                                      VALUE_CONTENTS (arg));
+                                      value_contents (arg));
                regcache_cooked_write (regcache, S390_R0_REGNUM + gr + 1,
-                                      VALUE_CONTENTS (arg) + word_size);
+                                      value_contents (arg) + word_size);
                gr += 2;
              }
            else
@@ -2622,7 +2623,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                   in it, then don't go back and use it again later.  */
                gr = 7;
 
-               write_memory (starg, VALUE_CONTENTS (arg), length);
+               write_memory (starg, value_contents (arg), length);
                starg += length;
              }
          }
index 0de7428..529d278 100644 (file)
@@ -1,6 +1,7 @@
 /* Scheme/Guile language support routines for GDB, the GNU debugger.
 
-   Copyright 1995, 1996, 2000, 2003 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 2000, 2003, 2005 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -312,7 +313,7 @@ tryagain:
          struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr);
          if (!is_scmvalue_type (value_type (val)))
            error ("quoted scm form yields non-SCM value");
-         svalue = extract_signed_integer (VALUE_CONTENTS (val),
+         svalue = extract_signed_integer (value_contents (val),
                                           TYPE_LENGTH (value_type (val)));
          goto handle_immediate;
        }
index b62e5fe..b7b3e10 100644 (file)
@@ -391,6 +391,6 @@ int
 scm_value_print (struct value *val, struct ui_file *stream, int format,
                 enum val_prettyprint pretty)
 {
-  return (val_print (value_type (val), VALUE_CONTENTS (val), 0,
+  return (val_print (value_type (val), value_contents (val), 0,
                     VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
 }
index f25a204..a10dbbd 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for Renesas Super-H, for GDB.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004 Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -876,12 +877,12 @@ sh_justify_value_in_reg (struct value *val, int len)
     {
       /* value gets right-justified in the register or stack word */
       if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-       memcpy (valbuf + (4 - len), (char *) VALUE_CONTENTS (val), len);
+       memcpy (valbuf + (4 - len), (char *) value_contents (val), len);
       else
-       memcpy (valbuf, (char *) VALUE_CONTENTS (val), len);
+       memcpy (valbuf, (char *) value_contents (val), len);
       return valbuf;
     }
-  return (char *) VALUE_CONTENTS (val);
+  return (char *) value_contents (val);
 }
 
 /* Helper function to eval number of bytes to allocate on stack. */
index 2db6f45..a7cde84 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for Renesas Super-H, for GDB.
 
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004 Free Software Foundation, Inc.
+   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1520,14 +1520,14 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
              /* value gets right-justified in the register or stack word */
              if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
                memcpy (valbuf + argreg_size - len,
-                       (char *) VALUE_CONTENTS (args[argnum]), len);
+                       (char *) value_contents (args[argnum]), len);
              else
-               memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
+               memcpy (valbuf, (char *) value_contents (args[argnum]), len);
 
              val = valbuf;
            }
          else
-           val = (char *) VALUE_CONTENTS (args[argnum]);
+           val = (char *) value_contents (args[argnum]);
 
          while (len > 0)
            {
@@ -1557,7 +1557,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
        }
       else
        {
-         val = (char *) VALUE_CONTENTS (args[argnum]);
+         val = (char *) value_contents (args[argnum]);
          if (len == 4)
            {
              /* Where is it going to be stored? */
index e17e0a7..0bcdd48 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for SPARC.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -388,7 +388,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
              correct, and wasting a few bytes shouldn't be a problem.  */
          sp &= ~0x7;
 
-         write_memory (sp, VALUE_CONTENTS (args[i]), len);
+         write_memory (sp, value_contents (args[i]), len);
          args[i] = value_from_pointer (lookup_pointer_type (type), sp);
          num_elements++;
        }
@@ -423,7 +423,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      char *valbuf = VALUE_CONTENTS (args[i]);
+      const bfd_byte *valbuf = value_contents (args[i]);
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
 
index 95562ba..079022d 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for UltraSPARC.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -784,7 +784,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
                  a problem.  */
              sp &= ~0xf;
 
-             write_memory (sp, VALUE_CONTENTS (args[i]), len);
+             write_memory (sp, value_contents (args[i]), len);
              args[i] = value_from_pointer (lookup_pointer_type (type), sp);
              num_elements++;
            }
@@ -853,7 +853,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      char *valbuf = VALUE_CONTENTS (args[i]);
+      char *valbuf = value_contents (args[i]);
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
       int regnum = -1;
index aa0cb82..cd11406 100644 (file)
@@ -1,8 +1,8 @@
 /* Print and select stack frames for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
-   Software Foundation, Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -354,7 +354,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
 
          if (val)
            {
-             val_print (value_type (val), VALUE_CONTENTS (val), 0,
+             val_print (value_type (val), value_contents (val), 0,
                         VALUE_ADDRESS (val),
                         stb->stream, 0, 0, 2, Val_no_prettyprint);
              ui_out_field_stream (uiout, "value", stb);
@@ -1906,7 +1906,7 @@ If you continue, the return value that you specified will be ignored.\n";
                  == RETURN_VALUE_REGISTER_CONVENTION);
       gdbarch_return_value (current_gdbarch, return_type,
                            current_regcache, NULL /*read*/,
-                           VALUE_CONTENTS (return_value) /*write*/);
+                           value_contents (return_value) /*write*/);
     }
 
   /* If we are at the end of a call dummy now, pop the dummy frame
index 5b21957..59dde3e 100644 (file)
@@ -229,7 +229,7 @@ value_subscript (struct value *array, struct value *idx)
        error ("bitstring index out of range");
       index -= lowerbound;
       offset = index / TARGET_CHAR_BIT;
-      byte = *((char *) VALUE_CONTENTS (array) + offset);
+      byte = *((char *) value_contents (array) + offset);
       bit_index = index % TARGET_CHAR_BIT;
       byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index);
       v = value_from_longest (LA_BOOL_TYPE, byte & 1);
@@ -271,7 +271,8 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
   if (value_lazy (array))
     VALUE_LAZY (v) = 1;
   else
-    memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs, elt_size);
+    memcpy (value_contents_writeable (v),
+           value_contents (array) + elt_offs, elt_size);
 
   if (VALUE_LVAL (array) == lval_internalvar)
     VALUE_LVAL (v) = lval_internalvar_component;
@@ -659,7 +660,7 @@ value_concat (struct value *arg1, struct value *arg2)
          if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
            {
              inchar = (char) unpack_long (type2,
-                                          VALUE_CONTENTS (inval2));
+                                          value_contents (inval2));
              for (idx = 0; idx < count; idx++)
                {
                  *(ptr + idx) = inchar;
@@ -669,7 +670,7 @@ value_concat (struct value *arg1, struct value *arg2)
            {
              for (idx = 0; idx < count; idx++)
                {
-                 memcpy (ptr + (idx * inval2len), VALUE_CONTENTS (inval2),
+                 memcpy (ptr + (idx * inval2len), value_contents (inval2),
                          inval2len);
                }
            }
@@ -699,20 +700,20 @@ value_concat (struct value *arg1, struct value *arg2)
       ptr = (char *) alloca (inval1len + inval2len);
       if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
        {
-         *ptr = (char) unpack_long (type1, VALUE_CONTENTS (inval1));
+         *ptr = (char) unpack_long (type1, value_contents (inval1));
        }
       else
        {
-         memcpy (ptr, VALUE_CONTENTS (inval1), inval1len);
+         memcpy (ptr, value_contents (inval1), inval1len);
        }
       if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
        {
          *(ptr + inval1len) =
-           (char) unpack_long (type2, VALUE_CONTENTS (inval2));
+           (char) unpack_long (type2, value_contents (inval2));
        }
       else
        {
-         memcpy (ptr + inval1len, VALUE_CONTENTS (inval2), inval2len);
+         memcpy (ptr + inval1len, value_contents (inval2), inval2len);
        }
       outval = value_string (ptr, inval1len + inval2len);
     }
@@ -1154,7 +1155,7 @@ int
 value_logical_not (struct value *arg1)
 {
   int len;
-  char *p;
+  const bfd_byte *p;
   struct type *type1;
 
   arg1 = coerce_number (arg1);
@@ -1164,7 +1165,7 @@ value_logical_not (struct value *arg1)
     return 0 == value_as_double (arg1);
 
   len = TYPE_LENGTH (type1);
-  p = VALUE_CONTENTS (arg1);
+  p = value_contents (arg1);
 
   while (--len >= 0)
     {
@@ -1183,8 +1184,8 @@ value_strcmp (struct value *arg1, struct value *arg2)
 {
   int len1 = TYPE_LENGTH (value_type (arg1));
   int len2 = TYPE_LENGTH (value_type (arg2));
-  char *s1 = VALUE_CONTENTS (arg1);
-  char *s2 = VALUE_CONTENTS (arg2);
+  const bfd_byte *s1 = value_contents (arg1);
+  const bfd_byte *s2 = value_contents (arg2);
   int i, len = len1 < len2 ? len1 : len2;
 
   for (i = 0; i < len; i++)
@@ -1212,7 +1213,8 @@ int
 value_equal (struct value *arg1, struct value *arg2)
 {
   int len;
-  char *p1, *p2;
+  const bfd_byte *p1;
+  const bfd_byte *p2;
   struct type *type1, *type2;
   enum type_code code1;
   enum type_code code2;
@@ -1246,8 +1248,8 @@ value_equal (struct value *arg1, struct value *arg2)
           && ((len = (int) TYPE_LENGTH (type1))
               == (int) TYPE_LENGTH (type2)))
     {
-      p1 = VALUE_CONTENTS (arg1);
-      p2 = VALUE_CONTENTS (arg2);
+      p1 = value_contents (arg1);
+      p2 = value_contents (arg2);
       while (--len >= 0)
        {
          if (*p1++ != *p2++)
@@ -1363,7 +1365,7 @@ value_complement (struct value *arg1)
 }
 \f
 /* The INDEX'th bit of SET value whose value_type is TYPE,
-   and whose VALUE_CONTENTS is valaddr.
+   and whose value_contents is valaddr.
    Return -1 if out of range, -2 other error. */
 
 int
@@ -1401,7 +1403,7 @@ value_in (struct value *element, struct value *set)
       && TYPE_CODE (eltype) != TYPE_CODE_ENUM
       && TYPE_CODE (eltype) != TYPE_CODE_BOOL)
     error ("First argument of 'IN' has wrong type");
-  member = value_bit_index (settype, VALUE_CONTENTS (set),
+  member = value_bit_index (settype, value_contents (set),
                            value_as_long (element));
   if (member < 0)
     error ("First argument of 'IN' not in range");
index 442bb51..a30123d 100644 (file)
@@ -306,7 +306,7 @@ value_cast (struct type *type, struct value *arg2)
            case TYPE_CODE_MEMBER:
              retvalp = value_from_longest (type, value_as_long (arg2));
              /* force evaluation */
-             ptr = (unsigned int *) VALUE_CONTENTS (retvalp);
+             ptr = (unsigned int *) value_contents (retvalp);
              *ptr &= ~0x20000000;      /* zap 29th bit to remove bias */
              return retvalp;
 
@@ -326,7 +326,7 @@ value_cast (struct type *type, struct value *arg2)
          sees a cast as a simple reinterpretation of the pointer's
          bits.  */
       if (code2 == TYPE_CODE_PTR)
-        longest = extract_unsigned_integer (VALUE_CONTENTS (arg2),
+        longest = extract_unsigned_integer (value_contents (arg2),
                                             TYPE_LENGTH (type2));
       else
         longest = value_as_long (arg2);
@@ -429,8 +429,6 @@ struct value *
 value_zero (struct type *type, enum lval_type lv)
 {
   struct value *val = allocate_value (type);
-
-  memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (check_typedef (type)));
   VALUE_LVAL (val) = lv;
 
   return val;
@@ -442,7 +440,7 @@ value_zero (struct type *type, enum lval_type lv)
    if we can be 'lazy' and defer the fetch, perhaps indefinately, call
    value_at_lazy instead.  value_at_lazy simply records the address of
    the data and sets the lazy-evaluation-required flag.  The lazy flag
-   is tested in the VALUE_CONTENTS macro, which is used if and when
+   is tested in the value_contents macro, which is used if and when
    the contents are actually required.
 
    Note: value_at does *NOT* handle embedded offsets; perform such
@@ -485,16 +483,16 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
   return val;
 }
 
-/* Called only from the VALUE_CONTENTS and value_contents_all()
+/* Called only from the value_contents and value_contents_all()
    macros, if the current data for a variable needs to be loaded into
-   VALUE_CONTENTS(VAL).  Fetches the data from the user's process, and
+   value_contents(VAL).  Fetches the data from the user's process, and
    clears the lazy flag to indicate that the data in the buffer is
    valid.
 
    If the value is zero-length, we avoid calling read_memory, which would
    abort.  We mark the value as fetched anyway -- all 0 bytes of it.
 
-   This function returns a value because it is used in the VALUE_CONTENTS
+   This function returns a value because it is used in the value_contents
    macro as part of an expression, where a void would not work.  The
    value is ignored.  */
 
@@ -560,7 +558,7 @@ value_assign (struct value *toval, struct value *fromval)
 
     case lval_memory:
       {
-       char *dest_buffer;
+       const bfd_byte *dest_buffer;
        CORE_ADDR changed_addr;
        int changed_len;
         char buffer[sizeof (LONGEST)];
@@ -589,7 +587,7 @@ value_assign (struct value *toval, struct value *fromval)
          {
            changed_addr = VALUE_ADDRESS (toval) + value_offset (toval);
            changed_len = TYPE_LENGTH (type);
-           dest_buffer = VALUE_CONTENTS (fromval);
+           dest_buffer = value_contents (fromval);
          }
 
        write_memory (changed_addr, dest_buffer, changed_len);
@@ -616,7 +614,7 @@ value_assign (struct value *toval, struct value *fromval)
            /* If TOVAL is a special machine register requiring
               conversion of program values to a special raw format.  */
            VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval),
-                              type, VALUE_CONTENTS (fromval));
+                              type, value_contents (fromval));
          }
        else
          {
@@ -663,7 +661,7 @@ value_assign (struct value *toval, struct value *fromval)
                            value_as_long (fromval),
                            value_bitpos (toval), value_bitsize (toval));
            else
-             memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
+             memcpy (buffer + byte_offset, value_contents (fromval),
                      TYPE_LENGTH (type));
 
            /* Copy it out.  */
@@ -730,7 +728,7 @@ value_assign (struct value *toval, struct value *fromval)
     }
 
   val = value_copy (toval);
-  memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
+  memcpy (value_contents_raw (val), value_contents (fromval),
          TYPE_LENGTH (type));
   val->type = type;
   val = value_change_enclosing_type (val, value_enclosing_type (fromval));
@@ -1284,7 +1282,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
          struct value *v2 = allocate_value (basetype);
 
          boffset = baseclass_offset (type, i,
-                                     VALUE_CONTENTS (arg1) + offset,
+                                     value_contents (arg1) + offset,
                                      VALUE_ADDRESS (arg1)
                                      + value_offset (arg1) + offset);
          if (boffset == -1)
@@ -1514,7 +1512,7 @@ search_struct_method (char *name, struct value **arg1p,
          else
            {
              struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-             char *base_valaddr;
+             const bfd_byte *base_valaddr;
 
              /* The virtual base class pointer might have been clobbered by the
                 user program. Make sure that it still points to a valid memory
@@ -1522,15 +1520,15 @@ search_struct_method (char *name, struct value **arg1p,
 
              if (offset < 0 || offset >= TYPE_LENGTH (type))
                {
-                 base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass));
+                 bfd_byte *tmp = alloca (TYPE_LENGTH (baseclass));
                  if (target_read_memory (VALUE_ADDRESS (*arg1p)
                                          + value_offset (*arg1p) + offset,
-                                         base_valaddr,
-                                         TYPE_LENGTH (baseclass)) != 0)
+                                         tmp, TYPE_LENGTH (baseclass)) != 0)
                    error ("virtual baseclass botch");
+                 base_valaddr = tmp;
                }
              else
-               base_valaddr = VALUE_CONTENTS (*arg1p) + offset;
+               base_valaddr = value_contents (*arg1p) + offset;
 
              base_offset =
                baseclass_offset (type, i, base_valaddr,
@@ -1751,7 +1749,7 @@ find_method_list (struct value **argp, char *method, int offset,
              base_offset = value_offset (*argp) + offset;
              base_offset =
                baseclass_offset (type, i,
-                                 VALUE_CONTENTS (*argp) + base_offset,
+                                 value_contents (*argp) + base_offset,
                                  VALUE_ADDRESS (*argp) + base_offset);
              if (base_offset == -1)
                error ("virtual baseclass botch");
@@ -2738,7 +2736,7 @@ value_slice (struct value *array, int lowbound, int length)
       for (i = 0; i < length; i++)
        {
          int element = value_bit_index (array_type,
-                                        VALUE_CONTENTS (array),
+                                        value_contents (array),
                                         lowbound + i);
          if (element < 0)
            error ("internal error accessing bitstring");
@@ -2766,7 +2764,8 @@ value_slice (struct value *array, int lowbound, int length)
       if (value_lazy (array))
        VALUE_LAZY (slice) = 1;
       else
-       memcpy (VALUE_CONTENTS (slice), VALUE_CONTENTS (array) + offset,
+       memcpy (value_contents_writeable (slice),
+               value_contents (array) + offset,
                TYPE_LENGTH (slice_type));
       if (VALUE_LVAL (array) == lval_internalvar)
        VALUE_LVAL (slice) = lval_internalvar_component;
@@ -2796,9 +2795,9 @@ value_literal_complex (struct value *arg1, struct value *arg2, struct type *type
   arg2 = value_cast (real_type, arg2);
 
   memcpy (value_contents_raw (val),
-         VALUE_CONTENTS (arg1), TYPE_LENGTH (real_type));
+         value_contents (arg1), TYPE_LENGTH (real_type));
   memcpy (value_contents_raw (val) + TYPE_LENGTH (real_type),
-         VALUE_CONTENTS (arg2), TYPE_LENGTH (real_type));
+         value_contents (arg2), TYPE_LENGTH (real_type));
   return val;
 }
 
@@ -2815,9 +2814,9 @@ cast_into_complex (struct type *type, struct value *val)
       struct value *im_val = allocate_value (val_real_type);
 
       memcpy (value_contents_raw (re_val),
-             VALUE_CONTENTS (val), TYPE_LENGTH (val_real_type));
+             value_contents (val), TYPE_LENGTH (val_real_type));
       memcpy (value_contents_raw (im_val),
-             VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type),
+             value_contents (val) + TYPE_LENGTH (val_real_type),
              TYPE_LENGTH (val_real_type));
 
       return value_literal_complex (re_val, im_val, type);
index a871df3..fecbbf5 100644 (file)
@@ -179,6 +179,20 @@ value_lazy (struct value *value)
   return value->lazy;
 }
 
+const bfd_byte *
+value_contents (struct value *value)
+{
+  return value_contents_writeable (value);
+}
+
+bfd_byte *
+value_contents_writeable (struct value *value)
+{
+  if (value->lazy)
+    value_fetch_lazy (value);
+  return value->aligner.contents;
+}
+
 \f
 /* Return a mark in the value chain.  All values allocated after the
    mark is obtained (except for those released) are subject to being freed
@@ -493,13 +507,13 @@ void
 set_internalvar_component (struct internalvar *var, int offset, int bitpos,
                           int bitsize, struct value *newval)
 {
-  char *addr = VALUE_CONTENTS (var->value) + offset;
+  bfd_byte *addr = value_contents_writeable (var->value) + offset;
 
   if (bitsize)
     modify_field (addr, value_as_long (newval),
                  bitpos, bitsize);
   else
-    memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (value_type (newval)));
+    memcpy (addr, value_contents (newval), TYPE_LENGTH (value_type (newval)));
 }
 
 void
@@ -586,7 +600,7 @@ value_as_long (struct value *val)
      in disassemble_command).  It also dereferences references, which
      I suspect is the most logical thing to do.  */
   val = coerce_array (val);
-  return unpack_long (value_type (val), VALUE_CONTENTS (val));
+  return unpack_long (value_type (val), value_contents (val));
 }
 
 DOUBLEST
@@ -595,7 +609,7 @@ value_as_double (struct value *val)
   DOUBLEST foo;
   int inv;
 
-  foo = unpack_double (value_type (val), VALUE_CONTENTS (val), &inv);
+  foo = unpack_double (value_type (val), value_contents (val), &inv);
   if (inv)
     error ("Invalid floating value found in program.");
   return foo;
@@ -699,9 +713,9 @@ value_as_address (struct value *val)
       && TYPE_CODE (value_type (val)) != TYPE_CODE_REF
       && gdbarch_integer_to_address_p (current_gdbarch))
     return gdbarch_integer_to_address (current_gdbarch, value_type (val),
-                                      VALUE_CONTENTS (val));
+                                      value_contents (val));
 
-  return unpack_long (value_type (val), VALUE_CONTENTS (val));
+  return unpack_long (value_type (val), value_contents (val));
 #endif
 }
 \f
@@ -953,7 +967,7 @@ value_primitive_field (struct value *arg1, int offset,
     {
       v = value_from_longest (type,
                              unpack_field_as_long (arg_type,
-                                                   VALUE_CONTENTS (arg1)
+                                                   value_contents (arg1)
                                                    + offset,
                                                    fieldno));
       v->bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8;
@@ -1266,7 +1280,7 @@ coerce_ref (struct value *arg)
   if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
     arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
                         unpack_pointer (value_type (arg),              
-                                        VALUE_CONTENTS (arg)));
+                                        value_contents (arg)));
   return arg;
 }
 
index 7963bf1..50ea6d9 100644 (file)
@@ -106,7 +106,7 @@ struct value
      When we store the entire object, `enclosing_type' is the run-time
      type -- the complete object -- and `embedded_offset' is the
      offset of `type' within that larger type, in bytes.  The
-     VALUE_CONTENTS macro takes `embedded_offset' into account, so
+     value_contents() macro takes `embedded_offset' into account, so
      most GDB code continues to see the `type' portion of the value,
      just as the inferior would.
 
@@ -182,23 +182,23 @@ extern struct type *value_enclosing_type (struct value *);
 extern int value_lazy (struct value *);
 #define VALUE_LAZY(val) (val)->lazy
 
-/* VALUE_CONTENTS and value_contents_raw() both return the address of
-   the gdb buffer used to hold a copy of the contents of the lval.
-   VALUE_CONTENTS is used when the contents of the buffer are needed
+/* value_contents() and value_contents_raw() both return the address
+   of the gdb buffer used to hold a copy of the contents of the lval.
+   value_contents() is used when the contents of the buffer are needed
    -- it uses value_fetch_lazy() to load the buffer from the process
-   being debugged if it hasn't already been loaded.
-   value_contents_raw() is used when data is being stored into the
-   buffer, or when it is certain that the contents of the buffer are
-   valid.
+   being debugged if it hasn't already been loaded
+   (value_contents_writeable() is used when a writeable but fetched
+   buffer is required)..  value_contents_raw() is used when data is
+   being stored into the buffer, or when it is certain that the
+   contents of the buffer are valid.
 
    Note: The contents pointer is adjusted by the offset required to
    get to the real subobject, if the value happens to represent
    something embedded in a larger run-time object.  */
 
 extern bfd_byte *value_contents_raw (struct value *);
-#define VALUE_CONTENTS(val) \
- ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), \
-  (val)->aligner.contents)
+extern const bfd_byte *value_contents (struct value *);
+extern bfd_byte *value_contents_writeable (struct value *);
 
 /* The ALL variants of the above two macros do not adjust the returned
    pointer by the embedded_offset value.  */
index 78bea7c..818a31b 100644 (file)
@@ -1909,9 +1909,9 @@ c_value_of_root (struct varobj **var_handle)
              /* We need to catch errors because if
                 value_fetch_lazy fails we still want to continue
                 (after making val->error = 1) */
-             /* FIXME: Shouldn't be using VALUE_CONTENTS?  The
-                comment on value_fetch_lazy() says it is only
-                called from the macro... */
+             /* FIXME: Shouldn't be using value_contents()?  The
+                comment on value_fetch_lazy() says it is only called
+                from the macro... */
              if (!gdb_value_fetch_lazy (new_val))
                var->error = 1;
              else
index 2d29aec..3aceb69 100644 (file)
@@ -262,7 +262,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
        break;
 
       /* Put argument into registers wordwise. */
-      val = VALUE_CONTENTS (args[i]);
+      val = value_contents (args[i]);
       for (j = 0; j < typelen; j += xstormy16_reg_size)
        regcache_cooked_write_unsigned (regcache, argreg++,
                        extract_unsigned_integer (val + j,
@@ -281,7 +281,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
       typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
       slacklen = typelen & 1;
       val = alloca (typelen + slacklen);
-      memcpy (val, VALUE_CONTENTS (args[j]), typelen);
+      memcpy (val, value_contents (args[j]), typelen);
       memset (val + typelen, 0, slacklen);
 
       /* Now write this data to the stack. The stack grows upwards. */