diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2006-01-02 09:47:18 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2006-01-02 09:47:18 +0000 |
commit | 860701dc699888cd2d4a1f130c64c7638447800a (patch) | |
tree | ad56379a8abce5b1ede1b565f483d1a316c42608 /gdb/doc | |
parent | 52ce64369c7d39c1e901f946c6128c8439f7392c (diff) | |
download | gdb-860701dc699888cd2d4a1f130c64c7638447800a.zip gdb-860701dc699888cd2d4a1f130c64c7638447800a.tar.gz gdb-860701dc699888cd2d4a1f130c64c7638447800a.tar.bz2 |
* gdb.texinfo (Omissions from Ada): Document that there is now
limited aggregate support.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 47 |
2 files changed, 51 insertions, 1 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 6f62bb6..a92bec7 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2006-01-02 Paul N. Hilfinger <hilfinger@gnat.com> + + * gdb.texinfo (Omissions from Ada): Document that there is now + limited aggregate support. + 2005-12-28 Eli Zaretskii <eliz@gnu.org> * gdb.texinfo (Registers): Describe how to refer to SSE and MMX diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index ea22517..92f44d8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -9812,7 +9812,52 @@ The other component-by-component array operations (@code{and}, @code{or}, are not implemented. @item -There are no record or array aggregates. +@cindex array aggregates (Ada) +@cindex record aggregates (Ada) +@cindex aggregates (Ada) +There is limited support for array and record aggregates. They are +permitted only on the right sides of assignments, as in these examples: + +@smallexample +set An_Array := (1, 2, 3, 4, 5, 6) +set An_Array := (1, others => 0) +set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6) +set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9)) +set A_Record := (1, "Peter", True); +set A_Record := (Name => "Peter", Id => 1, Alive => True) +@end smallexample + +Changing a +discriminant's value by assigning an aggregate has an +undefined effect if that discriminant is used within the record. +However, you can first modify discriminants by directly assigning to +them (which normally would not be allowed in Ada), and then performing an +aggregate assignment. For example, given a variable @code{A_Rec} +declared to have a type such as: + +@smallexample +type Rec (Len : Small_Integer := 0) is record + Id : Integer; + Vals : IntArray (1 .. Len); +end record; +@end smallexample + +you can assign a value with a different size of @code{Vals} with two +assignments: + +@smallexample +set A_Rec.Len := 4 +set A_Rec := (Id => 42, Vals => (1, 2, 3, 4)) +@end smallexample + +As this example also illustrates, @value{GDBN} is very loose about the usual +rules concerning aggregates. You may leave out some of the +components of an array or record aggregate (such as the @code{Len} +component in the assignment to @code{A_Rec} above); they will retain their +original values upon assignment. You may freely use dynamic values as +indices in component associations. You may even use overlapping or +redundant component associations, although which component values are +assigned in such cases is not defined. @item Calls to dispatching subprograms are not implemented. |