aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-02-16 12:01:52 -0700
committerTom Tromey <tromey@adacore.com>2022-03-07 08:25:11 -0700
commitc9bfa277e9e6467dad91641357e09bf0a7ac0dc2 (patch)
tree0ff02e7601896ff486779069c992446f2dc60306 /gdb/testsuite
parent47a39c6e18324360b3ef9b72f03e206417f2ce9c (diff)
downloadfsf-binutils-gdb-c9bfa277e9e6467dad91641357e09bf0a7ac0dc2.zip
fsf-binutils-gdb-c9bfa277e9e6467dad91641357e09bf0a7ac0dc2.tar.gz
fsf-binutils-gdb-c9bfa277e9e6467dad91641357e09bf0a7ac0dc2.tar.bz2
Fix Ada integer literals with exponents
While working on another patch, I noticed that Ada integer literals with exponents did not work. For example, with one form you get an error: (gdb) print 8e2 Invalid digit `e' in based literal And with another form you get an incorrect value: (gdb) print 16#8#e2 $2 = 8 This patch fixes the bugs and adds tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.ada/literals.exp36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/literals.exp b/gdb/testsuite/gdb.ada/literals.exp
new file mode 100644
index 0000000..92a9a19
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/literals.exp
@@ -0,0 +1,36 @@
+# Copyright 2022 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test some literal syntax.
+
+load_lib "ada.exp"
+
+if { [skip_ada_tests] } { return -1 }
+
+clean_restart
+
+gdb_test_no_output "set lang ada"
+gdb_test "print 7#10#" " = 7"
+gdb_test "print 77#10#" "Invalid base: 77."
+gdb_test "print 7#8#" "Invalid digit `8' in based literal"
+
+gdb_test "print 8e2" " = 800"
+gdb_test "print 9999999999999999999999999999999999999999999999" \
+ "Integer literal out of range"
+gdb_test "print 2e1000" "Integer literal out of range"
+
+gdb_test "print 16#ffff#" " = 65535"
+gdb_test "print 16#f#e1" " = 240"
+gdb_test "print 16#1#e10" " = 1099511627776"