Hi all, Please find attached a patch. {See: 0001-Fix-Assertion-pid-0-failure-in-AIX.patch} Consider the example foll-fork-other-thread.c code from the gdb.threads testsuite. I have pasted the same below along with the output before and after applying the patch. Once the thread completes execution and goes to pd_disable () in aix-thread.c , since the process exits, the inferior_ptid.pid () is 0. Hence in pd_disable () when GDB goes to fetch the aix thread data for process 0, this assertion failure occurs. This patch is a fix for the same. Kindly let me know if there are any changes needed. If not kindly push this patch. Have a nice day ahead. Thanks and regards, Aditya. ------------------------------------------------------- Code:- { Program Credits: GDB threads testsuite} #include #include #include #include #include #include #include /* Set by GDB. */ volatile int stop_looping = 0; static void * gdb_forker_thread (void *arg) { int ret; int stat; pid_t pid = FORK_FUNC (); if (pid == 0) _exit (0); assert (pid > 0); /* Wait for child to exit. */ do { ret = waitpid (pid, &stat, 0); } while (ret == -1 && errno == EINTR); assert (ret == pid); assert (WIFEXITED (stat)); assert (WEXITSTATUS (stat) == 0); stop_looping = 1; return NULL; } static void sleep_a_bit (void) { usleep (1000 * 50); } int main (void) { int i; int ret; pthread_t thread; alarm (60); ret = pthread_create (&thread, NULL, gdb_forker_thread, NULL); assert (ret == 0); while (!stop_looping) /* while loop */ { sleep_a_bit (); /* break here */ sleep_a_bit (); /* other line */ } pthread_join (thread, NULL); return 0; /* exiting here */ } ---------------------------------------- Output before patch:- ./gdb ~/gdb_tests/foll-fork-other-thread GNU gdb (GDB) 14.0.50.20230327-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/aditya/gdb_tests/foll-fork-other-thread... (gdb) r Starting program: /home/aditya/gdb_tests/foll-fork-other-thread [New Thread 258] [Detaching after fork from child process 10944778] [Inferior 1 (process 7209300) exited normally] inferior.c:350: internal-error: find_inferior_pid: Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x100f7d307 ??? 0x100f7d4cf ??? -------------------------------------------------------- Output after applying patch:- bash-5.1$ ./gdb ~/gdb_tests/foll-fork-other-thread GNU gdb (GDB) 14.0.50.20230327-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/aditya/gdb_tests/foll-fork-other-thread... (gdb) r Starting program: /home/aditya/gdb_tests/foll-fork-other-thread [New Thread 258] [Detaching after fork from child process 7209320] [Inferior 1 (process 10944912) exited normally] (gdb)