]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix type name in ptype-o.exp
authorTom Tromey <tromey@adacore.com>
Thu, 12 Sep 2024 14:18:10 +0000 (08:18 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 6 Mar 2025 21:17:17 +0000 (14:17 -0700)
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

gdb/testsuite/gdb.ada/ptype-o.exp
gdb/testsuite/gdb.ada/ptype-o/pck.ads [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype-o/prog.adb

index 5038ee171d2b126270181d37770a47d37319ba95..1b6373c0f4bad2a34298b843a69713b14d346077 100644 (file)
@@ -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 (file)
index 0000000..d1d1223
--- /dev/null
@@ -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;
index f185b17cb3ed145f6041f9d61bc91d12f93d648d..73e9963550a9626a0cd9c376c25ea9960614f073 100644 (file)
 --  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