* source.c (openp): Skip $cdir in PATH.
[deliverable/binutils-gdb.git] / gdb / value.c
index f4075cf09a3572172ddb821e0a9e5873b32f9a2e..19386b615acd4819d5fb320a44087ff7c34da1cd 100644 (file)
@@ -254,7 +254,14 @@ struct value *
 allocate_value_lazy (struct type *type)
 {
   struct value *val;
-  struct type *atype = check_typedef (type);
+
+  /* Call check_typedef on our type to make sure that, if TYPE
+     is a TYPE_CODE_TYPEDEF, its length is set to the length
+     of the target type instead of zero.  However, we do not
+     replace the typedef type by the target type, because we want
+     to keep the typedef in order to be able to set the VAL's type
+     description correctly.  */
+  check_typedef (type);
 
   val = (struct value *) xzalloc (sizeof (struct value));
   val->contents = NULL;
@@ -1806,13 +1813,15 @@ value_static_field (struct type *type, int fieldno)
 
   if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
     {
-      retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
-                        TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+      retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
+                             TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
     }
   else
     {
       char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
+       /*TYPE_FIELD_NAME (type, fieldno);*/
       struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
+
       if (sym == NULL)
        {
          /* With some compilers, e.g. HP aCC, static data members are reported
@@ -1822,8 +1831,8 @@ value_static_field (struct type *type, int fieldno)
            return NULL;
          else
            {
-             retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
-                                SYMBOL_VALUE_ADDRESS (msym));
+             retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
+                                     SYMBOL_VALUE_ADDRESS (msym));
            }
        }
       else
@@ -1873,7 +1882,14 @@ value_primitive_field (struct value *arg1, int offset,
 
   CHECK_TYPEDEF (arg_type);
   type = TYPE_FIELD_TYPE (arg_type, fieldno);
-  type = check_typedef (type);
+
+  /* Call check_typedef on our type to make sure that, if TYPE
+     is a TYPE_CODE_TYPEDEF, its length is set to the length
+     of the target type instead of zero.  However, we do not
+     replace the typedef type by the target type, because we want
+     to keep the typedef in order to be able to print the type
+     description correctly.  */
+  check_typedef (type);
 
   /* Handle packed fields */
 
This page took 0.024313 seconds and 4 git commands to generate.