Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: John Baldwin <jhb@FreeBSD.org>,
	Simon Marchi <simon.marchi@efficios.com>,
	 gdb-patches@sourceware.org
Subject: Re: [PATCH 6/6] gdb: don't share aspace/pspace on fork with "detach-on-fork on" and "follow-fork-mode child"
Date: Mon, 27 Sep 2021 15:32:18 -0400	[thread overview]
Message-ID: <41efe1d2-64fe-b0d1-029f-363bfc567bf5@polymtl.ca> (raw)
In-Reply-To: <58ca5b53-9d70-b8e7-e4c9-86b9f080f731@polymtl.ca>

On 2021-09-10 23:16, Simon Marchi via Gdb-patches wrote:
>>> Note that the problem described above happens today with "detach-on-fork
>>> off" and "follow-fork-mode child", because we create new spaces for the
>>> child.  This will have to be addressed later.
>>>
>>> Test-wise, improve gdb.base/foll-fork.exp to set a breakpoint that is
>>> expected to have a location in each inferiors.  Without the fix, when
>>> the two inferiors erroneously share a program space, GDB reports a
>>> single location.
>>
>> So I wonder about the case where follow-fork-mode is parent and
>> detach-on-fork is off?  In that case, should the existing aspace/pspace
>> stay with the parent and the child get clones?  That is, using the
>> follow-fork-mode setting to determine which inferior gets the existing
>> aspace/pspace and assigning the cloned copies to the !follow-fork-mode
>> inferior?
> 
> I think that would work, to address the problem described above.

FYI, I tried doing the above (giving the original program space to the
child with "follow-fork-mode child" and "detach-on-fork off") and I hit
some problems.  Attached to the program space is the list of shared
libraries.  So GDB would now think the parent has no shared library.  I
added a solib_create_inferior_hook call to force re-discovering the
shared libraries in the parent.  That seemed to work, but then in MI
there were spurious =library-loaded events that made it look like
inferior 1 re-loaded shared libraries.  I'm also worried about what
other per-program space is kept, that could cause some kind of trouble
for the parent.  So I will put this off for now, as it's not something
that should be done in a rush, I think.

In the mean time, I'll re-test this series and push it if all seems
good.

Simon

  parent reply	other threads:[~2021-09-27 19:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 20:53 [PATCH 1/6] gdb.base/foll-fork.exp: remove DUPLICATEs Simon Marchi via Gdb-patches
2021-09-10 20:53 ` [PATCH 2/6] gdb.base/foll-fork.exp: remove gating based on target triplet Simon Marchi via Gdb-patches
2021-09-10 20:53 ` [PATCH 3/6] gdb.base/foll-fork.exp: refactor to restart GDB between each portion of the test Simon Marchi via Gdb-patches
2021-09-10 20:54 ` [PATCH 4/6] gdb.base/foll-fork.exp: rename variables Simon Marchi via Gdb-patches
2021-09-10 20:54 ` [PATCH 5/6] gdb.base/foll-fork.exp: use foreach_with_prefix to handle prefixes Simon Marchi via Gdb-patches
2021-09-10 20:54 ` [PATCH 6/6] gdb: don't share aspace/pspace on fork with "detach-on-fork on" and "follow-fork-mode child" Simon Marchi via Gdb-patches
2021-09-10 23:33   ` John Baldwin
2021-09-11  3:16     ` Simon Marchi via Gdb-patches
2021-09-11 13:02       ` Simon Marchi via Gdb-patches
2021-09-11 13:03         ` Simon Marchi via Gdb-patches
2021-09-27 19:32       ` Simon Marchi via Gdb-patches [this message]
2021-09-28 15:10         ` Tom de Vries via Gdb-patches
2021-09-28 19:12           ` Simon Marchi via Gdb-patches
2021-09-28 19:31             ` Pedro Alves
2021-09-28 19:35               ` Pedro Alves
2021-09-28 23:32                 ` Simon Marchi via Gdb-patches
2021-09-28 22:38             ` Tom de Vries via Gdb-patches
2021-09-23 19:23 ` [PATCH 1/6] gdb.base/foll-fork.exp: remove DUPLICATEs 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=41efe1d2-64fe-b0d1-029f-363bfc567bf5@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.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