aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-02-16 10:07:18 -0700
committerTom Tromey <tromey@adacore.com>2022-03-07 08:27:38 -0700
commit63fc2437deda87a566059444630ccc402945ae99 (patch)
treeff778d7fab7aea1716f23f4c36c5553d9c5c1449 /gdb/doc
parentc9bfa277e9e6467dad91641357e09bf0a7ac0dc2 (diff)
downloadfsf-binutils-gdb-63fc2437deda87a566059444630ccc402945ae99.zip
fsf-binutils-gdb-63fc2437deda87a566059444630ccc402945ae99.tar.gz
fsf-binutils-gdb-63fc2437deda87a566059444630ccc402945ae99.tar.bz2
Implement real literal extension for Ada
Sometimes it is convenient to be able to specify the exact bits of a floating-point literal. For example, you may want to set a floating-point register to a denormalized value, or to a particular NaN. In C, you can do this by combining the "{}" cast with an array literal, like: (gdb) p {double}{0x576488BDD2AE9FFE} $1 = 9.8765449999999996e+112 This patch adds a somewhat similar idea to Ada. It extends the lexer to allow "l" and "f" suffixes in a based literal. The "f" indicates a floating-point literal, and the "l"s control the size of the floating-point type. Note that this differs from Ada's based real literals. I believe those can also be used to control the bits of a floating-point value, but they are a bit more cumbersome to use (simplest is binary but that's also very lengthy). Also, these aren't implemented in GDB. I chose not to allow this extension to work with based integer literals with exponents. That didn't seem very useful.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/gdb.texinfo16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5d1dcfd..063e3a1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18190,6 +18190,9 @@ context.
Should your program
redefine these names in a package or procedure (at best a dubious practice),
you will have to use fully qualified names to access their new definitions.
+
+@item
+Based real literals are not implemented.
@end itemize
@node Additions to Ada
@@ -18248,6 +18251,19 @@ complex conditional breaks:
(@value{GDBP}) condition 1 (report(i); k += 1; A(k) > 100)
@end smallexample
+@item
+An extension to based literals can be used to specify the exact byte
+contents of a floating-point literal. After the base, you can use
+from zero to two @samp{l} characters, followed by an @samp{f}. The
+number of @samp{l} characters controls the width of the resulting real
+constant: zero means @code{Float} is used, one means
+@code{Long_Float}, and two means @code{Long_Long_Float}.
+
+@smallexample
+(@value{GDBP}) print 16f#41b80000#
+$1 = 23.0
+@end smallexample
+
@item
Rather than use catenation and symbolic character names to introduce special
characters into strings, one may instead use a special bracket notation,