Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Stan Cox <scox@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] add file desc to gdbserver client_state
Date: Fri, 24 Jan 2020 18:21:00 -0000	[thread overview]
Message-ID: <871rroaflr.fsf@tromey.com> (raw)
In-Reply-To: <827a8c5f-e797-58a3-62bf-335e7a44cd9a@redhat.com> (Stan Cox's	message of "Mon, 23 Dec 2019 23:42:05 -0500")

>>>>> "Stan" == Stan Cox <scox@redhat.com> writes:

Stan>     Add struct multi_client_states
    
Stan>     * remote-utils.c (remote_desc):  Move to struct client_state
Stan>       (gdb_connected, handle_accept_event, remote_open, putpkt_binary_1)
Stan>       (putpkt_notif, input_interrupt, block_unblock_async_io)
Stan>       (nto_conctrl, getpkt): Change remote_desc reference.
Stan>     * server.c (captured_main): Move remote_desc initialization to
Stan>       remote_prepare.

Thanks for the patch.

Stan> diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
Stan> index d7da4b7aed..09095d9bbc 100644
Stan> --- a/gdb/gdbserver/remote-utils.c
Stan> +++ b/gdb/gdbserver/remote-utils.c
Stan> @@ -25,6 +25,7 @@
Stan>  #include "tdesc.h"
Stan>  #include "debug.h"
Stan>  #include "dll.h"
Stan> +#include "server.h"

I think this is already included near the top.
Normally, .c files in gdbserver include this first.

Stan> +
Stan>  int
Stan>  gdb_connected (void)

Spurious newline addition.

Stan> +  struct multi_client_states &client_states = get_client_states();

Needs a space before the "(".

Stan> +  get_client_states().set_current_client (cs);

Ditto.

Stan> +/* Container of client remote protocol states for all the currently
Stan> +   connected clients.  */
Stan> +
Stan> +#define get_client_state() get_client_states().get_current_client()
Stan> +
Stan> +class multi_client_states
Stan> +{
Stan> +private:
Stan> +  client_state *current_cs;
Stan> +
Stan> +public:
Stan> +  /* Return the current client we are focused on. */
Stan> +  client_state &get_current_client () { return *current_cs; }
Stan> +
Stan> +  /* Set the current client we wish to focus on. */
Stan> +  void set_current_client (client_state &cs) { current_cs = &cs; }

I think this class is a bit strange.
It stores a pointer but the set_ method takes a reference.

If this class is going to own multiple clients in the future, then I
think it makes sense to design the API that way from the start.

thanks,
Tom


  reply	other threads:[~2020-01-24 18:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 23:30 [PATCH] Don't override various Makefile variables for gnulib et al Christian Biesinger via gdb-patches
2019-11-26 18:01 ` [PATCH] add file desc to gdbserver client_state Stan Cox
2019-12-13 23:13   ` Tom Tromey
2019-12-24  4:42     ` Stan Cox
2020-01-24 18:21       ` Tom Tromey [this message]
2020-02-06 19:41       ` Stan Cox
2020-01-29 14:07 ` [PATCH] Don't override various Makefile variables for gnulib et al Christian Biesinger via gdb-patches
2020-01-29 14:10 ` Christian Biesinger via gdb-patches
2020-02-12 21:16   ` Christian Biesinger via gdb-patches

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=871rroaflr.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=scox@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