]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix gdb.ada/mi_ex_cond.exp when libgnat debuginfo is installed
authorTom Tromey <tom@tromey.com>
Mon, 9 Feb 2026 03:52:04 +0000 (20:52 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 9 Feb 2026 21:33:47 +0000 (14:33 -0700)
When libgnat debuginfo is installed, gdb.ada/mi_ex_cond.exp will fail.
I tracked this down to two problems:

1. The MI output has changed a little.  This probably wasn't noticed
   because this test only works when libgnat debuginfo is available,
   which isn't the norm.  This patch updates the expected output.

2. The variable "I" in the test triggers the Ada disambiguation menu,
   because some variables named "I" are visible in libgnat.  While at
   its root this is a deeper problem in the Ada support, it's
   complicated to fix this.  Since this isn't the point of the test,
   this patch just renames the variable in question.

There are some other Ada tests that fail in this setup, but I think
they are a bit more complicated to fix.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/testsuite/gdb.ada/mi_ex_cond.exp
gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb
gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads

index 7567723ce5efa80f1cf376ec89048e5d3b961cf2..a5adb5c3cbf04ce1053e0d3ca805601b0775d278 100644 (file)
@@ -37,9 +37,9 @@ if {[mi_clean_restart $::testfile]} {
 # And finally, the meat of the testcase... Insert an Ada exception
 # catchpoint that uses both conditions and exception name.
 
-mi_gdb_test "-catch-exception -c \"i = 2\" -e constraint_error" \
-    "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`constraint_error' Ada exception\",.*,cond=\"i = 2\",.*}" \
-    "catch C_E if i = 2"
+mi_gdb_test "-catch-exception -c \"the_test_index = 2\" -e constraint_error" \
+    "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`constraint_error' Ada exception\",cond=\"the_test_index = 2\",.*}" \
+    "catch C_E if the_test_index = 2"
 
 # It is important that we start the program's execution after having
 # inserted the exception catchpoint above.  We want to verify that
@@ -59,5 +59,5 @@ mi_expect_stop \
 # a clobbering of some of the exeption's info.
 
 mi_gdb_test "-break-list" \
-    "\\^done,.*,what=\"`constraint_error' Ada exception\",.*,cond=\"i = 2\",.*" \
+    "\\^done,.*,what=\"`constraint_error' Ada exception\",.*,cond=\"the_test_index = 2\",.*" \
     "-break-list"
index 3e3b5c3b3c3d1bf860e9e8618c71671af305be78..ed281ef229a8b346eab0936036a3568daed01a55 100644 (file)
@@ -17,13 +17,13 @@ with Pck; use Pck;
 
 procedure Foo is
 begin
-   while I <= 3 loop
+   while The_Test_Index <= 3 loop
       begin
          raise Constraint_Error;
       exception
          when others =>
             null;
       end;
-      I := I + 1;
+      The_Test_Index := The_Test_Index + 1;
    end loop;
 end Foo;
index a71c3047092188bec0ae7b82a0d110f74beb3342..66de451045cdb22c9185eb66ff951ab7336a8df6 100644 (file)
@@ -14,5 +14,5 @@
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package Pck is
-   I : Integer := 1;
+   The_Test_Index : Integer := 1;
 end Pck;