Respected community members, Hi, I am currently working on fixing a bug on handling the thread exit event in AIX and displaying the same in UI. Currently, in AIX we miss the event resulting in incorrect display of info threads. For example, for the program 1 pasted below this email. This is a single process creating three more threads. The GDB output in AIX is:- (gdb) b main Breakpoint 1 at 0x10000788: file //gdb_tests/continue-pending-status_exit_test.c, line 44. (gdb) r Starting program: /gdb_tests/continue-pending-status_exit_test Breakpoint 1, main () at //gdb_tests/continue-pending-status_exit_test.c:44 44 alarm (300); (gdb) c Hello World Hello World Hello World [New Thread 258] [New Thread 515] [New Thread 772] Thread 1 received signal SIGINT, Interrupt. 0xd0611d70 in _p_nsleep () from /usr/lib/libpthreads.a(_shr_xpg5.o) (gdb) info threads Id Target Id Frame * 1 Thread 1 (tid 26607979) (tid 26607979, running) 0xd0611d70 in _p_nsleep () from /usr/lib/libpthreads.a(_shr_xpg5.o) 2 Thread 258 (tid 30998799) (tid 30998799, finished) aix-thread: ptrace (52, 30998799) returned -1 (errno = 3 The process does not exist.) The Linux output for the same is (gdb) b main Breakpoint 1 at 0x10000990: file test_thread.c, line 27. (gdb) r Starting program: /home/buildusr/binutils-gdb/gdb/test_thread [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, main () at test_thread.c:27 27 alarm (300); (gdb) c Continuing. [New Thread 0x7ffff7c7f170 (LWP 4032543)] [New Thread 0x7ffff746f170 (LWP 4032544)] [New Thread 0x7ffff6c5f170 (LWP 4032545)] Hello World Hello World Hello World [Thread 0x7ffff6c5f170 (LWP 4032545) exited] [Thread 0x7ffff746f170 (LWP 4032544) exited] [Thread 0x7ffff7c7f170 (LWP 4032543) exited] ^C Thread 1 "test_thread" received signal SIGINT, Interrupt. 0x00007ffff7da5b04 in nanosleep () from /lib64/libc.so.6 (gdb) info threads Id Target Id Frame * 1 Thread 0x7ffff7ff3e00 (LWP 4032541) 0x00007ffff7da5b04 in nanosleep () from /lib64/libc.so.6 (gdb) Reason why this happened. In Linux, I see in the linux-nat.c /* Check if the thread has exited. */ 2278 if (WIFEXITED (status) || WIFSIGNALED (status)) 2279 { This is where it gets handled when wait () is called. But in AIX, in sync_threadlist () despite having the code we miss the bus. If we observe the sync_threadlists () code our pcount and gcount remain the same despite the threads exiting resulting in, we not capturing the exit. The debugger checks why it had to wait (), goes to pd_activate (), then to pd_update (), then to sync_threadlists () where the event of threads born are captured. One interesting thing here is that in Linux the print “Hello World” happens after the thread born event is captured but in AIX it happens before. Are we missing something in AIX?? One information I want to give is we do go to wait () before the print Hello world happens, but we do not call pd_activate () and even if we do [We call it on purpose skipping the if condition in wait () in aix-thread.c], the thread debug session is not successful. In the next wait () event is when we capture the new thread or add_thread () event. There is one more wait () event that happens after this, but here as well AIX fails to capture the thread_exit event in sync_threadlists () since the pcount and gcount are the same. So, neither could we capture the thread exit nor found a way to correct it later because we missed the same. Kindly let me know the reasons you think from your experience on why this happened. This will help us fix this issue on AIX. Are all these thread related issues got to do with the fact that GDB core is expecting certain callbacks in the rs6000-aix-nat.c which currently does not exist? So, looking at the UI of Linux and this bug I also want to do two things in GDB code: 1: Move the kernel thread handling part to rs6000-aix-nat.c by using all the three fields in ptid i.e. pid, lwp and tid, so we can be in sync with Linux both in terms of event handling and UI display. [As Ulrich mentions here] 2: Contribute this test case as well to make sure these bugs are captured. So, is there anything similar already? In continuous-pending-status.exp, with the while (1) in the thread this issue I missed. Kindly let me know if the community is okay with the above or anything we have to keep in mind. Have a nice day ahead. Thanks and regards, Aditya. ======================================================================== Program 1:- #include #include #include #include #include pthread_barrier_t barrier; #define NUM_THREADS 3 void * thread_function (void *arg) { /* This ensures that the breakpoint is only hit after both threads are created, so the test can always switch to the non-event thread when the breakpoint triggers. */ pthread_barrier_wait (&barrier); printf ("Hello World \n"); /* break here */ } int main (void) { int i; alarm (300); pthread_barrier_init (&barrier, NULL, NUM_THREADS); for (i = 0; i < NUM_THREADS; i++) { pthread_t thread; int res; res = pthread_create (&thread, NULL, thread_function, NULL); assert (res == 0); } while (1) sleep (1); return 0; }