Hi Ulrich, >There is one difference between AIX and the way freebsd can handle. >freebsd gets the parent child relationship via a structure which has >this info. This is obtained using LWP_INFO option in the ptrace () call. >However, in AIX we do not have the same luxury of LWP_INFO. Is there any other way of figuring out what the parent process of the new child is? Maybe you should just do that when you get the child event. I fully did not get the above suggestion " Maybe you should just do that when you get the child event ". Kindly let me know what you are trying to tell me in this context. Have a nice day ahead. Thanks and regards, Aditya ________________________________ From: Ulrich Weigand Sent: 28 October 2022 16:29 To: simark@simark.ca ; Aditya Kamath1 ; gdb-patches@sourceware.org Cc: Sangamesh Mallayya Subject: Re: [PATCH] Enable multi process debugging for AIX Aditya Kamath1 wrote: >I have addressed your issue of having a fork () events from other threads. To clarify: I was not only concerned about *fork* events from other threads, but *any* events from other threads. For example, if a multi-threaded process forks, is it possible that in the time between the parent and child fork events arrive, some other thread hits a breakpoint and that event is reported to GDB? Or if GDB is already debugging multiple processes, could some event from a completely different process arrive in between? >I have kept an assertion as well just in case I get some other event >apart from fork () comes in while I figure out the parent child relationship. >Ideally, I shouldn't get any other event in AIX. I believe in the scenarios above, you would run into that assertion. I still think that the proper fix is to *not* have any secondary loop around waitpid. Instead, just use the main GDB event loop; it'll get back to you once the second event arrives, and in the meantime other intervening events will be processed as usual. >There is one difference between AIX and the way freebsd can handle. >freebsd gets the parent child relationship via a structure which has >this info. This is obtained using LWP_INFO option in the ptrace () call. >However, in AIX we do not have the same luxury of LWP_INFO. Is there any other way of figuring out what the parent process of the new child is? Maybe you should just do that when you get the child event. >Coming to the W_SFWTED, this also is taken care. Kindly see the >did_aix_inferior_fork () function. This logic seems a bit strange to me: >+ /* If multi-process debug mode is enabled, the status >+ location is set to W_SFWTED. */ >+ >+ status = status & 0xff; >+ >+ /* Eliminate the last few bits. If the W_SFWTED is set >+ which is equal to 0x7e, it is a fork event otherwise >+ it is not. */ >+ >+ if (status ^ W_SFWTED) >+ return false; >+ else >+ return true; I understand W_SFWTED is not a bit mask, but simply a value. So shouldn't you just test for "status == W_SFWTED"? Also, I'm not sure where the "& 0xff" comes into play. What are the contents of the high bits? The AIX documentation doesn't seem to say ... Bye, Ulrich