From fb77dfe48b5e40a5ed06f8482cd808a13e136db2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 12 Sep 2024 08:18:10 -0600 Subject: [PATCH] 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 --- gdb/testsuite/gdb.ada/ptype-o.exp | 2 +- gdb/testsuite/gdb.ada/ptype-o/pck.ads | 25 +++++++++++++++++++++++++ gdb/testsuite/gdb.ada/ptype-o/prog.adb | 11 ++--------- 3 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 gdb/testsuite/gdb.ada/ptype-o/pck.ads 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 . -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 -- 2.39.5