]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2005-02-02 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Wed, 2 Feb 2005 20:31:35 +0000 (20:31 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 2 Feb 2005 20:31:35 +0000 (20:31 +0000)
* value.c (value_enclosing_type): New function.
* value.h (VALUE_ENCLOSING_TYPE): Delete.
(value_enclosing_type): Declare.
* xstormy16-tdep.c, vax-tdep.c, m68k-tdep.c, i386-tdep.c: Update.
* gnu-v3-abi.c, hpacc-abi.c, infcall.c, valops.c: Update.

12 files changed:
gdb/ChangeLog
gdb/c-valprint.c
gdb/gnu-v3-abi.c
gdb/hpacc-abi.c
gdb/i386-tdep.c
gdb/infcall.c
gdb/m68k-tdep.c
gdb/valops.c
gdb/value.c
gdb/value.h
gdb/vax-tdep.c
gdb/xstormy16-tdep.c

index 8564db6714789c560ee0b7aecd304bbaa81f32f0..8806bfc8f10d85580a431cb478db05d282ead5cb 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-02  Andrew Cagney  <cagney@gnu.org>
+
+       * value.c (value_enclosing_type): New function.
+       * value.h (VALUE_ENCLOSING_TYPE): Delete.
+       (value_enclosing_type): Declare.
+       * xstormy16-tdep.c, vax-tdep.c, m68k-tdep.c, i386-tdep.c: Update.
+       * gnu-v3-abi.c, hpacc-abi.c, infcall.c, valops.c: Update.
+
 2005-02-01  Andrew Cagney  <cagney@gnu.org>
 
        * value.c (value_contents_all_raw)
index 4365dcfd9b082020c47f4b1e331024a3aa050e32..532dedcf635342bb9371af17419054120171318f 100644 (file)
@@ -1,7 +1,8 @@
 /* Support for printing C values for GDB, the GNU debugger.
 
    Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -578,17 +579,17 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
                            TYPE_NAME (real_type),
                            full ? "" : _(" [incomplete object]"));
          /* Print out object: enclosing type is same as real_type if full */
-         return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
+         return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
                         VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
           /* Note: When we look up RTTI entries, we don't get any information on
              const or volatile attributes */
        }
-      else if (type != VALUE_ENCLOSING_TYPE (val))
+      else if (type != value_enclosing_type (val))
        {
          /* No RTTI information, so let's do our best */
          fprintf_filtered (stream, "(%s ?) ",
-                           TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
-         return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
+                           TYPE_NAME (value_enclosing_type (val)));
+         return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
                         VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
        }
       /* Otherwise, we end up at the return outside this "if" */
index 3fead2afb4bc48d6361e4625199da2b1db1ebc67..12eea1b6189fc514153859cdfb7d01f8f7ba371b 100644 (file)
@@ -1,7 +1,7 @@
 /* Abstraction of GNU v3 abi.
    Contributed by Jim Blandy <jimb@redhat.com>
 
-   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -266,7 +266,7 @@ gnuv3_rtti_type (struct value *value,
 
   if (full_p)
     *full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
-               && (TYPE_LENGTH (VALUE_ENCLOSING_TYPE (value))
+               && (TYPE_LENGTH (value_enclosing_type (value))
                    >= TYPE_LENGTH (run_time_type)));
   if (top_p)
     *top_p = - offset_to_top;
index 9830b0d95d8733cc7c356378183bdc1a1cb38d65..1cd7ad6d9899b709a5babc91a57b1acd85b89da7 100644 (file)
@@ -206,7 +206,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
    * we can't do anything. */
   if (!TYPE_HAS_VTABLE (known_type))
     {
-      known_type = VALUE_ENCLOSING_TYPE (v);
+      known_type = value_enclosing_type (v);
       CHECK_TYPEDEF (known_type);
       if ((TYPE_CODE (known_type) != TYPE_CODE_CLASS) ||
           !TYPE_HAS_VTABLE (known_type))
@@ -280,7 +280,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
           same as the embedded offset */
        ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
         !using_enclosing &&
-        TYPE_LENGTH (VALUE_ENCLOSING_TYPE (v)) == TYPE_LENGTH (rtti_type))))
+        TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
 
     *full = 1;
 
index 0d066a9d31579402f4187aa86282e8fa3e13e940..671ad506b3e3cea99b4ca467a0d42bde8c134cfc 100644 (file)
@@ -1,7 +1,7 @@
 /* Intel 386 target-dependent stuff.
 
    Copyright 1988, 1989, 1990, 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.
@@ -1223,7 +1223,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Push arguments in reverse order.  */
   for (i = nargs - 1; i >= 0; i--)
     {
-      int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
+      int len = TYPE_LENGTH (value_enclosing_type (args[i]));
 
       /* The System V ABI says that:
 
index 0617ce96104d2745be58d5c3ad769111f4333d71..4025ee221b4cf12c893e72307f97d6d96d8631d2 100644 (file)
@@ -571,7 +571,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
              CORE_ADDR addr;
              int len;          /*  = TYPE_LENGTH (arg_type); */
              int aligned_len;
-             arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i]));
+             arg_type = check_typedef (value_enclosing_type (args[i]));
              len = TYPE_LENGTH (arg_type);
 
              aligned_len = len;
index cb2bb10adc8d2cb812a95782a807630fa837ab2c..553bddebda6e0ffb45c938caa34c2155e3d9c854 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for the Motorola 68000 series.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
-   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -417,7 +417,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Push arguments in reverse order.  */
   for (i = nargs - 1; i >= 0; i--)
     {
-      struct type *value_type = VALUE_ENCLOSING_TYPE (args[i]);
+      struct type *value_type = value_enclosing_type (args[i]);
       int len = TYPE_LENGTH (value_type);
       int container_len = (len + 3) & ~3;
       int offset;
index 1d45ad299f9072363bb32bd2e89583304a8f327e..ac55d535e46bdb39ae7831230c6ea08155338811 100644 (file)
@@ -501,7 +501,7 @@ int
 value_fetch_lazy (struct value *val)
 {
   CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
-  int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val));
+  int length = TYPE_LENGTH (value_enclosing_type (val));
 
   struct type *type = value_type (val);
   if (length)
@@ -544,7 +544,7 @@ value_assign (struct value *toval, struct value *fromval)
     case lval_internalvar:
       set_internalvar (VALUE_INTERNALVAR (toval), fromval);
       val = value_copy (VALUE_INTERNALVAR (toval)->value);
-      val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval));
+      val = value_change_enclosing_type (val, value_enclosing_type (fromval));
       VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
       VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
       return val;
@@ -732,7 +732,7 @@ value_assign (struct value *toval, struct value *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));
+  val = value_change_enclosing_type (val, value_enclosing_type (fromval));
   VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
 
@@ -751,11 +751,11 @@ value_repeat (struct value *arg1, int count)
   if (count < 1)
     error ("Invalid number %d of repetitions.", count);
 
-  val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count);
+  val = allocate_repeat_value (value_enclosing_type (arg1), count);
 
   read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1),
               value_contents_all_raw (val),
-              TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)));
+              TYPE_LENGTH (value_enclosing_type (val)));
   VALUE_LVAL (val) = lval_memory;
   VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1);
 
@@ -873,7 +873,7 @@ value_addr (struct value *arg1)
 
   /* This may be a pointer to a base subobject; so remember the
      full derived object's type ... */
-  arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (VALUE_ENCLOSING_TYPE (arg1)));
+  arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
   /* ... and also the relative position of the subobject in the full object */
   VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
   return arg2;
@@ -906,7 +906,7 @@ value_ind (struct value *arg1)
       struct type *enc_type;
       /* We may be pointing to something embedded in a larger object */
       /* Get the real type of the enclosing object */
-      enc_type = check_typedef (VALUE_ENCLOSING_TYPE (arg1));
+      enc_type = check_typedef (value_enclosing_type (arg1));
       enc_type = TYPE_TARGET_TYPE (enc_type);
       /* Retrieve the enclosing object pointed to */
       arg2 = value_at_lazy (enc_type, (value_as_address (arg1)
@@ -1003,10 +1003,10 @@ value_array (int lowbound, int highbound, struct value **elemvec)
     {
       error ("bad array bounds (%d, %d)", lowbound, highbound);
     }
-  typelength = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (elemvec[0]));
+  typelength = TYPE_LENGTH (value_enclosing_type (elemvec[0]));
   for (idx = 1; idx < nelem; idx++)
     {
-      if (TYPE_LENGTH (VALUE_ENCLOSING_TYPE (elemvec[idx])) != typelength)
+      if (TYPE_LENGTH (value_enclosing_type (elemvec[idx])) != typelength)
        {
          error ("array elements must all be the same size");
        }
@@ -1015,7 +1015,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
   rangetype = create_range_type ((struct type *) NULL, builtin_type_int,
                                 lowbound, highbound);
   arraytype = create_array_type ((struct type *) NULL,
-                             VALUE_ENCLOSING_TYPE (elemvec[0]), rangetype);
+                             value_enclosing_type (elemvec[0]), rangetype);
 
   if (!current_language->c_style_arrays)
     {
@@ -2600,7 +2600,7 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
     real_type = value_rtti_type (argp, &full, &top, &using_enc);
 
   /* If no RTTI data, or if object is already complete, do nothing */
-  if (!real_type || real_type == VALUE_ENCLOSING_TYPE (argp))
+  if (!real_type || real_type == value_enclosing_type (argp))
     return argp;
 
   /* If we have the full object, but for some reason the enclosing
index a9c990c38e482b8f9729eaea697eafee3c8c7d63..25791434234b18e202ffb0044459b4d87a7220b5 100644 (file)
@@ -87,7 +87,7 @@ allocate_value (struct type *type)
   val->next = all_values;
   all_values = val;
   val->type = type;
-  VALUE_ENCLOSING_TYPE (val) = type;
+  val->enclosing_type = type;
   VALUE_LVAL (val) = not_lval;
   VALUE_ADDRESS (val) = 0;
   VALUE_FRAME_ID (val) = null_frame_id;
@@ -159,6 +159,12 @@ value_contents_all_raw (struct value *value)
   return value->aligner.contents;
 }
 
+struct type *
+value_enclosing_type (struct value *value)
+{
+  return value->enclosing_type;
+}
+
 \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
@@ -252,7 +258,7 @@ value_release_to_mark (struct value *mark)
 struct value *
 value_copy (struct value *arg)
 {
-  struct type *encl_type = VALUE_ENCLOSING_TYPE (arg);
+  struct type *encl_type = value_enclosing_type (arg);
   struct value *val = allocate_value (encl_type);
   val->type = arg->type;
   VALUE_LVAL (val) = VALUE_LVAL (arg);
@@ -270,7 +276,7 @@ value_copy (struct value *arg)
   if (!VALUE_LAZY (val))
     {
       memcpy (value_contents_all_raw (val), value_contents_all_raw (arg),
-             TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg)));
+             TYPE_LENGTH (value_enclosing_type (arg)));
 
     }
   return val;
@@ -877,9 +883,9 @@ value_static_field (struct type *type, int fieldno)
 struct value *
 value_change_enclosing_type (struct value *val, struct type *new_encl_type)
 {
-  if (TYPE_LENGTH (new_encl_type) <= TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val))) 
+  if (TYPE_LENGTH (new_encl_type) <= TYPE_LENGTH (value_enclosing_type (val))) 
     {
-      VALUE_ENCLOSING_TYPE (val) = new_encl_type;
+      val->enclosing_type = new_encl_type;
       return val;
     }
   else
@@ -889,7 +895,7 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type)
       
       new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type));
 
-      VALUE_ENCLOSING_TYPE (new_val) = new_encl_type;
+      new_val->enclosing_type = new_encl_type;
  
       /* We have to make sure this ends up in the same place in the value
         chain as the original copy, so it's clean-up behavior is the same. 
@@ -946,13 +952,13 @@ value_primitive_field (struct value *arg1, int offset,
       /* This field is actually a base subobject, so preserve the
          entire object's contents for later references to virtual
          bases, etc.  */
-      v = allocate_value (VALUE_ENCLOSING_TYPE (arg1));
+      v = allocate_value (value_enclosing_type (arg1));
       v->type = type;
       if (VALUE_LAZY (arg1))
        VALUE_LAZY (v) = 1;
       else
        memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
-               TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg1)));
+               TYPE_LENGTH (value_enclosing_type (arg1)));
       v->offset = value_offset (arg1);
       VALUE_EMBEDDED_OFFSET (v)
        = offset +
index 844d6fcd66019a3dcc330e1a9ea03c7679e348d7..ed4d9ee0b3412e3c287e7d80fd75c6c52d0d6416 100644 (file)
@@ -1,7 +1,7 @@
 /* Definitions for values of C expressions, for GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -178,7 +178,7 @@ extern int value_bitsize (struct value *);
 extern int value_bitpos (struct value *);
 extern int value_offset (struct value *);
 
-#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
+extern struct type *value_enclosing_type (struct value *);
 #define VALUE_LAZY(val) (val)->lazy
 
 /* VALUE_CONTENTS and value_contents_raw() both return the address of
index 21e71b9655865beb369e0919b2e37fb39fe6d956..028e24b46404df3db31a81b2b31fbc8a10e39415 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for the VAX.
 
    Copyright 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000,
-   2002, 2003, 2004 Free Software Foundation, Inc.
+   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -124,7 +124,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
   /* Push arguments in reverse order.  */
   for (i = nargs - 1; i >= 0; i--)
     {
-      int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
+      int len = TYPE_LENGTH (value_enclosing_type (args[i]));
 
       sp -= (len + 3) & ~3;
       count += (len + 3) / 4;
index a93f544ec4bee5f8b3318d5fe15d2ed1c2ff593f..2d29aece675319999d134435b938d48ddf4ab079 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for the Sanyo Xstormy16a (LC590000) processor.
 
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -256,7 +257,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
      would fit in the remaining unused registers.  */
   for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
     {
-      typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
+      typelen = TYPE_LENGTH (value_enclosing_type (args[i]));
       if (typelen > E_MAX_RETTYPE_SIZE (argreg))
        break;
 
@@ -277,7 +278,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
      wordaligned.  */
   for (j = nargs - 1; j >= i; j--)
     {
-      typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[j]));
+      typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
       slacklen = typelen & 1;
       val = alloca (typelen + slacklen);
       memcpy (val, VALUE_CONTENTS (args[j]), typelen);