public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 10/10] remote: one struct remote_state per struct remote_target
Date: Tue, 22 May 2018 05:07:00 -0000	[thread overview]
Message-ID: <ec0e571b-87a2-574d-f060-690b42889832@simark.ca> (raw)
In-Reply-To: <20180516141830.16859-11-palves@redhat.com>

On 2018-05-16 10:18 AM, Pedro Alves wrote:
> 'struct remote_state' today contains per-connection state, however
> there's only a single global instance of that type.  In order to
> support multiple connections, we must have one such object per
> connection.
> 
> Thus this patch eliminates the 'remote_state' global in favor of
> having a remote_state instance per remote_target instance.
> 
> The get_remote_state free function is eliminated as well, by making it
> a remote_target method instead.
> 
> The patch then fixes the fallout by making all free functions that
> refer to get_remote_state() directly or indirectly be methods of
> remote_target too.
> 
> Likewise, remote-fileio.c and remote-notif.c routines are
> parameterized with a remote_target pointer too, so they can call into
> the right remote_target instance.
> 
> References to the global 'get_remote_state ()->remote_desc' to tell
> whether the remote target is open (!= nullptr) must be replaced with
> something else:
> 
>  - Command implementations use a new get_current_remote_target free
>  function.
> 
>  - remote_target::open_1 checks the exception type instead.
> 
> Finally, remote_target and extended_remote_target are made
> heap-allocated targets.  As with the earlier core target patches, it
> still won't be possible to have more than one remote_target instance
> in practice, but this puts us closer.

Hi Pedro,

I took a rather quick look, because a lot of the changes are mecanical,
once you have set the premises you pointed out in the commit message
(and I think they are fine).

Two nits:

Is there a reason not to make the remote_state object a simple field
of remote_target, does it have to be a pointer?  You would have to
shuffle things around a little bit more, but it seems to work fine.

> @@ -6287,7 +6512,7 @@ remote_target::commit_resume ()
>       we end up with too many actions for a single packet vcont_builder
>       flushes the current vCont packet to the remote side and starts a
>       new one.  */
> -  struct vcont_builder vcont_builder;
> +  struct vcont_builder vcont_builder (this);
>    vcont_builder.restart ();

That's more a comment for the previous patch, but: I find it strange to
have to call restart just after building the object. Couldn't the
constructor leave it in a ready to use state?

Simon

  reply	other threads:[~2018-05-22  3:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 14:18 [PATCH 00/10] remote: More multi-target preparation Pedro Alves
2018-05-16 14:18 ` [PATCH 09/10] remote: Make vcont_builder a class Pedro Alves
2018-05-22  5:07   ` Simon Marchi
2018-05-22 21:33     ` Pedro Alves
2018-05-16 14:18 ` [PATCH 01/10] remote: struct remote_state, use op new Pedro Alves
2018-05-18 20:57   ` Simon Marchi
2018-05-21 15:36     ` [PATCH 1.2 01/10] remote: struct remote_state, use op new, fix leaks Pedro Alves
2018-05-16 14:18 ` [PATCH 02/10] remote: Eliminate remote_hostio_close_cleanup Pedro Alves
2018-05-16 17:43   ` Tom Tromey
2018-05-16 18:53     ` Pedro Alves
2018-05-16 19:46       ` Tom Tromey
2018-05-18 21:04   ` Simon Marchi
2018-05-16 14:18 ` [PATCH 10/10] remote: one struct remote_state per struct remote_target Pedro Alves
2018-05-22  5:07   ` Simon Marchi [this message]
2018-05-22 21:06     ` Pedro Alves
2018-05-24 17:00       ` [PATCH 11/10] remote_target::m_remote_state, pointer -> object (Re: [PATCH 10/10] remote: one struct remote_state per struct remote_target) Pedro Alves
2018-05-25  5:23         ` Simon Marchi
2018-05-16 14:25 ` [PATCH 05/10] remote: remote_arch_state pointers -> remote_arch_state objects Pedro Alves
2018-05-18 21:17   ` Simon Marchi
2018-05-18 21:18     ` Simon Marchi
2018-05-21 16:12       ` Pedro Alves
2018-05-16 14:25 ` [PATCH 03/10] remote: Make readahead_cache a C++ class Pedro Alves
2018-05-18 21:06   ` Simon Marchi
2018-05-16 14:27 ` [PATCH 04/10] remote: multiple remote_arch_state instances per arch Pedro Alves
2018-05-18 21:09   ` Simon Marchi
2018-05-16 14:28 ` [PATCH 08/10] Handle "show remote memory-write-packet-size" when not connected Pedro Alves
2018-05-18 21:42   ` Simon Marchi
2018-05-21 20:41     ` Pedro Alves
2018-05-22  3:37       ` Simon Marchi
2018-05-22 21:55       ` Sergio Durigan Junior
2018-05-22 23:26         ` [pushed] Fix gdb.base/remote.exp with native-extended-gdbserver board (Re: [PATCH 08/10] Handle "show remote memory-write-packet-size" when not connected) Pedro Alves
2018-05-16 15:46 ` [PATCH 07/10] remote: Move discard_pending_stop_replies call Pedro Alves
2018-05-18 21:29   ` Simon Marchi
2018-05-16 15:50 ` [PATCH 06/10] remote: Small cleanup in compare_section_command Pedro Alves
2018-05-18 21:26   ` Simon Marchi

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=ec0e571b-87a2-574d-f060-690b42889832@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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).