public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] gdbserver: hide fork child threads from GDB
Date: Fri, 26 Nov 2021 22:51:25 +0000	[thread overview]
Message-ID: <1e343901-2199-1034-2c05-be8668e2c8a5@palves.net> (raw)
In-Reply-To: <20211124200444.614978-2-simon.marchi@efficios.com>

On 2021-11-24 20:04, Simon Marchi via Gdb-patches wrote:

> I split the field in two (fork_parent / fork_child), I think it's
> clearer this way, easier to follow which thread is the parent and which
> is the child, and helps ensure things are consistent.  That simplifies
> things a bit in linux_set_resume_request.  

This had been conscientiously done that way to avoid storing redundant
information.  You could have the same thing with a single field + the
waitstatus, wrapped in fork_child()/fork_parent() methods.  But I'm fine with
with that you have.  I do see a different reason for taking the two-fields approach
though -- you don't have access to the pending waitstatus in common code.
That would be a better rationale, IMO.  OTOH, I think we will end up needing
access to the pending waitstatus anyhow.  See below, and the review to patch #3.

> Currently, when
> lwp->fork_relative is set, we have to deduce whether this is a parent or
> child using the pending event.  With separate fork_parent and fork_child
> fields, it becomes more obvious.  If the thread has a fork parent, then
> it means it's a fork child, and vice-versa.

With clone events, in some spots I'll need to be able to know whether
fork_child being set means the thread is stopped for a fork/vfork or a
clone event.  Most of the code related to fork_parent/fork_child is the
same for forks and for clones, but not all.

Wonder whether we should instead have some:

  thread_info *target_pending_child (thread_info *parent);
  thread_info *target_pending_child_parent (thread_info *child);
  target_waitkind target_pending_child_kind (thread_info *parent);

target methods instead of moving the fields.  I haven't thought this
fully through, though.

  reply	other threads:[~2021-11-26 22:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 20:33 [PATCH 1/2] " Simon Marchi
2021-10-29 20:33 ` [PATCH 2/2] gdb, gdbserver: detach fork child when detaching from fork parent Simon Marchi
2021-11-12 20:54 ` [PATCH 1/2] gdbserver: hide fork child threads from GDB (ping) Simon Marchi
2021-11-24 20:04 ` [PATCH 0/3] Fix handling of pending fork events Simon Marchi
2021-11-24 20:04   ` [PATCH 1/3] gdbserver: hide fork child threads from GDB Simon Marchi
2021-11-26 22:51     ` Pedro Alves [this message]
2021-11-29 12:46       ` Simon Marchi
2021-11-29 15:37         ` Pedro Alves
2021-11-24 20:04   ` [PATCH 2/3] gdb/linux-nat: factor ptrace-detach code to new detach_one_pid function Simon Marchi
2021-11-26 22:51     ` Pedro Alves
2021-11-24 20:04   ` [PATCH 3/3] gdb, gdbserver: detach fork child when detaching from fork parent Simon Marchi
2021-11-26 22:54     ` Pedro Alves
2021-11-29 18:27       ` Simon Marchi
2021-11-24 20:56   ` [PATCH 0/3] Fix handling of pending fork events Simon Marchi
2021-11-26 22:50   ` Pedro Alves

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=1e343901-2199-1034-2c05-be8668e2c8a5@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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).