public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 13/47] Turn some value offset functions into method
Date: Thu, 09 Feb 2023 14:38:34 -0700	[thread overview]
Message-ID: <20230209-submit-value-fixups-2023-v1-13-55dc2794dbb9@tromey.com> (raw)
In-Reply-To: <20230209-submit-value-fixups-2023-v1-0-55dc2794dbb9@tromey.com>

This changes various offset-related functions to be methods of value.
Much of this patch was written by script.
---
 gdb/ada-valprint.c    |  4 ++--
 gdb/cp-abi.h          |  2 +-
 gdb/cp-valprint.c     |  6 +++---
 gdb/d-valprint.c      |  2 +-
 gdb/dwarf2/expr.c     |  2 +-
 gdb/eval.c            |  2 +-
 gdb/gdbtypes.c        |  2 +-
 gdb/gnu-v3-abi.c      | 20 +++++++++---------
 gdb/go-valprint.c     |  2 +-
 gdb/mi/mi-cmd-stack.c |  2 +-
 gdb/valops.c          | 40 +++++++++++++++++------------------
 gdb/value.c           | 58 +++++++++++++++------------------------------------
 gdb/value.h           | 18 +++++++++++-----
 13 files changed, 72 insertions(+), 88 deletions(-)

diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 761d3150937..c1004b5f33c 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -199,8 +199,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 	  if (check_typedef (v0->type ())->length ()
 	      != check_typedef (v1->type ())->length ())
 	    break;
-	  if (!value_contents_eq (v0, value_embedded_offset (v0),
-				  v1, value_embedded_offset (v1),
+	  if (!value_contents_eq (v0, v0->embedded_offset (),
+				  v1, v1->embedded_offset (),
 				  check_typedef (v0->type ())->length ()))
 	    break;
 	}
diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h
index f7c903eca2d..aade336c3cd 100644
--- a/gdb/cp-abi.h
+++ b/gdb/cp-abi.h
@@ -124,7 +124,7 @@ extern struct value *value_virtual_fn_field (struct value **valuep,
        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_embedded_offset (VALUE) + *TOP
+       VALUE->embedded_offset () + *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
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 476ec9c1b1e..634f5a94cee 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -282,7 +282,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 		  opts->deref_ref = false;
 
 		  v = value_field_bitfield (type, i, valaddr,
-					    value_embedded_offset (val), val);
+					    val->embedded_offset (), val);
 
 		  common_val_print (v, stream, recurse + 1,
 				    opts, current_language);
@@ -321,7 +321,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 		    {
 		      CORE_ADDR addr;
 
-		      i_offset += value_embedded_offset (val);
+		      i_offset += val->embedded_offset ();
 		      addr = extract_typed_address (valaddr + i_offset, i_type);
 		      print_function_pointer_address (opts,
 						      type->arch (),
@@ -432,7 +432,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
       try
 	{
 	  boffset = baseclass_offset (type, i, valaddr,
-				      value_embedded_offset (val),
+				      val->embedded_offset (),
 				      address, val);
 	}
       catch (const gdb_exception_error &ex)
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 6c7748efa4c..bebe02c967c 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -81,7 +81,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
   switch (type->code ())
     {
       case TYPE_CODE_STRUCT:
-	ret = dynamic_array_type (type, value_embedded_offset (val),
+	ret = dynamic_array_type (type, val->embedded_offset (),
 				  value_address (val),
 				  stream, recurse, val, options);
 	if (ret == 0)
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index ccce09350d2..0274372a0c4 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -576,7 +576,7 @@ coerce_pieced_ref (const value *value)
 {
   struct type *type = check_typedef (value->type ());
 
-  if (value_bits_synthetic_pointer (value, value_embedded_offset (value),
+  if (value_bits_synthetic_pointer (value, value->embedded_offset (),
 				    TARGET_CHAR_BIT * type->length ()))
     {
       const piece_closure *closure
diff --git a/gdb/eval.c b/gdb/eval.c
index 6fa359966ec..87147593ed9 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -965,7 +965,7 @@ structop_base_operation::evaluate_funcall
 	 ``this'' changes.  */
       vals[0] = value_from_longest (lookup_pointer_type (temp->type ()),
 				    value_address (temp)
-				    + value_embedded_offset (temp));
+				    + temp->embedded_offset ());
     }
 
   /* Take out `this' if needed.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b14f051c013..75a567dd3f6 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4008,7 +4008,7 @@ is_unique_ancestor (struct type *base, struct value *val)
 
   return is_unique_ancestor_worker (base, val->type (), &offset,
 				    value_contents_for_printing (val).data (),
-				    value_embedded_offset (val),
+				    val->embedded_offset (),
 				    value_address (val), val) == 1;
 }
 
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 782f5765d6f..36d54b9312b 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -326,7 +326,7 @@ gnuv3_rtti_type (struct value *value,
   /* Find the linker symbol for this vtable.  */
   vtable_symbol
     = lookup_minimal_symbol_by_pc (value_address (vtable)
-				   + value_embedded_offset (vtable)).minsym;
+				   + vtable->embedded_offset ()).minsym;
   if (! vtable_symbol)
     return NULL;
   
@@ -371,7 +371,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->enclosing_type ()->length ()
 		   >= run_time_type->length ()));
   if (top_p)
@@ -804,7 +804,7 @@ hash_value_and_voffset (const void *p)
 {
   const struct value_and_voffset *o = (const struct value_and_voffset *) p;
 
-  return value_address (o->value) + value_embedded_offset (o->value);
+  return value_address (o->value) + o->value->embedded_offset ();
 }
 
 /* Equality function for value_and_voffset.  */
@@ -815,8 +815,8 @@ eq_value_and_voffset (const void *a, const void *b)
   const struct value_and_voffset *ova = (const struct value_and_voffset *) a;
   const struct value_and_voffset *ovb = (const struct value_and_voffset *) b;
 
-  return (value_address (ova->value) + value_embedded_offset (ova->value)
-	  == value_address (ovb->value) + value_embedded_offset (ovb->value));
+  return (value_address (ova->value) + ova->value->embedded_offset ()
+	  == value_address (ovb->value) + ovb->value->embedded_offset ());
 }
 
 /* Comparison function for value_and_voffset.  */
@@ -826,9 +826,9 @@ compare_value_and_voffset (const struct value_and_voffset *va,
 			   const struct value_and_voffset *vb)
 {
   CORE_ADDR addra = (value_address (va->value)
-		     + value_embedded_offset (va->value));
+		     + va->value->embedded_offset ());
   CORE_ADDR addrb = (value_address (vb->value)
-		     + value_embedded_offset (vb->value));
+		     + vb->value->embedded_offset ());
 
   return addra < addrb;
 }
@@ -908,7 +908,7 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
 
   vtable = gnuv3_get_vtable (gdbarch, type,
 			     value_address (value)
-			     + value_embedded_offset (value));
+			     + value->embedded_offset ());
   vt_addr = value_address (value_field (vtable,
 					vtable_field_virtual_functions));
 
@@ -916,7 +916,7 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
 	      TYPE_SAFE_NAME (type),
 	      paddress (gdbarch, vt_addr),
 	      paddress (gdbarch, (value_address (value)
-				  + value_embedded_offset (value))));
+				  + value->embedded_offset ())));
 
   for (i = 0; i <= max_voffset; ++i)
     {
@@ -1138,7 +1138,7 @@ gnuv3_get_typeid (struct value *value)
       && gnuv3_dynamic_class (type))
     {
       struct value *vtable, *typeinfo_value;
-      CORE_ADDR address = value_address (value) + value_embedded_offset (value);
+      CORE_ADDR address = value_address (value) + value->embedded_offset ();
 
       vtable = gnuv3_get_vtable (gdbarch, type, address);
       if (vtable == NULL)
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 4d3185ed7d2..dce7bd684b4 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -104,7 +104,7 @@ go_language::value_print_inner (struct value *val, struct ui_file *stream,
 	    case GO_TYPE_STRING:
 	      if (! options->raw)
 		{
-		  print_go_string (type, value_embedded_offset (val),
+		  print_go_string (type, val->embedded_offset (),
 				   value_address (val),
 				   stream, recurse, val, options);
 		  return;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 0ac4d6a63cc..abe0d34f042 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -507,7 +507,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	     to its representation.  */
 	  || (val_print_scalar_type_p (arg->val->type ())
 	      && !value_bytes_available (arg->val,
-					 value_embedded_offset (arg->val),
+					 arg->val->embedded_offset (),
 					 arg->val->type ()->length ()))))
     return;
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 9fbcf1740d5..e4e8ff8d876 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -275,9 +275,9 @@ value_cast_structs (struct type *type, struct value *v2)
       if (v)
 	{
 	  /* Downcasting is possible (t1 is superclass of v2).  */
-	  CORE_ADDR addr2 = value_address (v2) + value_embedded_offset (v2);
+	  CORE_ADDR addr2 = value_address (v2) + v2->embedded_offset ();
 
-	  addr2 -= value_address (v) + value_embedded_offset (v);
+	  addr2 -= value_address (v) + v->embedded_offset ();
 	  return value_at (type, addr2);
 	}
     }
@@ -328,7 +328,7 @@ value_cast_pointers (struct type *type, struct value *arg2,
   arg2 = value_copy (arg2);
   arg2->deprecated_set_type (type);
   arg2->set_enclosing_type (type);
-  set_value_pointed_to_offset (arg2, 0);	/* pai: chk_val */
+  arg2->set_pointed_to_offset (0);	/* pai: chk_val */
   return arg2;
 }
 
@@ -650,7 +650,7 @@ value_cast (struct type *type, struct value *arg2)
       arg2 = value_copy (arg2);
       arg2->deprecated_set_type (to_type);
       arg2->set_enclosing_type (to_type);
-      set_value_pointed_to_offset (arg2, 0);	/* pai: chk_val */
+      arg2->set_pointed_to_offset (0);	/* pai: chk_val */
       return arg2;
     }
   else if (VALUE_LVAL (arg2) == lval_memory)
@@ -884,7 +884,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
   else if (using_enc)
     addr += top;
   else
-    addr += top + value_embedded_offset (arg);
+    addr += top + arg->embedded_offset ();
 
   /* dynamic_cast<void *> means to return a pointer to the
      most-derived object.  */
@@ -903,7 +903,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
       result = NULL;
       if (dynamic_cast_check_1 (resolved_type->target_type (),
 				value_contents_for_printing (tem).data (),
-				value_embedded_offset (tem),
+				tem->embedded_offset (),
 				value_address (tem), tem,
 				rtti_type, addr,
 				arg_type,
@@ -919,7 +919,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
   if (is_public_ancestor (arg_type, rtti_type)
       && dynamic_cast_check_2 (resolved_type->target_type (),
 			       value_contents_for_printing (tem).data (),
-			       value_embedded_offset (tem),
+			       tem->embedded_offset (),
 			       value_address (tem), tem,
 			       rtti_type, &result) == 1)
     return value_cast (type,
@@ -1353,7 +1353,7 @@ value_assign (struct value *toval, struct value *fromval)
   if (type->code () == TYPE_CODE_PTR)
     {
       val->set_enclosing_type (fromval->enclosing_type ());
-      set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
+      val->set_pointed_to_offset (fromval->pointed_to_offset ());
     }
 
   return val;
@@ -1556,7 +1556,7 @@ value_addr (struct value *arg1)
 
   if (TYPE_IS_REFERENCE (type))
     {
-      if (value_bits_synthetic_pointer (arg1, value_embedded_offset (arg1),
+      if (value_bits_synthetic_pointer (arg1, arg1->embedded_offset (),
 	  TARGET_CHAR_BIT * type->length ()))
 	arg1 = coerce_ref (arg1);
       else
@@ -1592,14 +1592,14 @@ value_addr (struct value *arg1)
   /* Get target memory address.  */
   arg2 = value_from_pointer (lookup_pointer_type (arg1->type ()),
 			     (value_address (arg1)
-			      + value_embedded_offset (arg1)));
+			      + arg1->embedded_offset ()));
 
   /* This may be a pointer to a base subobject; so remember the
      full derived object's type ...  */
   arg2->set_enclosing_type (lookup_pointer_type (arg1->enclosing_type ()));
   /* ... and also the relative position of the subobject in the full
      object.  */
-  set_value_pointed_to_offset (arg2, value_embedded_offset (arg1));
+  arg2->set_pointed_to_offset (arg1->embedded_offset ());
   return arg2;
 }
 
@@ -1671,7 +1671,7 @@ value_ind (struct value *arg1)
 	{
 	  /* Retrieve the enclosing object pointed to.  */
 	  base_addr = (value_as_address (arg1)
-		       - value_pointed_to_offset (arg1));
+		       - arg1->pointed_to_offset ());
 	}
       arg2 = value_at_lazy (enc_type, base_addr);
       enc_type = arg2->type ();
@@ -2076,7 +2076,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
       int found_baseclass = (m_looking_for_baseclass
 			     && TYPE_BASECLASS_NAME (type, i) != NULL
 			     && (strcmp_iw (m_name, basetype->name ()) == 0));
-      LONGEST boffset = value_embedded_offset (arg1) + offset;
+      LONGEST boffset = arg1->embedded_offset () + offset;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
 	{
@@ -2084,7 +2084,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
 
 	  boffset = baseclass_offset (type, i,
 				      value_contents_for_printing (arg1).data (),
-				      value_embedded_offset (arg1) + offset,
+				      arg1->embedded_offset () + offset,
 				      value_address (arg1),
 				      arg1);
 
@@ -2092,7 +2092,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
 	     by the user program.  Make sure that it still points to a
 	     valid memory location.  */
 
-	  boffset += value_embedded_offset (arg1) + offset;
+	  boffset += arg1->embedded_offset () + offset;
 	  if (boffset < 0
 	      || boffset >= arg1->enclosing_type ()->length ())
 	    {
@@ -2109,7 +2109,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
 	    {
 	      v2 = value_copy (arg1);
 	      v2->deprecated_set_type (basetype);
-	      set_value_embedded_offset (v2, boffset);
+	      v2->set_embedded_offset (boffset);
 	    }
 
 	  if (found_baseclass)
@@ -3978,11 +3978,11 @@ value_full_object (struct value *argp,
      object, 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 : argp->embedded_offset ()));
   new_val->deprecated_set_type (argp->type ());
-  set_value_embedded_offset (new_val, (using_enc
-				       ? top + value_embedded_offset (argp)
-				       : top));
+  new_val->set_embedded_offset ((using_enc
+				 ? top + argp->embedded_offset ()
+				 : top));
   return new_val;
 }
 
diff --git a/gdb/value.c b/gdb/value.c
index dbc87c6d31c..f5400402638 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1276,30 +1276,6 @@ value_bits_synthetic_pointer (const struct value *value,
 								  length);
 }
 
-LONGEST
-value_embedded_offset (const struct value *value)
-{
-  return value->m_embedded_offset;
-}
-
-void
-set_value_embedded_offset (struct value *value, LONGEST val)
-{
-  value->m_embedded_offset = val;
-}
-
-LONGEST
-value_pointed_to_offset (const struct value *value)
-{
-  return value->m_pointed_to_offset;
-}
-
-void
-set_value_pointed_to_offset (struct value *value, LONGEST val)
-{
-  value->m_pointed_to_offset = val;
-}
-
 const struct lval_funcs *
 value_computed_funcs (const struct value *v)
 {
@@ -1493,7 +1469,7 @@ value_copy (const value *arg)
   val->m_bitpos = arg->m_bitpos;
   val->m_bitsize = arg->m_bitsize;
   val->m_lazy = arg->m_lazy;
-  val->m_embedded_offset = value_embedded_offset (arg);
+  val->m_embedded_offset = arg->embedded_offset ();
   val->m_pointed_to_offset = arg->m_pointed_to_offset;
   val->m_modifiable = arg->m_modifiable;
   val->m_stack = arg->m_stack;
@@ -1553,8 +1529,8 @@ value_non_lval (struct value *arg)
 
       copy (value_contents_all (arg), value_contents_all_raw (val));
       val->m_type = arg->m_type;
-      set_value_embedded_offset (val, value_embedded_offset (arg));
-      set_value_pointed_to_offset (val, value_pointed_to_offset (arg));
+      val->set_embedded_offset (arg->embedded_offset ());
+      val->set_pointed_to_offset (arg->pointed_to_offset ());
       return val;
     }
    return arg;
@@ -2859,7 +2835,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
 	v->m_bitpos = bitpos % container_bitsize;
       else
 	v->m_bitpos = bitpos % 8;
-      v->m_offset = (value_embedded_offset (arg1)
+      v->m_offset = (arg1->embedded_offset ()
 		   + offset
 		   + (bitpos - v->m_bitpos) / 8);
       v->set_parent (arg1);
@@ -2883,7 +2859,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
       if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno))
 	boffset = baseclass_offset (arg_type, fieldno,
 				    value_contents (arg1).data (),
-				    value_embedded_offset (arg1),
+				    arg1->embedded_offset (),
 				    value_address (arg1),
 				    arg1);
       else
@@ -2899,7 +2875,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
 	}
       v->m_type = type;
       v->m_offset = arg1->offset ();
-      v->m_embedded_offset = offset + value_embedded_offset (arg1) + boffset;
+      v->m_embedded_offset = offset + arg1->embedded_offset () + boffset;
     }
   else if (NULL != TYPE_DATA_LOCATION (type))
     {
@@ -2927,12 +2903,12 @@ value_primitive_field (struct value *arg1, LONGEST offset,
       else
 	{
 	  v = allocate_value (type);
-	  value_contents_copy_raw (v, value_embedded_offset (v),
-				   arg1, value_embedded_offset (arg1) + offset,
+	  value_contents_copy_raw (v, v->embedded_offset (),
+				   arg1, arg1->embedded_offset () + offset,
 				   type_length_units (type));
 	}
       v->m_offset = (arg1->offset () + offset
-		   + value_embedded_offset (arg1));
+		     + arg1->embedded_offset ());
     }
   set_value_component_location (v, arg1);
   return v;
@@ -3529,11 +3505,11 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
   else
     {
       v = allocate_value (type);
-      value_contents_copy (v, value_embedded_offset (v),
-			   whole, value_embedded_offset (whole) + offset,
+      value_contents_copy (v, v->embedded_offset (),
+			   whole, whole->embedded_offset () + offset,
 			   type_length_units (type));
     }
-  v->m_offset = whole->offset () + offset + value_embedded_offset (whole);
+  v->m_offset = whole->offset () + offset + whole->embedded_offset ();
   set_value_component_location (v, whole);
 
   return v;
@@ -3557,14 +3533,14 @@ value_from_component_bitsize (struct value *whole, struct type *type,
 
   struct value *v = allocate_value (type);
 
-  LONGEST dst_offset = TARGET_CHAR_BIT * value_embedded_offset (v);
+  LONGEST dst_offset = TARGET_CHAR_BIT * v->embedded_offset ();
   if (is_scalar_type (type) && type_byte_order (type) == BFD_ENDIAN_BIG)
     dst_offset += TARGET_CHAR_BIT * type->length () - bit_length;
 
   value_contents_copy_raw_bitwise (v, dst_offset,
 				   whole,
 				   TARGET_CHAR_BIT
-				   * value_embedded_offset (whole)
+				   * whole->embedded_offset ()
 				   + bit_offset,
 				   bit_length);
   return v;
@@ -3609,7 +3585,7 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
 
   /* Add embedding info.  */
   value->set_enclosing_type (enc_type);
-  set_value_embedded_offset (value, value_pointed_to_offset (original_value));
+  value->set_embedded_offset (original_value->pointed_to_offset ());
 
   /* We may be pointing to an object of some derived type.  */
   return value_full_object (value, NULL, 0, 0, 0);
@@ -3812,8 +3788,8 @@ value_fetch_lazy_register (struct value *val)
   /* Copy the contents and the unavailability/optimized-out
      meta-data from NEW_VAL to VAL.  */
   set_value_lazy (val, 0);
-  value_contents_copy (val, value_embedded_offset (val),
-		       new_val, value_embedded_offset (new_val),
+  value_contents_copy (val, val->embedded_offset (),
+		       new_val, new_val->embedded_offset (),
 		       type_length_units (type));
 
   if (frame_debug)
diff --git a/gdb/value.h b/gdb/value.h
index 73ee8b5c34e..5f1bb1cfca7 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -216,6 +216,19 @@ struct value
   int deprecated_modifiable () const
   { return m_modifiable; }
 
+  LONGEST pointed_to_offset () const
+  { return m_pointed_to_offset; }
+
+  void set_pointed_to_offset (LONGEST val)
+  { m_pointed_to_offset = val; }
+
+  LONGEST embedded_offset () const
+  { return m_embedded_offset; }
+
+  void set_embedded_offset (LONGEST val)
+  { m_embedded_offset = val; }
+
+
   /* If a value represents a C++ object, then the `type' field gives the
      object's compile-time type.  If the object actually belongs to some
      class derived from `type', perhaps with other base classes and
@@ -445,11 +458,6 @@ extern struct type *value_actual_type (struct value *value,
 				       int resolve_simple_types,
 				       int *real_type_found);
 
-extern LONGEST value_pointed_to_offset (const struct value *value);
-extern void set_value_pointed_to_offset (struct value *value, LONGEST val);
-extern LONGEST value_embedded_offset (const struct value *value);
-extern void set_value_embedded_offset (struct value *value, LONGEST val);
-
 /* For lval_computed values, this structure holds functions used to
    retrieve and set the value (or portions of the value).
 

-- 
2.39.1


  parent reply	other threads:[~2023-02-09 21:38 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 21:38 [PATCH 00/47] Use methods for struct value Tom Tromey
2023-02-09 21:38 ` [PATCH 01/47] Rename all fields of " Tom Tromey
2023-02-10 21:05   ` Tom Tromey
2023-02-09 21:38 ` [PATCH 02/47] Move ~value body out-of-line Tom Tromey
2023-02-09 21:38 ` [PATCH 03/47] Move struct value to value.h Tom Tromey
2023-02-09 21:38 ` [PATCH 04/47] Turn value_type into method Tom Tromey
2023-02-09 21:38 ` [PATCH 05/47] Turn deprecated_set_value_type into a method Tom Tromey
2023-02-09 21:38 ` [PATCH 06/47] Turn value_arch into method Tom Tromey
2023-02-10  2:08   ` Simon Marchi
2023-02-10 16:36     ` Tom Tromey
2023-02-09 21:38 ` [PATCH 07/47] Turn value_bitsize " Tom Tromey
2023-02-09 21:38 ` [PATCH 08/47] Turn value_bitpos " Tom Tromey
2023-02-09 21:38 ` [PATCH 09/47] Turn value_parent " Tom Tromey
2023-02-09 21:38 ` [PATCH 10/47] Turn value_offset " Tom Tromey
2023-02-09 21:38 ` [PATCH 11/47] Turn deprecated_value_modifiable " Tom Tromey
2023-02-09 21:38 ` [PATCH 12/47] Turn value_enclosing_type " Tom Tromey
2023-02-09 21:38 ` Tom Tromey [this message]
2023-02-09 21:38 ` [PATCH 14/47] Turn value_lazy and set_value_lazy functions into methods Tom Tromey
2023-02-09 21:38 ` [PATCH 15/47] Turn value_stack and set_value_stack " Tom Tromey
2023-02-09 21:38 ` [PATCH 16/47] Turn value_computed_closure and value_computed_funcs " Tom Tromey
2023-02-09 21:38 ` [PATCH 17/47] Convert value_lval_const and deprecated_lval_hack to methods Tom Tromey
2023-02-09 21:38 ` [PATCH 18/47] Turn value_initialized and set_value_initialized functions into methods Tom Tromey
2023-02-09 21:38 ` [PATCH 19/47] Turn value_address and set_value_address " Tom Tromey
2023-02-09 21:38 ` [PATCH 20/47] Turn more deprecated_* " Tom Tromey
2023-02-09 21:38 ` [PATCH 21/47] Turn allocate_value_lazy into a static "constructor" Tom Tromey
2023-02-09 21:38 ` [PATCH 22/47] Turn allocate_value " Tom Tromey
2023-02-09 21:38 ` [PATCH 23/47] Turn allocate_computed_value into " Tom Tromey
2023-02-09 21:38 ` [PATCH 24/47] Turn allocate_optimized_out_value " Tom Tromey
2023-02-09 21:38 ` [PATCH 25/47] Turn value_zero " Tom Tromey
2023-02-09 21:38 ` [PATCH 26/47] Turn some value_contents functions into methods Tom Tromey
2023-02-09 21:38 ` [PATCH 27/47] Turn value_fetch_lazy into a method Tom Tromey
2023-02-09 21:38 ` [PATCH 28/47] Turn allocate_value_contents " Tom Tromey
2023-02-09 21:38 ` [PATCH 29/47] Turn value_contents_eq " Tom Tromey
2023-02-10  2:18   ` Simon Marchi
2023-02-10 17:46     ` Tom Tromey
2023-02-09 21:38 ` [PATCH 30/47] Turn value_bits_synthetic_pointer " Tom Tromey
2023-02-09 21:38 ` [PATCH 31/47] Move value_ref_policy methods out-of-line Tom Tromey
2023-02-09 21:38 ` [PATCH 32/47] Turn value_incref and value_decref into methods Tom Tromey
2023-02-09 21:38 ` [PATCH 33/47] Turn remaining value_contents functions " Tom Tromey
2023-02-10  2:24   ` Simon Marchi
2023-02-10 17:46     ` Tom Tromey
2023-02-09 21:38 ` [PATCH 34/47] Fully qualify calls to copy in value.c Tom Tromey
2023-02-09 21:38 ` [PATCH 35/47] Turn value_copy into a method Tom Tromey
2023-02-10  2:42   ` Simon Marchi
2023-02-10 18:03     ` Tom Tromey
2023-02-09 21:38 ` [PATCH 36/47] Turn many optimized-out value functions into methods Tom Tromey
2023-02-09 21:38 ` [PATCH 37/47] Turn value_non_lval and value_force_lval " Tom Tromey
2023-02-09 21:38 ` [PATCH 38/47] Turn set_value_component_location into method Tom Tromey
2023-02-09 21:39 ` [PATCH 39/47] Change some code to use value methods Tom Tromey
2023-02-09 21:39 ` [PATCH 40/47] Turn some xmethod functions into methods Tom Tromey
2023-02-09 21:39 ` [PATCH 41/47] Turn preserve_one_value into method Tom Tromey
2023-02-09 21:39 ` [PATCH 42/47] Turn various value copying-related functions into methods Tom Tromey
2023-02-10 20:20   ` Tom Tromey
2023-02-09 21:39 ` [PATCH 43/47] Add value::set_modifiable Tom Tromey
2023-02-09 21:39 ` [PATCH 44/47] Make struct value data members private Tom Tromey
2023-02-09 21:39 ` [PATCH 45/47] Make ~value private Tom Tromey
2023-02-09 21:39 ` [PATCH 46/47] Introduce set_lval method on value Tom Tromey
2023-02-09 21:39 ` [PATCH 47/47] Remove deprecated_lval_hack Tom Tromey
2023-02-10  2:54 ` [PATCH 00/47] Use methods for struct value Simon Marchi
2023-02-10 18:08   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230209-submit-value-fixups-2023-v1-13-55dc2794dbb9@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).