* bfd-in.h (align_power): Cast constants to bfd_vma type.
[deliverable/binutils-gdb.git] / gdb / valops.c
index 1d0039f32f7852b2b450f73bb868801713185d79..1eeedd32cf7ad755766277dbc82371bf9300ddcb 100644 (file)
@@ -361,18 +361,11 @@ value_cast (struct type *type, struct value *arg2)
                                       value_zero (t1, not_lval), 0, t1, 1);
                  if (v)
                    {
-                     struct value *v2 = value_ind (arg2);
-                     VALUE_ADDRESS (v2) -= VALUE_ADDRESS (v)
-                       + VALUE_OFFSET (v);
-
-                      /* JYG: adjust the new pointer value and
-                        embedded offset. */
-                      v2->aligner.contents[0] -=  VALUE_EMBEDDED_OFFSET (v);
-                      VALUE_EMBEDDED_OFFSET (v2) = 0;
-
-                     v2 = value_addr (v2);
-                     VALUE_TYPE (v2) = type;
-                     return v2;
+                      CORE_ADDR addr2 = value_as_address (arg2);
+                      addr2 -= (VALUE_ADDRESS (v)
+                                + VALUE_OFFSET (v)
+                                + VALUE_EMBEDDED_OFFSET (v));
+                      return value_from_pointer (type, addr2);
                    }
                }
            }
@@ -633,6 +626,7 @@ value_assign (struct value *toval, struct value *fromval)
        write_memory (changed_addr, dest_buffer, changed_len);
        if (memory_changed_hook)
          memory_changed_hook (changed_addr, changed_len);
+       target_changed_event ();
       }
       break;
 
@@ -678,6 +672,9 @@ value_assign (struct value *toval, struct value *fromval)
                              VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
 #endif
        }
+
+      target_changed_event ();
+
       /* Assigning to the stack pointer, frame pointer, and other
          (architecture and calling convention specific) registers may
          cause the frame cache to be out of date.  We just do this
@@ -765,6 +762,7 @@ value_assign (struct value *toval, struct value *fromval)
 
        if (register_changed_hook)
          register_changed_hook (-1);
+       target_changed_event ();
       }
       break;
 
@@ -2054,11 +2052,18 @@ search_struct_field (char *name, struct value *arg1, int offset,
          {
            struct value *v;
            if (TYPE_FIELD_STATIC (type, i))
-             v = value_static_field (type, i);
+             {
+               v = value_static_field (type, i);
+               if (v == 0)
+                 error ("field %s is nonexistent or has been optimised out",
+                        name);
+             }
            else
-             v = value_primitive_field (arg1, offset, i, type);
-           if (v == 0)
-             error ("there is no field named %s", name);
+             {
+               v = value_primitive_field (arg1, offset, i, type);
+               if (v == 0)
+                 error ("there is no field named %s", name);
+             }
            return v;
          }
 
@@ -3043,7 +3048,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
            {
              v = value_static_field (t, i);
              if (v == NULL)
-               error ("Internal error: could not find static variable %s",
+               error ("static field %s has been optimized out",
                       name);
              return v;
            }
This page took 0.024542 seconds and 4 git commands to generate.