From: Tom Tromey Date: Wed, 30 Apr 2025 17:34:40 +0000 (-0600) Subject: Minor changes to Ada tests for gnat-llvm X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d14dd5887fc304368d01910c0e9544696283ddf;p=thirdparty%2Fbinutils-gdb.git Minor changes to Ada tests for gnat-llvm I found a few more spots where a minor modification to a test lets it pass with gnat-llvm: * For array_subcript_addr, gnat-llvm was not putting the array into memory. Making the array larger works around this. * For bp_inlined_func, it is normal for gnat-llvm to sometimes emit a call to an out-of-line copy of the function, so accept this. * For null_overload and type-tick-size, I've applied the usual fix for keeping an unused local variable alive. --- diff --git a/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb b/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb index eaa35c5d072..057d7a02a9c 100644 --- a/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb +++ b/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb @@ -14,11 +14,12 @@ -- along with this program. If not, see . procedure P is - type Table is array (1 .. 3) of Integer; + -- Make this large enough to force it into memory with gnat-llvm. + type Table is array (1 .. 15) of Integer; function Create (I : Integer) return Table is begin - return (4 + I, 8 * I, 7 * I + 4); + return (4 + I, 8 * I, 7 * I + 4, others => 72); end Create; A : Table := Create (7); diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func.exp b/gdb/testsuite/gdb.ada/bp_inlined_func.exp index 6593d1eb598..04cf755b99e 100644 --- a/gdb/testsuite/gdb.ada/bp_inlined_func.exp +++ b/gdb/testsuite/gdb.ada/bp_inlined_func.exp @@ -41,8 +41,10 @@ gdb_test "break read_small" \ for {set i 0} {$i < 4} {incr i} { with_test_prefix "iteration $i" { + # gnat-llvm may emit a call to an out-of-line copy, so allow + # for this here. gdb_test "continue" \ - "Breakpoint $bkptno_num_re, b\\.read_small \\(\\).*" \ + "Breakpoint $bkptno_num_re, ($hex in )?b\\.read_small \\(\\).*" \ "stopped in read_small" } } diff --git a/gdb/testsuite/gdb.ada/null_overload/foo.adb b/gdb/testsuite/gdb.ada/null_overload/foo.adb index 002238f3bf2..55d3fd6d5ce 100644 --- a/gdb/testsuite/gdb.ada/null_overload/foo.adb +++ b/gdb/testsuite/gdb.ada/null_overload/foo.adb @@ -13,6 +13,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +with pck; use pck; + procedure Foo is type R_Type is null record; @@ -38,5 +40,5 @@ procedure Foo is U_Ptr : U_P_T := null; begin - null; -- START + Do_Nothing (U_Ptr'Address); -- START end Foo; diff --git a/gdb/testsuite/gdb.ada/null_overload/pck.adb b/gdb/testsuite/gdb.ada/null_overload/pck.adb new file mode 100644 index 00000000000..95bd90a3db8 --- /dev/null +++ b/gdb/testsuite/gdb.ada/null_overload/pck.adb @@ -0,0 +1,23 @@ +-- Copyright 2020-2025 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 body Pck is + + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; + +end Pck; diff --git a/gdb/testsuite/gdb.ada/null_overload/pck.ads b/gdb/testsuite/gdb.ada/null_overload/pck.ads new file mode 100644 index 00000000000..114aee06ea6 --- /dev/null +++ b/gdb/testsuite/gdb.ada/null_overload/pck.ads @@ -0,0 +1,22 @@ +-- Copyright 2020-2025 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 . + +with System; + +package Pck is + + procedure Do_Nothing (A : System.Address); + +end Pck; diff --git a/gdb/testsuite/gdb.ada/type-tick-size/prog.adb b/gdb/testsuite/gdb.ada/type-tick-size/prog.adb index 34a9fca9fd0..a7457fd9cbc 100644 --- a/gdb/testsuite/gdb.ada/type-tick-size/prog.adb +++ b/gdb/testsuite/gdb.ada/type-tick-size/prog.adb @@ -50,6 +50,8 @@ procedure Prog is Rec_Type_Size : Integer := Rec'Object_Size; begin + Do_Nothing (Simple_Val'Address); + Do_Nothing (Rec_Val'Address); Do_Nothing (Static_Blob'Address); Do_Nothing (Dynamic_Blob'Address); null; -- STOP