]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Minor changes to Ada tests for gnat-llvm
authorTom Tromey <tromey@adacore.com>
Wed, 30 Apr 2025 17:34:40 +0000 (11:34 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 2 May 2025 14:13:58 +0000 (08:13 -0600)
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.

gdb/testsuite/gdb.ada/array_subscript_addr/p.adb
gdb/testsuite/gdb.ada/bp_inlined_func.exp
gdb/testsuite/gdb.ada/null_overload/foo.adb
gdb/testsuite/gdb.ada/null_overload/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/null_overload/pck.ads [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/prog.adb

index eaa35c5d072f456db0217bc1936d135515351515..057d7a02a9c3bfb9f7c2cbd02d31d889414a1531 100644 (file)
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 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);
index 6593d1eb598c3fa71cb0b18f6ae7fd0fea06e89a..04cf755b99e7fb4aac63eb15188c34a75f1b6d44 100644 (file)
@@ -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"
     }
 }
index 002238f3bf2f237de9d0b3d4a5beb12ad86912d5..55d3fd6d5ceac639a3afca35023287a13c9599e7 100644 (file)
@@ -13,6 +13,8 @@
 --  You should have received a copy of the GNU General Public License
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+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 (file)
index 0000000..95bd90a
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+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 (file)
index 0000000..114aee0
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+with System;
+
+package Pck is
+
+   procedure Do_Nothing (A : System.Address);
+
+end Pck;
index 34a9fca9fd08803c226beb0e2cb0699f75080313..a7457fd9cbc548da5ca96263605abb6d5eb39c31 100644 (file)
@@ -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