aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-17 23:24:22 +0000
committerPer Bothner <per@bothner.com>1995-02-17 23:24:22 +0000
commit27648f269f318b48897163735a0254f3b799fbff (patch)
tree8678c04b0c7e2a137ca2d17639dcf087ce86522d
parentfda36387ebfea914119a1287e6e492a1aa7af3ef (diff)
downloadgdb-27648f269f318b48897163735a0254f3b799fbff.zip
gdb-27648f269f318b48897163735a0254f3b799fbff.tar.gz
gdb-27648f269f318b48897163735a0254f3b799fbff.tar.bz2
* gdb.texinfo (Artificial arrays): Note use of coerce-to-array-type.
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/gdb.texinfo16
2 files changed, 20 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 055395e..79f5b0c 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -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.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8138efa..7e445aa 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -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