public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>,
	Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCHv3 7/7] gdb: some process_stratum_target should not be shared
Date: Wed, 14 Dec 2022 13:57:03 +0000	[thread overview]
Message-ID: <87h6xy1428.fsf@redhat.com> (raw)
In-Reply-To: <87fsegqgur.fsf@tromey.com>

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Andrew> For things like the Linux and FreeBSD native targets, as well as the
> Andrew> remote target, this is absolutely true (or was made true).  But some
> Andrew> targets were never updated to be shareable, for example, the
> Andrew> core_target, which is used when reading core-files, stores some of its
> Andrew> state in the program_space, but also, the core-file and the executable
> Andrew> being debugged are closely related.
>
> Andrew> As each add-inferior call creates an inferior with a new
> Andrew> program_space, and doesn't automatically copy the executable, or the
> Andrew> current core-file, I don't think it really makes sense to "share"
> Andrew> core_target objects between inferiors.
>
> Yeah, probably the core target just doesn't even make sense to share.
>
> I guess if we did want to share it, we could move the state into the
> core target.  Maybe this is worthwhile to do anyway?  I see a bunch of
> uses of core_bfd (which is a #define reaching into the program space),
> but some, e.g. in linux_read_core_file_mappings, seem like they could be
> replaced with a parameter.
>
> Andrew> I think this behaviour might be confusing, so I'd like to have GDB not
> Andrew> initially share the core connection.  Instead, when the user tries to
> Andrew> add the new inferior a warning is given, and the new inferior is
> Andrew> created without a connection, like this:
>
> This makes sense to me.
>
> Andrew> +  /* The core_target only works for the inferior in which it was initially
> Andrew> +     opened, and can't be copied to some other inferior's target_stack.  */
> Andrew> +  bool is_shareable () override
> Andrew> +  { return false; }

Tom,

Thanks for all the reviews on this series.  Sorry it's taken me so long
to look at these patches again.

>
> However, why only mark the core target this way?

Mostly, because that was the only target I'd run into problems with.

> I think there are a lot of other targets that can't be
> shared... remote-sim, all the trace targets, even I think windows-nat,
> since it isn't multi-inferior-capable yet.
>
> So maybe the default implementation should be 'return false' and then
> specific known-good targets should override it?

Mostly I'm just nervous about making such sweeping changes.  As a result
I tend to go smaller and try to only change the minimum needed to fix
the issue I'm seeing.  But I think you're right, I should probably
consider if the default makes more sense the other way around.

I've fixed all the issues you pointed out with patches 1->6, so I'm
going to go ahead and merge them, then take another look at patch 7, and
I'll post an updated version.

Thanks,
Andrew


      reply	other threads:[~2022-12-14 13:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 13:12 [PATCH] gdb: fix target_ops reference count for some cases Andrew Burgess
2022-09-21 15:30 ` Simon Marchi
2022-09-22 14:21   ` Andrew Burgess
2022-09-22 14:52     ` Simon Marchi
2022-09-22 15:00 ` Simon Marchi
2022-09-22 17:24   ` Andrew Burgess
2022-09-26 14:16     ` Simon Marchi
2022-10-01 20:58       ` Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 0/7] " Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 1/7] gdb/remote: remove some manual reference count handling Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 2/7] gdb: remove decref_target Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 3/7] gdb: have target_stack automate reference count handling Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 4/7] gdb: remove the pop_all_targets (and friends) global functions Andrew Burgess
2022-10-05 20:49     ` Lancelot SIX
2022-10-06 11:14       ` Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 5/7] gdb: ensure all targets are popped before an inferior is destructed Andrew Burgess
2022-10-02 17:04   ` [PATCHv2 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Andrew Burgess
2022-10-02 17:21     ` Eli Zaretskii
2022-10-02 17:04   ` [PATCHv2 7/7] gdb: some process_stratum_target should not be shared Andrew Burgess
2022-10-02 17:21     ` Eli Zaretskii
2022-10-05 21:15     ` Lancelot SIX
2022-10-06 11:44       ` Andrew Burgess
2022-11-18 16:42   ` [PATCHv3 0/7] gdb: fix target_ops reference count for some cases Andrew Burgess
2022-11-18 16:42     ` [PATCHv3 1/7] gdb/remote: remove some manual reference count handling Andrew Burgess
2022-11-18 16:42     ` [PATCHv3 2/7] gdb: remove decref_target Andrew Burgess
2022-11-18 17:22       ` Tom Tromey
2022-11-18 16:42     ` [PATCHv3 3/7] gdb: have target_stack automate reference count handling Andrew Burgess
2022-11-18 17:25       ` Tom Tromey
2022-11-18 16:42     ` [PATCHv3 4/7] gdb: remove the pop_all_targets (and friends) global functions Andrew Burgess
2022-11-18 17:29       ` Tom Tromey
2022-11-18 16:42     ` [PATCHv3 5/7] gdb: ensure all targets are popped before an inferior is destructed Andrew Burgess
2022-11-18 16:42     ` [PATCHv3 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Andrew Burgess
2022-11-18 17:03       ` Eli Zaretskii
2022-11-18 16:42     ` [PATCHv3 7/7] gdb: some process_stratum_target should not be shared Andrew Burgess
2022-11-18 17:02       ` Eli Zaretskii
2022-11-18 18:04       ` Tom Tromey
2022-12-14 13:57         ` Andrew Burgess [this message]

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=87h6xy1428.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).