Add gdb.threads/thread_events.exp to run in AIX as well

Message ID CH2PR15MB3544E91B908E5A4F78388236D6122@CH2PR15MB3544.namprd15.prod.outlook.com
State New
Headers
Series Add gdb.threads/thread_events.exp to run in AIX as well |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Aditya Kamath1 April 23, 2024, 4:56 p.m. UTC
  Respected Tom, Ulrich and community members,

Hi,

Please find attached a patch pasted below this email. The gdb.threads/thread_events.exp is a very good testcase that should run in AIX as well. Currently it is not.

This test case is a nice test for the issue we are resolving here<https://sourceware.org/pipermail/gdb-patches/2024-April/208104.html>. [https://sourceware.org/pipermail/gdb-patches/2024-April/208104.html]. I was looking around for a test like this and just figured this out. Since this was not running on AIX we had to write our own to test to solve that issue.

Would the community mind if AIX runs this test case as well?? Instead of contributing a new one, this one tests what we are looking for perfectly.

So this test has one failure in AIX.

=== gdb Summary ===

# of expected passes            10
# of unexpected failures        1

I can tell you why this happened.

Reading symbols from testsuite/gdb.threads/thread_events...
(gdb) b main
Breakpoint 1 at 0x100007dc: file gdb.threads/thread_events.c, line 41.
(gdb) b threadfunc
Breakpoint 2 at 0x10000718: file gdb.threads/thread_events.c, line 27.
(gdb) b after_join_func
Breakpoint 3 at 0x10000778: file gdb.threads/thread_events.c, line 34.
(gdb) r
Starting program: /current_gdb/binutils-gdb/gdb/testsuite/gdb.threads/thread_events

Breakpoint 1, main (argc=1, argv=0x2ff22950) at gdb.threads/thread_events.c:41
41        if (pthread_create (&thread, NULL, threadfunc, NULL) != 0)
(gdb) c
Continuing.
[New Thread 258 (tid 30540187)]
[Switching to Thread 258 (tid 30540187)]

Thread 2 hit Breakpoint 2, threadfunc (arg=0x0) at gdb.threads/thread_events.c:27
27        printf ("in threadfunc\n");
(gdb) c
Continuing.
in threadfunc
[Switching to Thread 1 (tid 31326575)]

Thread 1 hit Breakpoint 3, after_join_func () at gdb.threads/thread_events.c:34
34        printf ("finished\n");
(gdb) info threads
  Id   Target Id                             Frame
* 1    Thread 1 (tid 31326575) ([running])   after_join_func () at gdb.threads/thread_events.c:34
  2    Thread 258 (tid 30540187) ([unknown])

The last part of the test case is the problem actually. We did not handle unknown state in sync_threadlists (). The thread 258 completed its execution and we did not catch the same. Also, we are not handling unknown state as of now in aix-thread.c. We only handle PST_TERM. Which is the reason for the one failure.

Anyway, I will fix it in the other thread.

Let me know what you think. Kindly apply this patch if it is okay.

Have a nice day ahead.

Thanks and regards,
Aditya.



# cat patches/0001-Add-gdb.threads-thread_events.exp-to-run-in-AIX-as-w.patch
From 73dac7610d2ecf3120dc06542a88ff6dc555da71 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath Aditya.Kamath1@ibm.com<mailto:Aditya.Kamath1@ibm.com>
Date: Mon, 22 Apr 2024 10:32:13 -0500
Subject: [PATCH] Add gdb.threads/thread_events.exp to run in AIX as well

---
gdb/testsuite/gdb.threads/thread_events.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--
2.41.0
  

Comments

Tom Tromey April 25, 2024, 1:51 p.m. UTC | #1
> Would the community mind if AIX runs this test case as well?? Instead
> of contributing a new one, this one tests what we are looking for
> perfectly.

Sounds good.

> Let me know what you think. Kindly apply this patch if it is okay.

It would be more convenient if you sent patches with 'git send-email'.
Something mangled this one so it can't really be directly applied.

Tom
  
Aditya Kamath1 April 29, 2024, 2 a.m. UTC | #2
>It would be more convenient if you sent patches with 'git send-email'.
>Something mangled this one so it can't really be directly applied.

I have sent the patch in another email using git send-email. Kindly apply the same. It will be in another thread named with subject “[EXTERNAL] [PATCH] Add gdb.threads/thread_events.exp to run in AIX as well”.

I will send all the GDB patches using git-send email from here on.

Kindly let me know if anything needed.

Have a nice day ahead.

Thanks and regards,
Aditya.

From: Tom Tromey <tom@tromey.com>
Date: Thursday, 25 April 2024 at 7:21 PM
To: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Cc: Tom Tromey <tom@tromey.com>, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>
Subject: [EXTERNAL] Re: [PATCH] Add gdb.threads/thread_events.exp to run in AIX as well
> Would the community mind if AIX runs this test case as well?? Instead
> of contributing a new one, this one tests what we are looking for
> perfectly.

Sounds good.

> Let me know what you think. Kindly apply this patch if it is okay.

It would be more convenient if you sent patches with 'git send-email'.
Something mangled this one so it can't really be directly applied.

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.threads/thread_events.exp b/gdb/testsuite/gdb.threads/thread_events.exp
index 100205e5f58..11a89139384 100644
--- a/gdb/testsuite/gdb.threads/thread_events.exp
+++ b/gdb/testsuite/gdb.threads/thread_events.exp
@@ -23,7 +23,8 @@ 

# This test has only been verified with Linux targets, and would need
# to be generalized to support other targets
-if {![istarget *-*-linux*]} {
+
+if {!([istarget *-*-linux*] || [istarget *-*-aix*])} {
     return
}