public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix gdb.threads/access-mem-running-thread-exit.exp with clang
@ 2024-04-10 10:19 Tom de Vries
  2024-04-10 16:00 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-04-10 10:19 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.threads/access-mem-running-thread-exit.exp with
clang, we run into:
...
(gdb) print global_var = 555^M
No symbol "global_var" in current context.^M
(gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: all-stop: \
  access mem (write to global_var, inf=2, iter=1)
...

The problem is that clang removes the unused variable.

Fix this in the same way as done in commit b4f767131f7
("Fix gdb.base/align-*.exp and Clang + LTO and AIX GCC"), by incrementing the
variable.

Tested on x86_64-linux with gcc and clang.
---
 gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
index 5902542ee5b..af05b13c763 100644
--- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
+++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
@@ -102,6 +102,8 @@ main (void)
 {
   int i;
 
+  global_var++;
+
   for (i = 0; i < 4; i++)
     {
       struct thread_arg *p;

base-commit: bdefc073061ff9e9334a1306e9c70745104dc57f
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/testsuite] Fix gdb.threads/access-mem-running-thread-exit.exp with clang
  2024-04-10 10:19 [PATCH] [gdb/testsuite] Fix gdb.threads/access-mem-running-thread-exit.exp with clang Tom de Vries
@ 2024-04-10 16:00 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-04-10 16:00 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> When running test-case gdb.threads/access-mem-running-thread-exit.exp with
Tom> clang, we run into:
Tom> ...
Tom> (gdb) print global_var = 555^M
Tom> No symbol "global_var" in current context.^M
Tom> (gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: all-stop: \
Tom>   access mem (write to global_var, inf=2, iter=1)
Tom> ...

Tom> The problem is that clang removes the unused variable.

Tom> Fix this in the same way as done in commit b4f767131f7
Tom> ("Fix gdb.base/align-*.exp and Clang + LTO and AIX GCC"), by incrementing the
Tom> variable.

Tom> Tested on x86_64-linux with gcc and clang.

Seems fine to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-10 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 10:19 [PATCH] [gdb/testsuite] Fix gdb.threads/access-mem-running-thread-exit.exp with clang Tom de Vries
2024-04-10 16:00 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).