From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Make two Ada tests more robust
Date: Tue, 9 Jun 2026 10:38:25 -0600 [thread overview]
Message-ID: <20260609163825.3452764-1-tromey@adacore.com> (raw)
tasks.exp and task_watch.exp were failing when run with gnat-llvm.
Investigating these showed the same problem (which makes sense because
the tests use the same program). In this code:
for J in Task_List'Range loop -- STOP_HERE
Task_List (J).Call_Break_Me;
end loop;
... with GCC, the breakpoint set on the 'for' line is only hit a
single time. However, with gnat-llvm, the breakpoint is hit on every
iteration of the loop. IMO this is a GCC bug.
Similarly, at the end of the function:
null; -- STOP_HERE_2
... with gnat-llvm, a breakpoint set here was not being hit. It seems
perhaps somewhat strange to set a breakpoint on a null statement at
the end of a function; and while this might possibly be a gnat-llvm
bug, this isn't really the point of this test.
This patch makes these tests more robust by arranging for the
breakpoints to be set before the loop and on a call, respectively.
Because this is Ada-specific, was reviewed internally, and is just a
minor test case adjustment, I am checking it in.
---
gdb/testsuite/gdb.ada/task_watch.exp | 3 ++-
gdb/testsuite/gdb.ada/task_watch/foo.adb | 10 ++++++++--
gdb/testsuite/gdb.ada/tasks.exp | 3 ++-
gdb/testsuite/gdb.ada/tasks/foo.adb | 10 ++++++++--
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/task_watch.exp b/gdb/testsuite/gdb.ada/task_watch.exp
index a39773f4925..7031abf41ff 100644
--- a/gdb/testsuite/gdb.ada/task_watch.exp
+++ b/gdb/testsuite/gdb.ada/task_watch.exp
@@ -82,4 +82,5 @@ gdb_test "info tasks" \
# running to completion.
set bp_location [gdb_get_line_number "STOP_HERE_2" ${testdir}/foo.adb]
gdb_breakpoint foo.adb:$bp_location
-gdb_continue_to_breakpoint second ".*foo.adb:$bp_location.*null; -- STOP_HERE_2"
+gdb_continue_to_breakpoint second \
+ ".*foo.adb:$bp_location.*Do_Nothing; -- STOP_HERE_2"
diff --git a/gdb/testsuite/gdb.ada/task_watch/foo.adb b/gdb/testsuite/gdb.ada/task_watch/foo.adb
index 7db4565022b..c8ae2f389ba 100644
--- a/gdb/testsuite/gdb.ada/task_watch/foo.adb
+++ b/gdb/testsuite/gdb.ada/task_watch/foo.adb
@@ -24,6 +24,11 @@ procedure Foo is
end Caller;
type Caller_Ptr is access Caller;
+ procedure Do_Nothing is
+ begin
+ null;
+ end Do_Nothing;
+
procedure Break_Me is
begin
Value := Value + 1;
@@ -59,7 +64,8 @@ begin
-- Next, call their Call_Break_Me entry of each task, using the same
-- order as the order used to create them.
- for J in Task_List'Range loop -- STOP_HERE
+ Do_Nothing; -- STOP_HERE
+ for J in Task_List'Range loop
Task_List (J).Call_Break_Me;
end loop;
@@ -68,6 +74,6 @@ begin
Task_List (J).Finalize;
end loop;
- null; -- STOP_HERE_2
+ Do_Nothing; -- STOP_HERE_2
end Foo;
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index 9862663d566..b37cf0cadd1 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -178,7 +178,8 @@ gdb_test "info tasks" \
# running to completion.
set bp_location [gdb_get_line_number "STOP_HERE_2" ${testdir}/foo.adb]
gdb_breakpoint foo.adb:$bp_location
-gdb_continue_to_breakpoint second ".*foo.adb:$bp_location.*null; -- STOP_HERE_2"
+gdb_continue_to_breakpoint second \
+ ".*foo.adb:$bp_location.*Do_Nothing; -- STOP_HERE_2"
# A regression test for a crash caused by trying to find the thread
# for a terminated task.
diff --git a/gdb/testsuite/gdb.ada/tasks/foo.adb b/gdb/testsuite/gdb.ada/tasks/foo.adb
index f19672d6ae4..dfc6664130e 100644
--- a/gdb/testsuite/gdb.ada/tasks/foo.adb
+++ b/gdb/testsuite/gdb.ada/tasks/foo.adb
@@ -22,6 +22,11 @@ procedure Foo is
end Caller;
type Caller_Ptr is access Caller;
+ procedure Do_Nothing is
+ begin
+ null;
+ end Do_Nothing;
+
procedure Break_Me is
begin
null;
@@ -57,7 +62,8 @@ begin
-- Next, call their Call_Break_Me entry of each task, using the same
-- order as the order used to create them.
- for J in Task_List'Range loop -- STOP_HERE
+ Do_Nothing; -- STOP_HERE
+ for J in Task_List'Range loop
Task_List (J).Call_Break_Me;
end loop;
@@ -66,6 +72,6 @@ begin
Task_List (J).Finalize;
end loop;
- null; -- STOP_HERE_2
+ Do_Nothing; -- STOP_HERE_2
end Foo;
base-commit: 1eed06ae51d73a195b78ce0903ada9c9c2c14cfb
--
2.54.0
reply other threads:[~2026-06-09 16:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260609163825.3452764-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox