]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add value::set_modifiable
authorTom Tromey <tom@tromey.com>
Wed, 1 Feb 2023 15:25:21 +0000 (08:25 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 13 Feb 2023 22:22:17 +0000 (15:22 -0700)
This introduces a value::set_modifiable and changes a couple of spots
to use it.

I'm not completely sure the comments by deprecated_modifiable are
correct any more.  Perhaps they should be removed and the method
renamed.  Like so many before me, though, I've deferred investigation
of the issue.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/value.c
gdb/value.h

index 1921aecdbc112faaa38017eb3557bc22ddb35e51..640053ddce5b6edfc1a7136a861fb64435075630 100644 (file)
@@ -1680,7 +1680,7 @@ record_latest_value (struct value *val)
   /* We preserve VALUE_LVAL so that the user can find out where it was fetched
      from.  This is a bit dubious, because then *&$1 does not just return $1
      but the current contents of that location.  c'est la vie...  */
-  val->m_modifiable = 0;
+  val->set_modifiable (0);
 
   value_history.push_back (release_value (val));
 
@@ -2173,7 +2173,7 @@ set_internalvar (struct internalvar *var, struct value *val)
     default:
       new_kind = INTERNALVAR_VALUE;
       struct value *copy = val->copy ();
-      copy->m_modifiable = 1;
+      copy->set_modifiable (1);
 
       /* Force the value to be fetched from the target now, to avoid problems
         later when this internalvar is referenced and the target is gone or
index 7e232f378edcef2d704c4ead8748ddc473946343..f35bfc7206c588ebc690b8b3766ebad46e24250c 100644 (file)
@@ -229,6 +229,10 @@ public:
   int deprecated_modifiable () const
   { return m_modifiable; }
 
+  /* Set or clear the modifiable flag.  */
+  void set_modifiable (int val)
+  { m_modifiable = val; }
+
   LONGEST pointed_to_offset () const
   { return m_pointed_to_offset; }