This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Make value_enclosing_type a function


fyi,
committed,
Andrew
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.

Index: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.27
diff -p -u -r1.27 c-valprint.c
--- c-valprint.c	29 Jan 2005 17:53:25 -0000	1.27
+++ c-valprint.c	2 Feb 2005 20:30:32 -0000
@@ -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
 			    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: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.23
diff -p -u -r1.23 gnu-v3-abi.c
--- gnu-v3-abi.c	12 Nov 2004 21:45:06 -0000	1.23
+++ gnu-v3-abi.c	2 Feb 2005 20:30:32 -0000
@@ -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: hpacc-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/hpacc-abi.c,v
retrieving revision 1.8
diff -p -u -r1.8 hpacc-abi.c
--- hpacc-abi.c	28 Jan 2005 06:16:49 -0000	1.8
+++ hpacc-abi.c	2 Feb 2005 20:30:32 -0000
@@ -206,7 +206,7 @@ hpacc_value_rtti_type (struct value *v, 
    * 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, 
           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: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.203
diff -p -u -r1.203 i386-tdep.c
--- i386-tdep.c	31 Oct 2004 19:52:46 -0000	1.203
+++ i386-tdep.c	2 Feb 2005 20:30:32 -0000
@@ -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 *gd
   /* 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: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.61
diff -p -u -r1.61 infcall.c
--- infcall.c	2 Feb 2005 00:20:03 -0000	1.61
+++ infcall.c	2 Feb 2005 20:30:32 -0000
@@ -571,7 +571,7 @@ You must use a pointer to function type 
 	      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: m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.96
diff -p -u -r1.96 m68k-tdep.c
--- m68k-tdep.c	29 Oct 2004 14:00:56 -0000	1.96
+++ m68k-tdep.c	2 Feb 2005 20:30:32 -0000
@@ -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 *gd
   /* 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: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.141
diff -p -u -r1.141 valops.c
--- valops.c	2 Feb 2005 00:20:05 -0000	1.141
+++ valops.c	2 Feb 2005 20:30:33 -0000
@@ -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, struc
     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, struc
   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 co
   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
     {
       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
   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, s
     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: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.7
diff -p -u -r1.7 value.c
--- value.c	2 Feb 2005 00:20:07 -0000	1.7
+++ value.c	2 Feb 2005 20:30:33 -0000
@@ -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 *va
   return value->aligner.contents;
 }
 
+struct type *
+value_enclosing_type (struct value *value)
+{
+  return value->enclosing_type;
+}
+
 
 /* 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 *mar
 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, i
 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 valu
       
       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 *arg
       /* 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: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.66
diff -p -u -r1.66 value.h
--- value.h	2 Feb 2005 00:20:07 -0000	1.66
+++ value.h	2 Feb 2005 20:30:33 -0000
@@ -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: vax-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/vax-tdep.c,v
retrieving revision 1.85
diff -p -u -r1.85 vax-tdep.c
--- vax-tdep.c	8 Aug 2004 10:38:29 -0000	1.85
+++ vax-tdep.c	2 Feb 2005 20:30:33 -0000
@@ -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 *re
   /* 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: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.85
diff -p -u -r1.85 xstormy16-tdep.c
--- xstormy16-tdep.c	15 Dec 2004 22:45:39 -0000	1.85
+++ xstormy16-tdep.c	2 Feb 2005 20:30:33 -0000
@@ -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 gdbarc
      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 gdbarc
      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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]