aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2013-11-27 18:47:40 +0400
committerJoel Brobecker <brobecker@adacore.com>2013-12-03 16:04:26 +0400
commit7fb1b8b13f1fb3a72f0ab3ce72967549ea040e17 (patch)
treedcd7b5ffbdb8f6ba160acccf0a64cc3cce69bbaa /gdb/testsuite
parent849f2b52ec2b71bc76188ac8c53f35fb57a5d41c (diff)
downloadgdb-7fb1b8b13f1fb3a72f0ab3ce72967549ea040e17.zip
gdb-7fb1b8b13f1fb3a72f0ab3ce72967549ea040e17.tar.gz
gdb-7fb1b8b13f1fb3a72f0ab3ce72967549ea040e17.tar.bz2
Ada: Reserved word "all" should not need to be spelled in lowercase.
Consider the following code: type Ptr is access all Integer; IP : Ptr := new Integer'(123); IP is the Ada exception of a pointer to an integer. To dereference the pointer and get its value, the user uses the reserved word "all" as follow: (gdb) p ip.all $1 = 123 Ada being a case-insensitive language, the casing should not matter. Unfortunately, for the reserved word "all", things don't work. For instance: (gdb) p ip.ALL Type integer is not a structure or union type This patch fixes the problem. gdb/ChangeLog: * ada-lex.l (find_dot_all): Use strncasecmp instead of strncmp. gdb/testsuite/ChangeLog: * gdb.ada/dot_all: New testcase.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.ada/dot_all.exp34
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/foo.adb23
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/pck.adb25
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/pck.ads22
5 files changed, 108 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index bc4bcbb..5725b3d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2013-12-03 Joel Brobecker <brobecker@adacore.com>
+ * gdb.ada/dot_all: New testcase.
+
+2013-12-03 Joel Brobecker <brobecker@adacore.com>
+
* gdb.mi/mi-undefined-cmd.exp: New testcase.
2013-12-03 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/testsuite/gdb.ada/dot_all.exp b/gdb/testsuite/gdb.ada/dot_all.exp
new file mode 100644
index 0000000..87a248f
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dot_all.exp
@@ -0,0 +1,34 @@
+# Copyright 2013 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/>.
+
+load_lib "ada.exp"
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
+if ![runto "foo.adb:$bp_location" ] then {
+ perror "Couldn't run ${testfile}"
+ return
+}
+
+gdb_test "print addr.all" " = 123"
+gdb_test "print addr.ALL" " = 123"
+gdb_test "print addr.AlL" " = 123"
diff --git a/gdb/testsuite/gdb.ada/dot_all/foo.adb b/gdb/testsuite/gdb.ada/dot_all/foo.adb
new file mode 100644
index 0000000..1bf0797
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dot_all/foo.adb
@@ -0,0 +1,23 @@
+-- Copyright 2013 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/>.
+
+with Pck; use Pck;
+
+procedure Foo is
+ type Integer_Access is access all Integer;
+ Addr : Integer_Access := new Integer'(123);
+begin
+ Do_Nothing (Addr'Address); -- STOP
+end Foo;
diff --git a/gdb/testsuite/gdb.ada/dot_all/pck.adb b/gdb/testsuite/gdb.ada/dot_all/pck.adb
new file mode 100644
index 0000000..39ce769
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dot_all/pck.adb
@@ -0,0 +1,25 @@
+-- Copyright 2008-2013 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/>.
+
+package body Pck is
+
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+
+end Pck;
+
+
diff --git a/gdb/testsuite/gdb.ada/dot_all/pck.ads b/gdb/testsuite/gdb.ada/dot_all/pck.ads
new file mode 100644
index 0000000..771b5c1
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dot_all/pck.ads
@@ -0,0 +1,22 @@
+-- Copyright 2008-2013 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/>.
+
+with System;
+
+package Pck is
+ procedure Do_Nothing (A : System.Address);
+end Pck;
+
+