From: Tom Tromey Date: Mon, 9 Feb 2026 03:52:04 +0000 (-0700) Subject: Fix gdb.ada/mi_ex_cond.exp when libgnat debuginfo is installed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=540c6398c3d3f6a9fe5a615abf6cc763f9189d2c;p=thirdparty%2Fbinutils-gdb.git Fix gdb.ada/mi_ex_cond.exp when libgnat debuginfo is installed 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 --- diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp index 7567723ce5e..a5adb5c3cbf 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp +++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp @@ -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" diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb b/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb index 3e3b5c3b3c3..ed281ef229a 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb +++ b/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb @@ -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; diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads b/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads index a71c3047092..66de451045c 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads +++ b/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads @@ -14,5 +14,5 @@ -- along with this program. If not, see . package Pck is - I : Integer := 1; + The_Test_Index : Integer := 1; end Pck;