qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: damien.hedde@greensocs.com,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	luis.machado@linaro.org, qemu-devel@nongnu.org,
	alan.hayward@arm.com
Subject: Re: [RFC PATCH 02/11] gdbstub: stop passing GDBState * around
Date: Mon, 18 Nov 2019 11:52:14 +0000	[thread overview]
Message-ID: <87lfsdh05t.fsf@linaro.org> (raw)
In-Reply-To: <9c06e53f-3efe-d2e4-1a76-5fc84d8cb6ea@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> On 11/15/19 6:29 PM, Alex Bennée wrote:
>> We only have one GDBState which should be allocated at the time we
>> process any commands. This will make further clean-up a bit easier.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  gdbstub.c | 307 +++++++++++++++++++++++++++++++-----------------------
>>  1 file changed, 177 insertions(+), 130 deletions(-)
>>
>> diff --git a/gdbstub.c b/gdbstub.c
>> index c5b6701825f..2e6ff5f583c 100644
>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -1399,7 +1399,6 @@ static int cmd_parse_params(const char *data, const char *schema,
>>  }
>>
>>  typedef struct GdbCmdContext {
>> -    GDBState *s;
>>      GdbCmdVariant *params;
>>      int num_params;
>>      uint8_t mem_buf[MAX_PACKET_LENGTH];
>> @@ -1480,7 +1479,7 @@ static int process_string_cmd(GDBState *s, void *user_ctx, const char *data,
>>              return -1;
>>          }
>>
>> -        gdb_ctx.s = s;
>> +        g_assert(s == gdbserver_state);
>>          cmd->handler(&gdb_ctx, user_ctx);
>>          return 0;
>>      }
>> @@ -1505,7 +1504,7 @@ static void run_cmd_parser(GDBState *s, const char *data,
>>  static void handle_detach(GdbCmdContext *gdb_ctx, void *user_ctx)
>>  {
>>      GDBProcess *process;
>> -    GDBState *s = gdb_ctx->s;
>> +    GDBState *s = gdbserver_state;
>>      uint32_t pid = 1;
>>
>>      if (s->multiprocess) {
> [...]
>
> Modulo my question about why not use a non-pointer variable,
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Sure - we might as well go for static assignment. My main worry was
overly long lines but we could shorten the global to compensate or wrap
a helper around.

>
>
> r~


--
Alex Bennée


  reply	other threads:[~2019-11-18 11:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 17:29 [RFC PATCH 00/11] gdbstub re-factor and SVE support Alex Bennée
2019-11-15 17:29 ` [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place Alex Bennée
2019-11-18  7:37   ` Richard Henderson
2019-11-18  7:41   ` Richard Henderson
2019-11-18  9:19     ` Damien Hedde
2019-11-18 11:24       ` Richard Henderson
2019-11-18  9:50   ` Damien Hedde
2019-11-15 17:29 ` [RFC PATCH 02/11] gdbstub: stop passing GDBState * around Alex Bennée
2019-11-18  7:47   ` Richard Henderson
2019-11-18 11:52     ` Alex Bennée [this message]
2019-11-18 11:57       ` Richard Henderson
2019-11-18  9:40   ` Damien Hedde
2019-11-18 11:59     ` Alex Bennée
2019-11-15 17:29 ` [RFC PATCH 03/11] gdbstub: move str_buf to GDBState and use GString Alex Bennée
2019-11-18  8:06   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 04/11] gdbstub: move mem_buf to GDBState and use GByteArray Alex Bennée
2019-11-18  8:10   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 05/11] gdbstub: add helper for 128 bit registers Alex Bennée
2019-11-18  8:13   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 06/11] target/arm: use gdb_get_reg helpers Alex Bennée
2019-11-18  8:19   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 07/11] target/m68k: " Alex Bennée
2019-11-18  8:21   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 08/11] gdbstub: extend GByteArray to read register helpers Alex Bennée
2019-11-18  8:41   ` Richard Henderson
2019-11-15 17:29 ` [RFC PATCH 09/11] target/arm: prepare for multiple dynamic XMLs Alex Bennée
2019-11-15 17:29 ` [RFC PATCH 10/11] target/arm: explicitly encode regnum in our XML Alex Bennée
2019-11-18  8:43   ` Richard Henderson
2019-11-15 17:30 ` [RFC PATCH 11/11] target/arm: generate xml description of our SVE registers Alex Bennée
2019-11-18  8:46   ` Richard Henderson

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=87lfsdh05t.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alan.hayward@arm.com \
    --cc=damien.hedde@greensocs.com \
    --cc=luis.machado@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 NNTP newsgroup(s).