aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-09-12 08:18:10 -0600
committerTom Tromey <tromey@adacore.com>2025-03-06 14:17:17 -0700
commitfb77dfe48b5e40a5ed06f8482cd808a13e136db2 (patch)
treed9c048582246ed7e15bdb1a1abf42e000d554209
parentcabd5456c78f431517b4c76ed93feff1608e0cf0 (diff)
downloadbinutils-fb77dfe48b5e40a5ed06f8482cd808a13e136db2.zip
binutils-fb77dfe48b5e40a5ed06f8482cd808a13e136db2.tar.gz
binutils-fb77dfe48b5e40a5ed06f8482cd808a13e136db2.tar.bz2
Fix type name in ptype-o.exp
The "Rec" type in ptype-o.exp is currently named "prog__rec" by the compiler. However, with my changes to GNAT, the type will no longer have a prefix, as it is local to a procedure. Changing this to just use "rec" works fine with the new compiler, but then fails with older compilers. To allow correct operation with both compilers, this patch simply moves the type into a new package. This doesn't affect the meaning of the test, which is just ensuring that ptype/o works in a certain case. Note that the more obvious fix of just using "ptype/o rec" does not work with the current GNAT. I haven't investigated this but I did file a bug to track it: https://sourceware.org/bugzilla/show_bug.cgi?id=32169
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o.exp2
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o/pck.ads25
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o/prog.adb11
3 files changed, 28 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.ada/ptype-o.exp b/gdb/testsuite/gdb.ada/ptype-o.exp
index 5038ee1..1b6373c 100644
--- a/gdb/testsuite/gdb.ada/ptype-o.exp
+++ b/gdb/testsuite/gdb.ada/ptype-o.exp
@@ -43,5 +43,5 @@ foreach_gnat_encoding scenario flags {all minimal} {
# crash.
set exp ".*"
}
- gdb_test "ptype/o prog__rec" $exp
+ gdb_test "ptype/o pck__rec" $exp
}
diff --git a/gdb/testsuite/gdb.ada/ptype-o/pck.ads b/gdb/testsuite/gdb.ada/ptype-o/pck.ads
new file mode 100644
index 0000000..d1d1223
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ptype-o/pck.ads
@@ -0,0 +1,25 @@
+-- Copyright 2023-2024 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 Pck is
+ type Index is range 0 .. 31;
+ type Char_Array is array ( Index range <>) of Character;
+
+ type Rec (Length : Index) is
+ record
+ TV_Description : Char_Array (1 .. Length);
+ Note : Char_Array (1 .. Length);
+ end record;
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/ptype-o/prog.adb b/gdb/testsuite/gdb.ada/ptype-o/prog.adb
index f185b17..73e9963 100644
--- a/gdb/testsuite/gdb.ada/ptype-o/prog.adb
+++ b/gdb/testsuite/gdb.ada/ptype-o/prog.adb
@@ -13,16 +13,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-procedure Prog is
- type Index is range 0 .. 31;
- type Char_Array is array ( Index range <>) of Character;
-
- type Rec (Length : Index) is
- record
- TV_Description : Char_Array (1 .. Length);
- Note : Char_Array (1 .. Length);
- end record;
+with Pck; use Pck;
+procedure Prog is
X : Rec (7);
begin
null; -- BREAK