diff --git a/gdb/testsuite/gdb.ada/ptype-o.exp b/gdb/testsuite/gdb.ada/ptype-o.exp
index 5038ee171d2..1b6373c0f4b 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 00000000000..d1d12235f94
--- /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 .
+
+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 f185b17cb3e..73e9963550a 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 .
+with Pck; use Pck;
+
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;
-
X : Rec (7);
begin
null; -- BREAK