public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	"simark@simark.ca" <simark@simark.ca>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Enable multi process debugging for AIX
Date: Tue, 1 Nov 2022 13:55:35 +0000	[thread overview]
Message-ID: <CH2PR15MB35441C85018B3AAA2EA46801D6369@CH2PR15MB3544.namprd15.prod.outlook.com> (raw)
In-Reply-To: <709f1a28ed9d4b0d4aac5cb6d6946e2de452a3ec.camel@de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3384 bytes --]

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 <Ulrich.Weigand@de.ibm.com>
Sent: 28 October 2022 16:29
To: simark@simark.ca <simark@simark.ca>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; gdb-patches@sourceware.org <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Enable multi process debugging for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> 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


  reply	other threads:[~2022-11-01 13:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 15:53 Aditya Kamath1
2022-07-19 18:51 ` Simon Marchi
2022-07-22 16:56   ` Aditya Kamath1
2022-08-18 18:59   ` Aditya Kamath1
2022-08-21 17:15     ` Aditya Kamath1
2022-08-22 13:25     ` Ulrich Weigand
2022-08-22 14:19       ` Simon Marchi
2022-08-23  6:52       ` Aditya Kamath1
2022-10-19 10:57       ` Aditya Kamath1
2022-10-19 10:57         ` Aditya Kamath1
2022-10-28 10:59         ` Ulrich Weigand
2022-11-01 13:55           ` Aditya Kamath1 [this message]
2022-11-02  8:56             ` Ulrich Weigand
2022-11-10 10:39               ` Aditya Kamath1
2022-11-14 18:24                 ` Ulrich Weigand
2022-11-15  7:13                   ` Aditya Kamath1
2022-11-15 10:53                     ` Ulrich Weigand
2022-11-15 12:01                       ` Aditya Kamath1
2022-11-15 12:43                         ` Ulrich Weigand
2022-11-15 18:13                           ` Aditya Kamath1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR15MB35441C85018B3AAA2EA46801D6369@CH2PR15MB3544.namprd15.prod.outlook.com \
    --to=aditya.kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).