Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Convert VALUE_EMBEDDED_OFFSET to function
@ 2005-02-07 21:48 Andrew Cagney
  2005-02-08  2:02 ` Khem Raj
  2005-02-08  5:08 ` Khem Raj
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2005-02-07 21:48 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 18 bytes --]

committed,
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 14166 bytes --]


	* value.h (VALUE_EMBEDDED_OFFSET): Delete.
	(value_embedded_offset, set_value_embedded_offset): Declare.
	* value.c (value_embedded_offset): Define.
	(set_value_embedded_offset): Define.
	* valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
	* gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
	* cp-abi.h: Update.

Index: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.30
diff -p -u -r1.30 c-valprint.c
--- c-valprint.c	7 Feb 2005 00:09:53 -0000	1.30
+++ c-valprint.c	7 Feb 2005 17:03:27 -0000
@@ -598,7 +598,7 @@ c_value_print (struct value *val, struct
     }
 
   return val_print (type, value_contents_all (val),
-		    VALUE_EMBEDDED_OFFSET (val),
+		    value_embedded_offset (val),
 		    VALUE_ADDRESS (val) + value_offset (val),
 		    stream, format, 1, 0, pretty);
 }
Index: cp-abi.h
===================================================================
RCS file: /cvs/src/src/gdb/cp-abi.h,v
retrieving revision 1.7
diff -p -u -r1.7 cp-abi.h
--- cp-abi.h	28 Jan 2005 06:29:42 -0000	1.7
+++ cp-abi.h	7 Feb 2005 17:03:27 -0000
@@ -123,7 +123,7 @@ extern struct value *value_virtual_fn_fi
        of the complete object to the start of the embedded subobject
        VALUE represents.  In other words, the enclosing object starts
        at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
-       VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
+       value_embedded_offset (VALUE) + *TOP
      - If *USING_ENC is non-zero, then *TOP is the offset from the
        address of the complete object to the enclosing object stored
        in VALUE.  In other words, the enclosing object starts at
Index: cp-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-valprint.c,v
retrieving revision 1.32
diff -p -u -r1.32 cp-valprint.c
--- cp-valprint.c	7 Feb 2005 00:09:53 -0000	1.32
+++ cp-valprint.c	7 Feb 2005 17:03:27 -0000
@@ -665,12 +665,12 @@ cp_print_static_field (struct type *type
 
       CHECK_TYPEDEF (type);
       cp_print_value_fields (type, type, value_contents_all (val),
-			     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+			     value_embedded_offset (val), VALUE_ADDRESS (val),
 			     stream, format, recurse, pretty, NULL, 1);
       return;
     }
   val_print (type, value_contents_all (val), 
-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+	     value_embedded_offset (val), VALUE_ADDRESS (val),
 	     stream, format, 0, recurse, pretty);
 }
 
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.49
diff -p -u -r1.49 eval.c
--- eval.c	7 Feb 2005 00:09:53 -0000	1.49
+++ eval.c	7 Feb 2005 17:03:27 -0000
@@ -1148,7 +1148,7 @@ evaluate_subexp_standard (struct type *e
 		 reflect any ``this'' changes.  */
 	      arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
 					 VALUE_ADDRESS (temp) + value_offset (temp)
-					 + VALUE_EMBEDDED_OFFSET (temp));
+					 + value_embedded_offset (temp));
 	      argvec[1] = arg2;	/* the ``this'' pointer */
 	    }
 
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.24
diff -p -u -r1.24 gnu-v3-abi.c
--- gnu-v3-abi.c	2 Feb 2005 20:31:32 -0000	1.24
+++ gnu-v3-abi.c	7 Feb 2005 17:03:27 -0000
@@ -232,7 +232,7 @@ gnuv3_rtti_type (struct value *value,
   vtable_symbol
     = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
                                    + value_offset (vtable)
-                                   + VALUE_EMBEDDED_OFFSET (vtable));
+                                   + value_embedded_offset (vtable));
   if (! vtable_symbol)
     return NULL;
   
@@ -265,7 +265,7 @@ gnuv3_rtti_type (struct value *value,
     = value_as_long (value_field (vtable, vtable_field_offset_to_top));
 
   if (full_p)
-    *full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
+    *full_p = (- offset_to_top == value_embedded_offset (value)
                && (TYPE_LENGTH (value_enclosing_type (value))
                    >= TYPE_LENGTH (run_time_type)));
   if (top_p)
Index: hpacc-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/hpacc-abi.c,v
retrieving revision 1.11
diff -p -u -r1.11 hpacc-abi.c
--- hpacc-abi.c	7 Feb 2005 00:09:53 -0000	1.11
+++ hpacc-abi.c	7 Feb 2005 17:03:27 -0000
@@ -104,7 +104,7 @@ hpacc_virtual_fn_field (struct value **a
   /* pai: FIXME -- 32x64 possible problem? */
   /* First word (4 bytes) in object layout is the vtable pointer */
   coreptr = *(CORE_ADDR *) (value_contents (argp));	/* pai: (temp)  */
-  /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
+  /* + offset + value_embedded_offset (argp)); */
 
   if (!coreptr)
     error
@@ -223,7 +223,7 @@ hpacc_value_rtti_type (struct value *v, 
                             + value_offset (v)
                             + (using_enclosing
                                ? 0
-                               : VALUE_EMBEDDED_OFFSET (v)));
+                               : value_embedded_offset (v)));
   if (coreptr == 0)
     /* return silently -- maybe called on gdb-generated value */
     return NULL;
@@ -278,7 +278,7 @@ hpacc_value_rtti_type (struct value *v, 
        ||
        /* Or we checked on the embedded object and top offset was the
           same as the embedded offset */
-       ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
+       ((top_offset == value_embedded_offset (v)) &&
         !using_enclosing &&
         TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
 
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.31
diff -p -u -r1.31 p-valprint.c
--- p-valprint.c	7 Feb 2005 00:09:54 -0000	1.31
+++ p-valprint.c	7 Feb 2005 17:03:27 -0000
@@ -565,7 +565,7 @@ pascal_value_print (struct value *val, s
 	  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);
 }
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.146
diff -p -u -r1.146 valops.c
--- valops.c	7 Feb 2005 15:04:43 -0000	1.146
+++ valops.c	7 Feb 2005 17:03:28 -0000
@@ -398,7 +398,7 @@ value_cast (struct type *type, struct va
                       CORE_ADDR addr2 = value_as_address (arg2);
                       addr2 -= (VALUE_ADDRESS (v)
                                 + value_offset (v)
-                                + VALUE_EMBEDDED_OFFSET (v));
+                                + value_embedded_offset (v));
                       return value_from_pointer (type, addr2);
 		    }
 		}
@@ -544,7 +544,7 @@ value_assign (struct value *toval, struc
       set_internalvar (VALUE_INTERNALVAR (toval), fromval);
       val = value_copy (VALUE_INTERNALVAR (toval)->value);
       val = value_change_enclosing_type (val, value_enclosing_type (fromval));
-      VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
+      set_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
 	  TYPE_LENGTH (type));
   val->type = type;
   val = value_change_enclosing_type (val, value_enclosing_type (fromval));
-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
+  set_value_embedded_offset (val, value_embedded_offset (fromval));
   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
 
   return val;
@@ -868,13 +868,13 @@ value_addr (struct value *arg1)
   arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
 			     (VALUE_ADDRESS (arg1)
 			      + value_offset (arg1)
-			      + VALUE_EMBEDDED_OFFSET (arg1)));
+			      + value_embedded_offset (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)));
   /* ... and also the relative position of the subobject in the full object */
-  VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
+  VALUE_POINTED_TO_OFFSET (arg2) = value_embedded_offset (arg1);
   return arg2;
 }
 
@@ -914,7 +914,7 @@ value_ind (struct value *arg1)
       arg2->type = TYPE_TARGET_TYPE (base_type);
       /* Add embedding info */
       arg2 = value_change_enclosing_type (arg2, enc_type);
-      VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1);
+      set_value_embedded_offset (arg2, VALUE_POINTED_TO_OFFSET (arg1));
 
       /* We may be pointing to an object of some derived type */
       arg2 = value_full_object (arg2, NULL, 0, 0, 0);
@@ -1504,7 +1504,7 @@ search_struct_method (char *name, struct
 	      int skip;
 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
 				    value_contents_all (*arg1p),
-				    offset + VALUE_EMBEDDED_OFFSET (*arg1p),
+				    offset + value_embedded_offset (*arg1p),
 				    &base_offset, &skip);
 	      if (skip >= 0)
 		error ("Virtual base class offset not found in vtable");
@@ -1738,7 +1738,7 @@ find_method_list (struct value **argp, c
 	      int skip;
 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
 				    value_contents_all (*argp),
-				    offset + VALUE_EMBEDDED_OFFSET (*argp),
+				    offset + value_embedded_offset (*argp),
 				    &base_offset, &skip);
 	      if (skip >= 0)
 		error ("Virtual base class offset not found in vtable");
@@ -2624,9 +2624,11 @@ value_full_object (struct value *argp, s
      adjusting for the embedded offset of argp if that's what value_rtti_type
      used for its computation. */
   new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
-			   (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
+			   (using_enc ? 0 : value_embedded_offset (argp)));
   new_val->type = value_type (argp);
-  VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
+  set_value_embedded_offset (new_val, (using_enc
+				       ? top + value_embedded_offset (argp)
+				       : top));
   return new_val;
 }
 
Index: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.14
diff -p -u -r1.14 value.c
--- value.c	7 Feb 2005 15:04:43 -0000	1.14
+++ value.c	7 Feb 2005 17:03:29 -0000
@@ -97,7 +97,7 @@ allocate_value (struct type *type)
   VALUE_REGNUM (val) = -1;
   val->lazy = 0;
   val->optimized_out = 0;
-  VALUE_EMBEDDED_OFFSET (val) = 0;
+  val->embedded_offset = 0;
   VALUE_POINTED_TO_OFFSET (val) = 0;
   val->modifiable = 1;
   return val;
@@ -210,6 +210,18 @@ set_value_optimized_out (struct value *v
 {
   value->optimized_out = val;
 }
+
+int
+value_embedded_offset (struct value *value)
+{
+  return value->embedded_offset;
+}
+
+void
+set_value_embedded_offset (struct value *value, int val)
+{
+  value->embedded_offset = val;
+}
 \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
@@ -315,7 +327,7 @@ value_copy (struct value *arg)
   VALUE_REGNUM (val) = VALUE_REGNUM (arg);
   val->lazy = arg->lazy;
   val->optimized_out = arg->optimized_out;
-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
+  val->embedded_offset = value_embedded_offset (arg);
   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
   val->modifiable = arg->modifiable;
   if (!value_lazy (val))
@@ -1005,10 +1017,8 @@ value_primitive_field (struct value *arg
 	memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
 		TYPE_LENGTH (value_enclosing_type (arg1)));
       v->offset = value_offset (arg1);
-      VALUE_EMBEDDED_OFFSET (v)
-	= offset +
-	VALUE_EMBEDDED_OFFSET (arg1) +
-	TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
+      v->embedded_offset = (offset + value_embedded_offset (arg1)
+			    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8);
     }
   else
     {
@@ -1022,7 +1032,7 @@ value_primitive_field (struct value *arg
 		value_contents_raw (arg1) + offset,
 		TYPE_LENGTH (type));
       v->offset = (value_offset (arg1) + offset
-		   + VALUE_EMBEDDED_OFFSET (arg1));
+		   + value_embedded_offset (arg1));
     }
   VALUE_LVAL (v) = VALUE_LVAL (arg1);
   if (VALUE_LVAL (arg1) == lval_internalvar)
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.72
diff -p -u -r1.72 value.h
--- value.h	7 Feb 2005 15:04:43 -0000	1.72
+++ value.h	7 Feb 2005 17:03:29 -0000
@@ -215,7 +215,8 @@ extern int value_fetch_lazy (struct valu
 #define VALUE_REGNUM(val) (val)->regnum
 extern int value_optimized_out (struct value *value);
 extern void set_value_optimized_out (struct value *value, int val);
-#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
+extern int value_embedded_offset (struct value *value);
+extern void set_value_embedded_offset (struct value *value, int val);
 #define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
 
 /* Convert a REF to the object referenced.  */
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.74
diff -p -u -r1.74 mi-main.c
--- mi/mi-main.c	7 Feb 2005 00:09:56 -0000	1.74
+++ mi/mi-main.c	7 Feb 2005 17:03:29 -0000
@@ -680,7 +680,7 @@ mi_cmd_data_evaluate_expression (char *c
 
   /* Print the result of the expression evaluation. */
   val_print (value_type (val), value_contents (val),
-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+	     value_embedded_offset (val), VALUE_ADDRESS (val),
 	     stb->stream, 0, 0, 0, 0);
 
   ui_out_field_stream (uiout, "value", stb);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Convert VALUE_EMBEDDED_OFFSET to function
  2005-02-07 21:48 [commit] Convert VALUE_EMBEDDED_OFFSET to function Andrew Cagney
@ 2005-02-08  2:02 ` Khem Raj
  2005-02-08 21:03   ` Andrew Cagney
  2005-02-08  5:08 ` Khem Raj
  1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2005-02-08  2:02 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Hi Andrew

I am getting error building gdb and I think if following change should 
also be part of your changeset.

rdi-share/libangsd.a(hsys.o)(.text+0x29e): In function `HandleSysMessage':
../../../../src/gdb/rdi-share/hsys.c:830: warning: the use of `tmpnam' 
is dangerous, better use `mkstemp'
libgdb.a(gdbtk-cmds.o)(.text+0x25aa): In function `gdb_eval':
../../../src/gdb/gdbtk/generic/gdbtk-cmds.c:625: undefined reference to 
`VALUE_EMBEDDED_OFFSET'
libgdb.a(gdbtk-cmds.o)(.text+0x25b5):../../../src/gdb/gdbtk/generic/gdbtk-cmds.c:625: 
undefined reference to `VALUE_CONTENTS'
collect2: ld returned 1 exit status
make[1]: *** [gdb] Error 1


Thanks

-Khem

Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.86
diff -u -r1.86 gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c      18 Jan 2005 00:14:39 -0000      1.86
+++ gdb/gdbtk/generic/gdbtk-cmds.c      7 Feb 2005 21:53:37 -0000
@@ -622,8 +622,8 @@
   /* "Print" the result of the expression evaluation. */
   stb = mem_fileopen ();
   make_cleanup_ui_file_delete (stb);
-  val_print (value_type (val), VALUE_CONTENTS (val),
-            VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+  val_print (value_type (val), value_contents (val),
+            value_embedded_offset (val), VALUE_ADDRESS (val),
             stb, format, 0, 0, 0);
   result = ui_file_xstrdup (stb, &dummy);
   Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));


Andrew Cagney wrote:

> committed,
> Andrew
>
>------------------------------------------------------------------------
>
>
>	* value.h (VALUE_EMBEDDED_OFFSET): Delete.
>	(value_embedded_offset, set_value_embedded_offset): Declare.
>	* value.c (value_embedded_offset): Define.
>	(set_value_embedded_offset): Define.
>	* valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
>	* gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
>	* cp-abi.h: Update.
>
>Index: c-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/c-valprint.c,v
>retrieving revision 1.30
>diff -p -u -r1.30 c-valprint.c
>--- c-valprint.c	7 Feb 2005 00:09:53 -0000	1.30
>+++ c-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -598,7 +598,7 @@ c_value_print (struct value *val, struct
>     }
> 
>   return val_print (type, value_contents_all (val),
>-		    VALUE_EMBEDDED_OFFSET (val),
>+		    value_embedded_offset (val),
> 		    VALUE_ADDRESS (val) + value_offset (val),
> 		    stream, format, 1, 0, pretty);
> }
>Index: cp-abi.h
>===================================================================
>RCS file: /cvs/src/src/gdb/cp-abi.h,v
>retrieving revision 1.7
>diff -p -u -r1.7 cp-abi.h
>--- cp-abi.h	28 Jan 2005 06:29:42 -0000	1.7
>+++ cp-abi.h	7 Feb 2005 17:03:27 -0000
>@@ -123,7 +123,7 @@ extern struct value *value_virtual_fn_fi
>        of the complete object to the start of the embedded subobject
>        VALUE represents.  In other words, the enclosing object starts
>        at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
>-       VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
>+       value_embedded_offset (VALUE) + *TOP
>      - If *USING_ENC is non-zero, then *TOP is the offset from the
>        address of the complete object to the enclosing object stored
>        in VALUE.  In other words, the enclosing object starts at
>Index: cp-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/cp-valprint.c,v
>retrieving revision 1.32
>diff -p -u -r1.32 cp-valprint.c
>--- cp-valprint.c	7 Feb 2005 00:09:53 -0000	1.32
>+++ cp-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -665,12 +665,12 @@ cp_print_static_field (struct type *type
> 
>       CHECK_TYPEDEF (type);
>       cp_print_value_fields (type, type, value_contents_all (val),
>-			     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+			     value_embedded_offset (val), VALUE_ADDRESS (val),
> 			     stream, format, recurse, pretty, NULL, 1);
>       return;
>     }
>   val_print (type, value_contents_all (val), 
>-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+	     value_embedded_offset (val), VALUE_ADDRESS (val),
> 	     stream, format, 0, recurse, pretty);
> }
> 
>Index: eval.c
>===================================================================
>RCS file: /cvs/src/src/gdb/eval.c,v
>retrieving revision 1.49
>diff -p -u -r1.49 eval.c
>--- eval.c	7 Feb 2005 00:09:53 -0000	1.49
>+++ eval.c	7 Feb 2005 17:03:27 -0000
>@@ -1148,7 +1148,7 @@ evaluate_subexp_standard (struct type *e
> 		 reflect any ``this'' changes.  */
> 	      arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
> 					 VALUE_ADDRESS (temp) + value_offset (temp)
>-					 + VALUE_EMBEDDED_OFFSET (temp));
>+					 + value_embedded_offset (temp));
> 	      argvec[1] = arg2;	/* the ``this'' pointer */
> 	    }
> 
>Index: gnu-v3-abi.c
>===================================================================
>RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
>retrieving revision 1.24
>diff -p -u -r1.24 gnu-v3-abi.c
>--- gnu-v3-abi.c	2 Feb 2005 20:31:32 -0000	1.24
>+++ gnu-v3-abi.c	7 Feb 2005 17:03:27 -0000
>@@ -232,7 +232,7 @@ gnuv3_rtti_type (struct value *value,
>   vtable_symbol
>     = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
>                                    + value_offset (vtable)
>-                                   + VALUE_EMBEDDED_OFFSET (vtable));
>+                                   + value_embedded_offset (vtable));
>   if (! vtable_symbol)
>     return NULL;
>   
>@@ -265,7 +265,7 @@ gnuv3_rtti_type (struct value *value,
>     = value_as_long (value_field (vtable, vtable_field_offset_to_top));
> 
>   if (full_p)
>-    *full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
>+    *full_p = (- offset_to_top == value_embedded_offset (value)
>                && (TYPE_LENGTH (value_enclosing_type (value))
>                    >= TYPE_LENGTH (run_time_type)));
>   if (top_p)
>Index: hpacc-abi.c
>===================================================================
>RCS file: /cvs/src/src/gdb/hpacc-abi.c,v
>retrieving revision 1.11
>diff -p -u -r1.11 hpacc-abi.c
>--- hpacc-abi.c	7 Feb 2005 00:09:53 -0000	1.11
>+++ hpacc-abi.c	7 Feb 2005 17:03:27 -0000
>@@ -104,7 +104,7 @@ hpacc_virtual_fn_field (struct value **a
>   /* pai: FIXME -- 32x64 possible problem? */
>   /* First word (4 bytes) in object layout is the vtable pointer */
>   coreptr = *(CORE_ADDR *) (value_contents (argp));	/* pai: (temp)  */
>-  /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
>+  /* + offset + value_embedded_offset (argp)); */
> 
>   if (!coreptr)
>     error
>@@ -223,7 +223,7 @@ hpacc_value_rtti_type (struct value *v, 
>                             + value_offset (v)
>                             + (using_enclosing
>                                ? 0
>-                               : VALUE_EMBEDDED_OFFSET (v)));
>+                               : value_embedded_offset (v)));
>   if (coreptr == 0)
>     /* return silently -- maybe called on gdb-generated value */
>     return NULL;
>@@ -278,7 +278,7 @@ hpacc_value_rtti_type (struct value *v, 
>        ||
>        /* Or we checked on the embedded object and top offset was the
>           same as the embedded offset */
>-       ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
>+       ((top_offset == value_embedded_offset (v)) &&
>         !using_enclosing &&
>         TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
> 
>Index: p-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/p-valprint.c,v
>retrieving revision 1.31
>diff -p -u -r1.31 p-valprint.c
>--- p-valprint.c	7 Feb 2005 00:09:54 -0000	1.31
>+++ p-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -565,7 +565,7 @@ pascal_value_print (struct value *val, s
> 	  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);
> }
>Index: valops.c
>===================================================================
>RCS file: /cvs/src/src/gdb/valops.c,v
>retrieving revision 1.146
>diff -p -u -r1.146 valops.c
>--- valops.c	7 Feb 2005 15:04:43 -0000	1.146
>+++ valops.c	7 Feb 2005 17:03:28 -0000
>@@ -398,7 +398,7 @@ value_cast (struct type *type, struct va
>                       CORE_ADDR addr2 = value_as_address (arg2);
>                       addr2 -= (VALUE_ADDRESS (v)
>                                 + value_offset (v)
>-                                + VALUE_EMBEDDED_OFFSET (v));
>+                                + value_embedded_offset (v));
>                       return value_from_pointer (type, addr2);
> 		    }
> 		}
>@@ -544,7 +544,7 @@ value_assign (struct value *toval, struc
>       set_internalvar (VALUE_INTERNALVAR (toval), fromval);
>       val = value_copy (VALUE_INTERNALVAR (toval)->value);
>       val = value_change_enclosing_type (val, value_enclosing_type (fromval));
>-      VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
>+      set_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
> 	  TYPE_LENGTH (type));
>   val->type = type;
>   val = value_change_enclosing_type (val, value_enclosing_type (fromval));
>-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
>+  set_value_embedded_offset (val, value_embedded_offset (fromval));
>   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
> 
>   return val;
>@@ -868,13 +868,13 @@ value_addr (struct value *arg1)
>   arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
> 			     (VALUE_ADDRESS (arg1)
> 			      + value_offset (arg1)
>-			      + VALUE_EMBEDDED_OFFSET (arg1)));
>+			      + value_embedded_offset (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)));
>   /* ... and also the relative position of the subobject in the full object */
>-  VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
>+  VALUE_POINTED_TO_OFFSET (arg2) = value_embedded_offset (arg1);
>   return arg2;
> }
> 
>@@ -914,7 +914,7 @@ value_ind (struct value *arg1)
>       arg2->type = TYPE_TARGET_TYPE (base_type);
>       /* Add embedding info */
>       arg2 = value_change_enclosing_type (arg2, enc_type);
>-      VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1);
>+      set_value_embedded_offset (arg2, VALUE_POINTED_TO_OFFSET (arg1));
> 
>       /* We may be pointing to an object of some derived type */
>       arg2 = value_full_object (arg2, NULL, 0, 0, 0);
>@@ -1504,7 +1504,7 @@ search_struct_method (char *name, struct
> 	      int skip;
> 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
> 				    value_contents_all (*arg1p),
>-				    offset + VALUE_EMBEDDED_OFFSET (*arg1p),
>+				    offset + value_embedded_offset (*arg1p),
> 				    &base_offset, &skip);
> 	      if (skip >= 0)
> 		error ("Virtual base class offset not found in vtable");
>@@ -1738,7 +1738,7 @@ find_method_list (struct value **argp, c
> 	      int skip;
> 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
> 				    value_contents_all (*argp),
>-				    offset + VALUE_EMBEDDED_OFFSET (*argp),
>+				    offset + value_embedded_offset (*argp),
> 				    &base_offset, &skip);
> 	      if (skip >= 0)
> 		error ("Virtual base class offset not found in vtable");
>@@ -2624,9 +2624,11 @@ value_full_object (struct value *argp, s
>      adjusting for the embedded offset of argp if that's what value_rtti_type
>      used for its computation. */
>   new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
>-			   (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
>+			   (using_enc ? 0 : value_embedded_offset (argp)));
>   new_val->type = value_type (argp);
>-  VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
>+  set_value_embedded_offset (new_val, (using_enc
>+				       ? top + value_embedded_offset (argp)
>+				       : top));
>   return new_val;
> }
> 
>Index: value.c
>===================================================================
>RCS file: /cvs/src/src/gdb/value.c,v
>retrieving revision 1.14
>diff -p -u -r1.14 value.c
>--- value.c	7 Feb 2005 15:04:43 -0000	1.14
>+++ value.c	7 Feb 2005 17:03:29 -0000
>@@ -97,7 +97,7 @@ allocate_value (struct type *type)
>   VALUE_REGNUM (val) = -1;
>   val->lazy = 0;
>   val->optimized_out = 0;
>-  VALUE_EMBEDDED_OFFSET (val) = 0;
>+  val->embedded_offset = 0;
>   VALUE_POINTED_TO_OFFSET (val) = 0;
>   val->modifiable = 1;
>   return val;
>@@ -210,6 +210,18 @@ set_value_optimized_out (struct value *v
> {
>   value->optimized_out = val;
> }
>+
>+int
>+value_embedded_offset (struct value *value)
>+{
>+  return value->embedded_offset;
>+}
>+
>+void
>+set_value_embedded_offset (struct value *value, int val)
>+{
>+  value->embedded_offset = val;
>+}
> \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
>@@ -315,7 +327,7 @@ value_copy (struct value *arg)
>   VALUE_REGNUM (val) = VALUE_REGNUM (arg);
>   val->lazy = arg->lazy;
>   val->optimized_out = arg->optimized_out;
>-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
>+  val->embedded_offset = value_embedded_offset (arg);
>   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
>   val->modifiable = arg->modifiable;
>   if (!value_lazy (val))
>@@ -1005,10 +1017,8 @@ value_primitive_field (struct value *arg
> 	memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
> 		TYPE_LENGTH (value_enclosing_type (arg1)));
>       v->offset = value_offset (arg1);
>-      VALUE_EMBEDDED_OFFSET (v)
>-	= offset +
>-	VALUE_EMBEDDED_OFFSET (arg1) +
>-	TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
>+      v->embedded_offset = (offset + value_embedded_offset (arg1)
>+			    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8);
>     }
>   else
>     {
>@@ -1022,7 +1032,7 @@ value_primitive_field (struct value *arg
> 		value_contents_raw (arg1) + offset,
> 		TYPE_LENGTH (type));
>       v->offset = (value_offset (arg1) + offset
>-		   + VALUE_EMBEDDED_OFFSET (arg1));
>+		   + value_embedded_offset (arg1));
>     }
>   VALUE_LVAL (v) = VALUE_LVAL (arg1);
>   if (VALUE_LVAL (arg1) == lval_internalvar)
>Index: value.h
>===================================================================
>RCS file: /cvs/src/src/gdb/value.h,v
>retrieving revision 1.72
>diff -p -u -r1.72 value.h
>--- value.h	7 Feb 2005 15:04:43 -0000	1.72
>+++ value.h	7 Feb 2005 17:03:29 -0000
>@@ -215,7 +215,8 @@ extern int value_fetch_lazy (struct valu
> #define VALUE_REGNUM(val) (val)->regnum
> extern int value_optimized_out (struct value *value);
> extern void set_value_optimized_out (struct value *value, int val);
>-#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
>+extern int value_embedded_offset (struct value *value);
>+extern void set_value_embedded_offset (struct value *value, int val);
> #define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
> 
> /* Convert a REF to the object referenced.  */
>Index: mi/mi-main.c
>===================================================================
>RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
>retrieving revision 1.74
>diff -p -u -r1.74 mi-main.c
>--- mi/mi-main.c	7 Feb 2005 00:09:56 -0000	1.74
>+++ mi/mi-main.c	7 Feb 2005 17:03:29 -0000
>@@ -680,7 +680,7 @@ mi_cmd_data_evaluate_expression (char *c
> 
>   /* Print the result of the expression evaluation. */
>   val_print (value_type (val), value_contents (val),
>-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+	     value_embedded_offset (val), VALUE_ADDRESS (val),
> 	     stb->stream, 0, 0, 0, 0);
> 
>   ui_out_field_stream (uiout, "value", stb);
>  
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Convert VALUE_EMBEDDED_OFFSET to function
  2005-02-07 21:48 [commit] Convert VALUE_EMBEDDED_OFFSET to function Andrew Cagney
  2005-02-08  2:02 ` Khem Raj
@ 2005-02-08  5:08 ` Khem Raj
  1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2005-02-08  5:08 UTC (permalink / raw)
  To: cagney, gdb-patches

Hi Andrew

I am getting error building gdb and I think if following change should 
also be part of your changeset.

rdi-share/libangsd.a(hsys.o)(.text+0x29e): In function `HandleSysMessage':
../../../../src/gdb/rdi-share/hsys.c:830: warning: the use of `tmpnam' 
is dangerous, better use `mkstemp'
libgdb.a(gdbtk-cmds.o)(.text+0x25aa): In function `gdb_eval':
../../../src/gdb/gdbtk/generic/gdbtk-cmds.c:625: undefined reference to 
`VALUE_EMBEDDED_OFFSET'
libgdb.a(gdbtk-cmds.o)(.text+0x25b5):../../../src/gdb/gdbtk/generic/gdbtk-cmds.c:625: 
undefined reference to `VALUE_CONTENTS'
collect2: ld returned 1 exit status
make[1]: *** [gdb] Error 1


Thanks

-Khem

Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.86
diff -u -r1.86 gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c      18 Jan 2005 00:14:39 -0000      
1.86
+++ gdb/gdbtk/generic/gdbtk-cmds.c      7 Feb 2005 21:53:37 -0000
@@ -622,8 +622,8 @@
  /* "Print" the result of the expression evaluation. */
  stb = mem_fileopen ();
  make_cleanup_ui_file_delete (stb);
-  val_print (value_type (val), VALUE_CONTENTS (val),
-            VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+  val_print (value_type (val), value_contents (val),
+            value_embedded_offset (val), VALUE_ADDRESS (val),
            stb, format, 0, 0, 0);
  result = ui_file_xstrdup (stb, &dummy);
  Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));


Andrew Cagney wrote:

> committed,
> Andrew
>
>------------------------------------------------------------------------
>
>
>	* value.h (VALUE_EMBEDDED_OFFSET): Delete.
>	(value_embedded_offset, set_value_embedded_offset): Declare.
>	* value.c (value_embedded_offset): Define.
>	(set_value_embedded_offset): Define.
>	* valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
>	* gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
>	* cp-abi.h: Update.
>
>Index: c-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/c-valprint.c,v
>retrieving revision 1.30
>diff -p -u -r1.30 c-valprint.c
>--- c-valprint.c	7 Feb 2005 00:09:53 -0000	1.30
>+++ c-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -598,7 +598,7 @@ c_value_print (struct value *val, struct
>     }
> 
>   return val_print (type, value_contents_all (val),
>-		    VALUE_EMBEDDED_OFFSET (val),
>+		    value_embedded_offset (val),
> 		    VALUE_ADDRESS (val) + value_offset (val),
> 		    stream, format, 1, 0, pretty);
> }
>Index: cp-abi.h
>===================================================================
>RCS file: /cvs/src/src/gdb/cp-abi.h,v
>retrieving revision 1.7
>diff -p -u -r1.7 cp-abi.h
>--- cp-abi.h	28 Jan 2005 06:29:42 -0000	1.7
>+++ cp-abi.h	7 Feb 2005 17:03:27 -0000
>@@ -123,7 +123,7 @@ extern struct value *value_virtual_fn_fi
>        of the complete object to the start of the embedded subobject
>        VALUE represents.  In other words, the enclosing object starts
>        at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
>-       VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
>+       value_embedded_offset (VALUE) + *TOP
>      - If *USING_ENC is non-zero, then *TOP is the offset from the
>        address of the complete object to the enclosing object stored
>        in VALUE.  In other words, the enclosing object starts at
>Index: cp-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/cp-valprint.c,v
>retrieving revision 1.32
>diff -p -u -r1.32 cp-valprint.c
>--- cp-valprint.c	7 Feb 2005 00:09:53 -0000	1.32
>+++ cp-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -665,12 +665,12 @@ cp_print_static_field (struct type *type
> 
>       CHECK_TYPEDEF (type);
>       cp_print_value_fields (type, type, value_contents_all (val),
>-			     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+			     value_embedded_offset (val), VALUE_ADDRESS (val),
> 			     stream, format, recurse, pretty, NULL, 1);
>       return;
>     }
>   val_print (type, value_contents_all (val), 
>-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+	     value_embedded_offset (val), VALUE_ADDRESS (val),
> 	     stream, format, 0, recurse, pretty);
> }
> 
>Index: eval.c
>===================================================================
>RCS file: /cvs/src/src/gdb/eval.c,v
>retrieving revision 1.49
>diff -p -u -r1.49 eval.c
>--- eval.c	7 Feb 2005 00:09:53 -0000	1.49
>+++ eval.c	7 Feb 2005 17:03:27 -0000
>@@ -1148,7 +1148,7 @@ evaluate_subexp_standard (struct type *e
> 		 reflect any ``this'' changes.  */
> 	      arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
> 					 VALUE_ADDRESS (temp) + value_offset (temp)
>-					 + VALUE_EMBEDDED_OFFSET (temp));
>+					 + value_embedded_offset (temp));
> 	      argvec[1] = arg2;	/* the ``this'' pointer */
> 	    }
> 
>Index: gnu-v3-abi.c
>===================================================================
>RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
>retrieving revision 1.24
>diff -p -u -r1.24 gnu-v3-abi.c
>--- gnu-v3-abi.c	2 Feb 2005 20:31:32 -0000	1.24
>+++ gnu-v3-abi.c	7 Feb 2005 17:03:27 -0000
>@@ -232,7 +232,7 @@ gnuv3_rtti_type (struct value *value,
>   vtable_symbol
>     = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
>                                    + value_offset (vtable)
>-                                   + VALUE_EMBEDDED_OFFSET (vtable));
>+                                   + value_embedded_offset (vtable));
>   if (! vtable_symbol)
>     return NULL;
>   
>@@ -265,7 +265,7 @@ gnuv3_rtti_type (struct value *value,
>     = value_as_long (value_field (vtable, vtable_field_offset_to_top));
> 
>   if (full_p)
>-    *full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
>+    *full_p = (- offset_to_top == value_embedded_offset (value)
>                && (TYPE_LENGTH (value_enclosing_type (value))
>                    >= TYPE_LENGTH (run_time_type)));
>   if (top_p)
>Index: hpacc-abi.c
>===================================================================
>RCS file: /cvs/src/src/gdb/hpacc-abi.c,v
>retrieving revision 1.11
>diff -p -u -r1.11 hpacc-abi.c
>--- hpacc-abi.c	7 Feb 2005 00:09:53 -0000	1.11
>+++ hpacc-abi.c	7 Feb 2005 17:03:27 -0000
>@@ -104,7 +104,7 @@ hpacc_virtual_fn_field (struct value **a
>   /* pai: FIXME -- 32x64 possible problem? */
>   /* First word (4 bytes) in object layout is the vtable pointer */
>   coreptr = *(CORE_ADDR *) (value_contents (argp));	/* pai: (temp)  */
>-  /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
>+  /* + offset + value_embedded_offset (argp)); */
> 
>   if (!coreptr)
>     error
>@@ -223,7 +223,7 @@ hpacc_value_rtti_type (struct value *v, 
>                             + value_offset (v)
>                             + (using_enclosing
>                                ? 0
>-                               : VALUE_EMBEDDED_OFFSET (v)));
>+                               : value_embedded_offset (v)));
>   if (coreptr == 0)
>     /* return silently -- maybe called on gdb-generated value */
>     return NULL;
>@@ -278,7 +278,7 @@ hpacc_value_rtti_type (struct value *v, 
>        ||
>        /* Or we checked on the embedded object and top offset was the
>           same as the embedded offset */
>-       ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
>+       ((top_offset == value_embedded_offset (v)) &&
>         !using_enclosing &&
>         TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
> 
>Index: p-valprint.c
>===================================================================
>RCS file: /cvs/src/src/gdb/p-valprint.c,v
>retrieving revision 1.31
>diff -p -u -r1.31 p-valprint.c
>--- p-valprint.c	7 Feb 2005 00:09:54 -0000	1.31
>+++ p-valprint.c	7 Feb 2005 17:03:27 -0000
>@@ -565,7 +565,7 @@ pascal_value_print (struct value *val, s
> 	  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);
> }
>Index: valops.c
>===================================================================
>RCS file: /cvs/src/src/gdb/valops.c,v
>retrieving revision 1.146
>diff -p -u -r1.146 valops.c
>--- valops.c	7 Feb 2005 15:04:43 -0000	1.146
>+++ valops.c	7 Feb 2005 17:03:28 -0000
>@@ -398,7 +398,7 @@ value_cast (struct type *type, struct va
>                       CORE_ADDR addr2 = value_as_address (arg2);
>                       addr2 -= (VALUE_ADDRESS (v)
>                                 + value_offset (v)
>-                                + VALUE_EMBEDDED_OFFSET (v));
>+                                + value_embedded_offset (v));
>                       return value_from_pointer (type, addr2);
> 		    }
> 		}
>@@ -544,7 +544,7 @@ value_assign (struct value *toval, struc
>       set_internalvar (VALUE_INTERNALVAR (toval), fromval);
>       val = value_copy (VALUE_INTERNALVAR (toval)->value);
>       val = value_change_enclosing_type (val, value_enclosing_type (fromval));
>-      VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
>+      set_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
> 	  TYPE_LENGTH (type));
>   val->type = type;
>   val = value_change_enclosing_type (val, value_enclosing_type (fromval));
>-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
>+  set_value_embedded_offset (val, value_embedded_offset (fromval));
>   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
> 
>   return val;
>@@ -868,13 +868,13 @@ value_addr (struct value *arg1)
>   arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
> 			     (VALUE_ADDRESS (arg1)
> 			      + value_offset (arg1)
>-			      + VALUE_EMBEDDED_OFFSET (arg1)));
>+			      + value_embedded_offset (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)));
>   /* ... and also the relative position of the subobject in the full object */
>-  VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
>+  VALUE_POINTED_TO_OFFSET (arg2) = value_embedded_offset (arg1);
>   return arg2;
> }
> 
>@@ -914,7 +914,7 @@ value_ind (struct value *arg1)
>       arg2->type = TYPE_TARGET_TYPE (base_type);
>       /* Add embedding info */
>       arg2 = value_change_enclosing_type (arg2, enc_type);
>-      VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1);
>+      set_value_embedded_offset (arg2, VALUE_POINTED_TO_OFFSET (arg1));
> 
>       /* We may be pointing to an object of some derived type */
>       arg2 = value_full_object (arg2, NULL, 0, 0, 0);
>@@ -1504,7 +1504,7 @@ search_struct_method (char *name, struct
> 	      int skip;
> 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
> 				    value_contents_all (*arg1p),
>-				    offset + VALUE_EMBEDDED_OFFSET (*arg1p),
>+				    offset + value_embedded_offset (*arg1p),
> 				    &base_offset, &skip);
> 	      if (skip >= 0)
> 		error ("Virtual base class offset not found in vtable");
>@@ -1738,7 +1738,7 @@ find_method_list (struct value **argp, c
> 	      int skip;
> 	      find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
> 				    value_contents_all (*argp),
>-				    offset + VALUE_EMBEDDED_OFFSET (*argp),
>+				    offset + value_embedded_offset (*argp),
> 				    &base_offset, &skip);
> 	      if (skip >= 0)
> 		error ("Virtual base class offset not found in vtable");
>@@ -2624,9 +2624,11 @@ value_full_object (struct value *argp, s
>      adjusting for the embedded offset of argp if that's what value_rtti_type
>      used for its computation. */
>   new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
>-			   (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
>+			   (using_enc ? 0 : value_embedded_offset (argp)));
>   new_val->type = value_type (argp);
>-  VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
>+  set_value_embedded_offset (new_val, (using_enc
>+				       ? top + value_embedded_offset (argp)
>+				       : top));
>   return new_val;
> }
> 
>Index: value.c
>===================================================================
>RCS file: /cvs/src/src/gdb/value.c,v
>retrieving revision 1.14
>diff -p -u -r1.14 value.c
>--- value.c	7 Feb 2005 15:04:43 -0000	1.14
>+++ value.c	7 Feb 2005 17:03:29 -0000
>@@ -97,7 +97,7 @@ allocate_value (struct type *type)
>   VALUE_REGNUM (val) = -1;
>   val->lazy = 0;
>   val->optimized_out = 0;
>-  VALUE_EMBEDDED_OFFSET (val) = 0;
>+  val->embedded_offset = 0;
>   VALUE_POINTED_TO_OFFSET (val) = 0;
>   val->modifiable = 1;
>   return val;
>@@ -210,6 +210,18 @@ set_value_optimized_out (struct value *v
> {
>   value->optimized_out = val;
> }
>+
>+int
>+value_embedded_offset (struct value *value)
>+{
>+  return value->embedded_offset;
>+}
>+
>+void
>+set_value_embedded_offset (struct value *value, int val)
>+{
>+  value->embedded_offset = val;
>+}
> \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
>@@ -315,7 +327,7 @@ value_copy (struct value *arg)
>   VALUE_REGNUM (val) = VALUE_REGNUM (arg);
>   val->lazy = arg->lazy;
>   val->optimized_out = arg->optimized_out;
>-  VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
>+  val->embedded_offset = value_embedded_offset (arg);
>   VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
>   val->modifiable = arg->modifiable;
>   if (!value_lazy (val))
>@@ -1005,10 +1017,8 @@ value_primitive_field (struct value *arg
> 	memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
> 		TYPE_LENGTH (value_enclosing_type (arg1)));
>       v->offset = value_offset (arg1);
>-      VALUE_EMBEDDED_OFFSET (v)
>-	= offset +
>-	VALUE_EMBEDDED_OFFSET (arg1) +
>-	TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
>+      v->embedded_offset = (offset + value_embedded_offset (arg1)
>+			    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8);
>     }
>   else
>     {
>@@ -1022,7 +1032,7 @@ value_primitive_field (struct value *arg
> 		value_contents_raw (arg1) + offset,
> 		TYPE_LENGTH (type));
>       v->offset = (value_offset (arg1) + offset
>-		   + VALUE_EMBEDDED_OFFSET (arg1));
>+		   + value_embedded_offset (arg1));
>     }
>   VALUE_LVAL (v) = VALUE_LVAL (arg1);
>   if (VALUE_LVAL (arg1) == lval_internalvar)
>Index: value.h
>===================================================================
>RCS file: /cvs/src/src/gdb/value.h,v
>retrieving revision 1.72
>diff -p -u -r1.72 value.h
>--- value.h	7 Feb 2005 15:04:43 -0000	1.72
>+++ value.h	7 Feb 2005 17:03:29 -0000
>@@ -215,7 +215,8 @@ extern int value_fetch_lazy (struct valu
> #define VALUE_REGNUM(val) (val)->regnum
> extern int value_optimized_out (struct value *value);
> extern void set_value_optimized_out (struct value *value, int val);
>-#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
>+extern int value_embedded_offset (struct value *value);
>+extern void set_value_embedded_offset (struct value *value, int val);
> #define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
> 
> /* Convert a REF to the object referenced.  */
>Index: mi/mi-main.c
>===================================================================
>RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
>retrieving revision 1.74
>diff -p -u -r1.74 mi-main.c
>--- mi/mi-main.c	7 Feb 2005 00:09:56 -0000	1.74
>+++ mi/mi-main.c	7 Feb 2005 17:03:29 -0000
>@@ -680,7 +680,7 @@ mi_cmd_data_evaluate_expression (char *c
> 
>   /* Print the result of the expression evaluation. */
>   val_print (value_type (val), value_contents (val),
>-	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
>+	     value_embedded_offset (val), VALUE_ADDRESS (val),
> 	     stb->stream, 0, 0, 0, 0);
> 
>   ui_out_field_stream (uiout, "value", stb);
>  
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Convert VALUE_EMBEDDED_OFFSET to function
  2005-02-08  2:02 ` Khem Raj
@ 2005-02-08 21:03   ` Andrew Cagney
  2005-02-08 22:33     ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2005-02-08 21:03 UTC (permalink / raw)
  To: kraj; +Cc: gdb-patches

Khem Raj wrote:
> Hi Andrew
> 
> I am getting error building gdb and I think if following change should 
> also be part of your changeset.

GDB builds.

It looks like you've done something like "cvs update -d" which picks up 
some extra directories.  I'd make a clean-sweep of things and try again 
with a clean checkout.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Convert VALUE_EMBEDDED_OFFSET to function
  2005-02-08 21:03   ` Andrew Cagney
@ 2005-02-08 22:33     ` Khem Raj
  0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2005-02-08 22:33 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Hi Andrew,

I did a fresh checkout  now I am getting an error at  different place  
during make install.

Thanks
Khem
 
makeinfo --split-size=5000000 -I 
../../../../src/gdb/doc/../../readline/doc -I 
../../../../src/gdb/doc/../mi -I ../../../../src/gdb/doc \
        -o gdb.info ../../../../src/gdb/doc/gdb.texinfo
../../../../src/gdb/doc/gdb.texinfo:7035: warning: @strong{Note:} 
produces a spurious cross-reference in Info; reword to avoid that.
../../../../src/gdb/doc/gdb.texinfo:21102: @dots expected braces.
../../../../src/gdb/doc/gdb.texinfo:21102: @- missing close brace.
makeinfo: Removing output file `gdb.info' due to errors; use --force to 
preserve.
make[3]: *** [gdb.info] Error 1
make[3]: Leaving directory `/root/sourceware/objdir/gdb-obj/gdb/doc'


Andrew Cagney wrote:

> Khem Raj wrote:
>
>> Hi Andrew
>>
>> I am getting error building gdb and I think if following change 
>> should also be part of your changeset.
>
>
> GDB builds.
>
> It looks like you've done something like "cvs update -d" which picks 
> up some extra directories.  I'd make a clean-sweep of things and try 
> again with a clean checkout.
>
> Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-02-08  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-07 21:48 [commit] Convert VALUE_EMBEDDED_OFFSET to function Andrew Cagney
2005-02-08  2:02 ` Khem Raj
2005-02-08 21:03   ` Andrew Cagney
2005-02-08 22:33     ` Khem Raj
2005-02-08  5:08 ` Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox