This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/Ada] remove ref to fields and ref to slices


In the context of:
http://sourceware.org/ml/gdb-patches/2008-11/msg00627.html

Now that the lazy values are "lazily" allocated, we can remove the use of
references to fields and references to slices in ada-lang.c.

Tested on Linux, no regression, one new pass
(gdb.ada/formatted_ref.exp: print s.x = 13)

OK to apply?

2008-11-27  Jerome Guitton  <guitton@adacore.com>

	* ada-lang.c (ada_value_slice_ptr): Return a lazy value instead
	of a reference. Update comment.
	(ada_value_struct_elt): Ditto if arg is a pointer or a reference.
	Update comment as well.

Index: gdb/ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.184
diff -u -p -r1.184 ada-lang.c
--- gdb/ada-lang.c	24 Nov 2008 23:21:15 -0000	1.184
+++ gdb/ada-lang.c	27 Nov 2008 09:32:52 -0000
@@ -2346,9 +2346,9 @@ ada_value_ptr_subscript (struct value *a
 }
 
 /* Given that ARRAY_PTR is a pointer or reference to an array of type TYPE (the
-   actual type of ARRAY_PTR is ignored), returns a reference to
-   the Ada slice of HIGH-LOW+1 elements starting at index LOW.  The lower
-   bound of this array is LOW, as per Ada rules. */
+   actual type of ARRAY_PTR is ignored), returns the Ada slice of HIGH-LOW+1
+   elements starting at index LOW.  The lower bound of this array is LOW, as
+   per Ada rules. */
 static struct value *
 ada_value_slice_ptr (struct value *array_ptr, struct type *type,
                      int low, int high)
@@ -2361,7 +2361,7 @@ ada_value_slice_ptr (struct value *array
                        low, high);
   struct type *slice_type =
     create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
-  return value_from_pointer (lookup_reference_type (slice_type), base);
+  return value_at_lazy (slice_type, base);
 }
 
 
@@ -6178,9 +6178,7 @@ ada_index_struct_field_1 (int *index_p, 
 /* Given ARG, a value of type (pointer or reference to a)*
    structure/union, extract the component named NAME from the ultimate
    target structure/union and return it as a value with its
-   appropriate type.  If ARG is a pointer or reference and the field
-   is not packed, returns a reference to the field, otherwise the
-   value of the field (an lvalue if ARG is an lvalue).     
+   appropriate type.  Return the value of the field.
 
    The routine searches for NAME among all members of the structure itself
    and (recursively) among all members of any wrapper members
@@ -6257,8 +6255,7 @@ ada_value_struct_elt (struct value *arg,
                                                   field_type);
             }
           else
-            v = value_from_pointer (lookup_reference_type (field_type),
-                                    address + byte_offset);
+            v = value_at_lazy (field_type, address + byte_offset);
         }
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]