Hi, We have worked our way out through the pid!=0 assertion failure. Currently we also plan to come out soon with the patches for fork support as well in AIX. It will be great if we could get a review to the patch [Forwarded in this email] whenever you find time. Have a nice day ahead. Thanks and regards, Aditya ________________________________ From: Gdb-patches on behalf of Aditya Vidyadhar Kamath via Gdb-patches Sent: Friday, June 10, 2022 8:17 PM To: Simon Marchi Cc: Sangamesh Mallayya ; Simon Marchi via Gdb-patches Subject: [EXTERNAL] RE: [PATCH] Use current_inferior ()->pid for AIX Hi all, While testing programs in AIX I noticed that GDB crashes when an inferior exits, with this error: inferior.c:293: internal- error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. When a process exits inferior_ptid.pid is set to 0. Unfortunately, the rs6000-aix-nat target is still relying on the value of inferior_ptid in the case where an inferior exits - we return the value of inferior_ptid as the pid of the process that exited. The waitpid() system call suspends execution of the calling process until a child specified by pid argument has changed state. Once the inferior [assuming there is only one inferior] dies, waitpid() has no child to return. Due to this an ERRCHLD error is returned thereby returning an inferior_ptid.pid with 0 leading to this assertion failure. This patch is a fix to the same where we use the pid returned by the beneath wait using waitpid and adjust our inferior_ptid so that the rest of the code will take in the right values of both inferior_ptid and current_inferior. The following are the test results after running gdb.base test suite with the patch. # of expected passes 26244 # of unexpected failures 4230 # of unexpected successes 1 # of expected failures 17 # of known failures 26 # of unresolved testcases 110 # of untested testcases 79 # of unsupported tests 62 # of paths in test names 1 # of duplicate test names 4 The following are test results after running gdb.base test suite without the patch. # of expected passes 12935 # of unexpected failures 1988 # of unexpected successes 1 # of expected failures 3 # of known failures 6 # of unresolved testcases 159 # of untested testcases 77 # of unsupported tests 39 # of paths in test names 2 # of duplicate test names 13 Please find attached the patch. [See 0001-Fix-gdb_assert-pid-0-assertion-failure-in-AIX.patch]. Have a nice day ahead, Thanks and regards, Aditya. ________________________________ From: Simon Marchi Sent: Monday, May 30, 2022 6:15 PM To: Aditya Vidyadhar Kamath Cc: Sangamesh Mallayya ; Simon Marchi via Gdb-patches Subject: [EXTERNAL] Re: [PATCH] Use current_inferior ()->pid for AIX Hi, Re-adding gdb-patches, since it's information useful to everybody. On 2022-05-29 23:41, Aditya Vidyadhar Kamath wrote: > Hi Simon, > > Thank you so much for the feedback. Yes it makes sense. As I was trying to fix this we need one more information that will help us. > > Once an inferior finishes its execution where is the inferior_ptid's pid variable set to 0. Or who is the one [file name or function name] that updates inferior_ptid class variable pid to 0. This is done in the mourn_inferior target method. Many targets call the generic_mourn_inferior function, which calls switch_to_no_thread, which sets current_thread_ to nullptr and inferior_ptid to null_ptid. Simon