]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 9 Oct 2011 19:36:06 +0000 (19:36 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 9 Oct 2011 19:36:06 +0000 (19:36 +0000)
Make some lval_funcs methods to default on NULL.
* valops.c (value_fetch_lazy): Check if lval_computed read method is
NULL.
(value_assign): Check if lval_computed write method is NULL.
* value.h (struct lval_funcs): Comment NULL values for read and write
methods.

gdb/ChangeLog
gdb/valops.c
gdb/value.h

index 0dc93bf5c0baf1e1252a3057287fe215ef2247e7..b9e971af3f13987661c8dcbf6fa3467468fd1b94 100644 (file)
@@ -1,3 +1,12 @@
+2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Make some lval_funcs methods to default on NULL.
+       * valops.c (value_fetch_lazy): Check if lval_computed read method is
+       NULL.
+       (value_assign): Check if lval_computed write method is NULL.
+       * value.h (struct lval_funcs): Comment NULL values for read and write
+       methods.
+
 2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Display @entry parameter values (without references).
index 32d71cdf86f61754bfee8f8871405a300c975d73..e88e9dc0c08b18b45416e7c2b745823861877494 100644 (file)
@@ -1110,7 +1110,8 @@ value_fetch_lazy (struct value *val)
         watchpoints from trying to watch the saved frame pointer.  */
       value_free_to_mark (mark);
     }
-  else if (VALUE_LVAL (val) == lval_computed)
+  else if (VALUE_LVAL (val) == lval_computed
+          && value_computed_funcs (val)->read != NULL)
     value_computed_funcs (val)->read (val);
   else if (value_optimized_out (val))
     /* Keep it optimized out.  */;
@@ -1381,9 +1382,13 @@ value_assign (struct value *toval, struct value *fromval)
       {
        const struct lval_funcs *funcs = value_computed_funcs (toval);
 
-       funcs->write (toval, fromval);
+       if (funcs->write != NULL)
+         {
+           funcs->write (toval, fromval);
+           break;
+         }
       }
-      break;
+      /* Fall through.  */
 
     default:
       error (_("Left operand of assignment is not an lvalue."));
index 5d61a0b06586402f0b9253554caf057202a28e6a..83c94fcab771b3590ebe667ad11ee9e7b604582f 100644 (file)
@@ -156,13 +156,15 @@ struct lval_funcs
 {
   /* Fill in VALUE's contents.  This is used to "un-lazy" values.  If
      a problem arises in obtaining VALUE's bits, this function should
-     call 'error'.  */
+     call 'error'.  If it is NULL value_fetch_lazy on "un-lazy"
+     non-optimized-out value is an internal error.  */
   void (*read) (struct value *v);
 
   /* Handle an assignment TOVAL = FROMVAL by writing the value of
      FROMVAL to TOVAL's location.  The contents of TOVAL have not yet
      been updated.  If a problem arises in doing so, this function
-     should call 'error'.  */
+     should call 'error'.  If it is NULL such TOVAL assignment is an error as
+     TOVAL is not considered as an lvalue.  */
   void (*write) (struct value *toval, struct value *fromval);
 
   /* Check the validity of some bits in VALUE.  This should return 1