* gdb.texinfo (Artificial arrays): Note use of coerce-to-array-type.

This commit is contained in:
Per Bothner 1995-02-17 23:24:22 +00:00
parent fda36387eb
commit 27648f269f
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Fri Feb 17 15:24:35 1995 Per Bothner <bothner@kalessin.cygnus.com>
* gdb.texinfo (Artificial arrays): Note use of coerce-to-array-type.
Wed Feb 15 11:59:18 1995 J.T. Conklin <jtc@rtl.cygnus.com>
* all-cfg.texi: New flag, GDBSERVE, for NetWare's gdbserve.nlm.

View File

@ -4078,6 +4078,22 @@ subscripting, and are coerced to pointers when used in expressions.
Artificial arrays most often appear in expressions via the value history
(@pxref{Value History, ,Value history}), after printing one out.
Another way to create an artificial array is to use a cast.
This re-interprets a value as if it were an array.
The value need not be in memory:
@example
(@value{GDBP}) p/x (short[2])0x12345678
$1 = @{0x1234, 0x5678@}
@end example
As a convenience, if you leave the array length out (as in
@samp{(@var{type})[])@var{value}}) gdb calculates the size to fill
the value (as @samp{sizeof(@var{value})/sizeof(@var{type})}:
@example
(@value{GDBP}) p/x (short[])0x12345678
$2 = @{0x1234, 0x5678@}
@end example
Sometimes the artificial array mechanism is not quite enough; in
moderately complex data structures, the elements of interest may not
actually be adjacent---for example, if you are interested in the values