From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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>,
Sanket Rathi <sanrathi@in.ibm.com>
Subject: Re: [PATCH] Enable multi process debugging for AIX
Date: Tue, 15 Nov 2022 10:53:26 +0000 [thread overview]
Message-ID: <cdce0576f0f887356a2ca8f7b02db5d225ac9417.camel@de.ibm.com> (raw)
In-Reply-To: <BY5PR15MB3540691A4BF014D2D9A6D5FAD6049@BY5PR15MB3540.namprd15.prod.outlook.com>
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>I have made all the changes you mentioned for optimisation. Please find attached the patch.
Unfortunately it looks like this introduced a bug to has_my_aix_child_reported,
see below. Otherwise, there's only a few coding style issues left, then this
is ready to merge.
>+static pid_t
>+find_my_aix_parent (pid_t child_pid)
>+{
>+ struct procsinfo ProcessBuffer1;
>+ pid_t IndexPointer1 = child_pid;
>+ int Count = 1;
>+
>+ if (getprocs (&ProcessBuffer1, sizeof (ProcessBuffer1),
>+ NULL, 0, &IndexPointer1, Count) != 1)
You can just use ... &child_pid, 1 ... here, then you don't
need the separate variables.
>+static pid_t
>+has_my_aix_child_reported (pid_t parent_pid)
>+{
>+ pid_t child = 0;
>+ auto it = std::find_if (aix_pending_children.begin (),
>+ aix_pending_children.end (),
>+ find_my_aix_parent);
This is now wrong, unfortunately. This only checks that
"find_my_aix_parent" returns any non-null value, but it
actually needs to check that it returns "parent_pid".
This should be something along the lines of:
auto it = std::find_if (aix_pending_children.begin (),
aix_pending_children.end (),
[=] (pid_t child_pid)
{
return find_my_aix_parent (child_pid) == parent_pid;
});
>+has_my_aix_parent_reported (pid_t child_pid)
>+{
>+ pid_t my_parent = find_my_aix_parent (child_pid);
>+ auto it = std::find (aix_pending_parent.begin (),
>+ aix_pending_parent.end (),
>+ my_parent);
>+ if (it != aix_pending_parent.end ())
>+ {
>+ my_parent = *it;
This line shouldn't be necessary.
> /* Ignore terminated detached child processes. */
> if (!WIFSTOPPED (status) && find_inferior_pid (this, pid) == nullptr)
>- pid = -1;
>+ continue;
Here (and elsewhere) make sure to use a tab instead of 8 spaces.
Also, there should be no whitespace at the end of the line.
>+ if (pid != -1)
>+ {
This if is now no longer necessary.
>+ else
>+ break;
> }
>- while (pid == -1);
>-
>+ }
Whitespace (indentation) looks wrong.
>+ /* 0x7f is signal 0. */
>+ /* 0x17f and 0x137f in hexadecimal are status returned if
>+ if we follow parent,
>+ a switch is made to a child post parent execution
>+ and child continues its execution [user switches to child and
>+ presses continue]. */
Use a single comment block and try to make the lines of about
equal length if possible.
Bye,
Ulrich
next prev parent reply other threads:[~2022-11-15 10:53 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
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 [this message]
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=cdce0576f0f887356a2ca8f7b02db5d225ac9417.camel@de.ibm.com \
--to=ulrich.weigand@de.ibm.com \
--cc=Aditya.Kamath1@ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sangamesh.swamy@in.ibm.com \
--cc=sanrathi@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).