+2015-05-05  Joel Brobecker  <brobecker@adacore.com>
+
+       * dwarf2loc.h (struct property_addr_info): Add "valaddr" field.
+       * dwarf2loc.c (dwarf2_evaluate_property): Add handling of
+       pinfo->valaddr.
+       * gdbtypes.h (resolve_dynamic_type): Add "valaddr" parameter.
+       * gdbtypes.c (resolve_dynamic_struct): Set pinfo.valaddr.
+       (resolve_dynamic_type_internal): Set pinfo.valaddr.
+       Add handling of addr_stack->valaddr.
+       (resolve_dynamic_type): Add "valaddr" parameter.
+       Set pinfo.valaddr field.
+       * ada-lang.c (ada_discrete_type_high_bound): Update call to
+       resolve_dynamic_type.
+       (ada_discrete_type_low_bound): Likewise.
+       * findvar.c (default_read_var_value): Likewise.
+       * value.c (value_from_contents_and_address): Likewise.
+
 2015-05-05  Joel Brobecker  <brobecker@adacore.com>
 
        * gdbtypes.c (resolve_dynamic_array): Use
 
 LONGEST
 ada_discrete_type_high_bound (struct type *type)
 {
-  type = resolve_dynamic_type (type, 0);
+  type = resolve_dynamic_type (type, NULL, 0);
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
 LONGEST
 ada_discrete_type_low_bound (struct type *type)
 {
-  type = resolve_dynamic_type (type, 0);
+  type = resolve_dynamic_type (type, NULL, 0);
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
 
            break;
        if (pinfo == NULL)
          error (_("cannot find reference address for offset property"));
-       val = value_at (baton->offset_info.type,
-                       pinfo->addr + baton->offset_info.offset);
+       if (pinfo->valaddr != NULL)
+         val = value_from_contents
+                 (baton->offset_info.type,
+                  pinfo->valaddr + baton->offset_info.offset);
+       else
+         val = value_at (baton->offset_info.type,
+                         pinfo->addr + baton->offset_info.offset);
        *value = value_as_address (val);
        return 1;
       }
 
      being resolved.  */
   struct type *type;
 
+  /* If not NULL, a buffer containing the object's value.  */
+  const gdb_byte *valaddr;
+
   /* The address of that object.  */
   CORE_ADDR addr;
 
 
       if (is_dynamic_type (type))
        {
          /* Value is a constant byte-sequence and needs no memory access.  */
-         type = resolve_dynamic_type (type, /* Unused address.  */ 0);
+         type = resolve_dynamic_type (type, NULL, /* Unused address.  */ 0);
        }
       /* Put the constant back in target format. */
       v = allocate_value (type);
       if (is_dynamic_type (type))
        {
          /* Value is a constant byte-sequence and needs no memory access.  */
-         type = resolve_dynamic_type (type, /* Unused address.  */ 0);
+         type = resolve_dynamic_type (type, NULL, /* Unused address.  */ 0);
        }
       v = allocate_value (type);
       memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var),
 
                 " (invalid location kind)"));
 
       pinfo.type = check_typedef (TYPE_FIELD_TYPE (type, i));
+      pinfo.valaddr = addr_stack->valaddr;
       pinfo.addr = addr_stack->addr;
       pinfo.next = addr_stack;
 
            struct property_addr_info pinfo;
 
            pinfo.type = check_typedef (TYPE_TARGET_TYPE (type));
-           pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
+           pinfo.valaddr = NULL;
+           if (addr_stack->valaddr != NULL)
+             pinfo.addr = extract_typed_address (addr_stack->valaddr, type);
+           else
+             pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
            pinfo.next = addr_stack;
 
            resolved_type = copy_type (type);
 /* See gdbtypes.h  */
 
 struct type *
-resolve_dynamic_type (struct type *type, CORE_ADDR addr)
+resolve_dynamic_type (struct type *type, const gdb_byte *valaddr,
+                     CORE_ADDR addr)
 {
-  struct property_addr_info pinfo = {check_typedef (type), addr, NULL};
+  struct property_addr_info pinfo
+    = {check_typedef (type), valaddr, addr, NULL};
 
   return resolve_dynamic_type_internal (type, &pinfo, 1);
 }
 
    ADDR specifies the location of the variable the type is bound to.
    If TYPE has no dynamic properties return TYPE; otherwise a new type with
    static properties is returned.  */
-extern struct type *resolve_dynamic_type (struct type *type, CORE_ADDR addr);
+extern struct type *resolve_dynamic_type (struct type *type,
+                                         const gdb_byte *valaddr,
+                                         CORE_ADDR addr);
 
 /* * Predicate if the type has dynamic values, which are not resolved yet.  */
 extern int is_dynamic_type (struct type *type);
 
                                 const gdb_byte *valaddr,
                                 CORE_ADDR address)
 {
-  struct type *resolved_type = resolve_dynamic_type (type, address);
+  struct type *resolved_type = resolve_dynamic_type (type, valaddr, address);
   struct type *resolved_type_no_typedef = check_typedef (resolved_type);
   struct value *v;