Hi Ulrich, >You should find out why the "priv" field isn't >set up correctly, and fix whatever was going >wrong there. (I believe this should have been >done in sync_threadlists.) You were right about this. What is happening is the main process and the thread representing it are treated as two separate threads by the libpthread library. Main process had no private data set whereas the thread representing it had. Usually, both of them should have it and their private data must be the same. For example , Consider the program below:- [ Program Credits:- GDB test case continue-pending-status.c] #include #include #include #include #include pthread_barrier_t barrier; #define NUM_THREADS 2 void * thread_function (void *arg) { pthread_barrier_wait (&barrier); while (1); /* 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; } Here is the gdb output of the above code, Clearly when I switched to thread 2 which same as thread1 and interrupted, thread 1 received the input. So, when we added a private data in sync_threadlists() we added for thread 2 but not 1 which is main thread and same as thread 1. This is why we got that assertion failure as thread 1 did not have a private data. Reading symbols from /home/XYZ/gdb_tests/continue-pending-status... (gdb) r Starting program: /home/XYZ/gdb_tests/continue-pending-status [New Thread 1] ^C[New Thread 258] [New Thread 515] Thread 1 received signal SIGINT, Interrupt. 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) info threads Id Target Id Frame * 1 process 12059046 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) 2 Thread 1 (tid 39125487, running) 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) 3 Thread 258 (tid 23396809, running) thread_function (arg=0x0) at continue-pending-status.c:36 4 Thread 515 (tid 36503883, running) thread_function (arg=warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.) 0x0) at continue-pending-status.c:36 (gdb) thread 2 [Switching to thread 2 (Thread 1)] #0 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) c Continuing. ^C Thread 1 received signal SIGINT, Interrupt. [Switching to process 12059046] 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) I have written my comments in the patch. Hope this works and if it is right kindly push the same in git, otherwise Let me know what you think. Have a nice day ahead. Thanks and regards, Aditya. ________________________________ From: Ulrich Weigand Sent: 28 October 2022 15:19 To: simark@simark.ca ; Aditya Kamath1 ; gdb-patches@sourceware.org Cc: Sangamesh Mallayya Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch Aditya Kamath1 wrote: > static aix_thread_info * > get_aix_thread_info (thread_info *thread) > { >+ if (thread->priv == NULL) >+ return NULL; This doesn't look right. Note that all users of get_aix_thread_info assume the pointer returned from there is never NULL. You should find out why the "priv" field isn't set up correctly, and fix whatever was going wrong there. (I believe this should have been done in sync_threadlists.) Bye, Ulrich