All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v2 06/21] gdbstub: move GDBState to shared internals header
Date: Tue, 21 Feb 2023 10:58:33 +0000	[thread overview]
Message-ID: <87r0ujqo6c.fsf@linaro.org> (raw)
In-Reply-To: <8e5e407e-641a-f3b3-5547-bd0f3076aaf9@linaro.org>


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

> On 2/21/23 00:24, Alex Bennée wrote:
>> Richard Henderson <richard.henderson@linaro.org> writes:
>> 
>>> On 1/5/23 08:43, Alex Bennée wrote:
>>>> We are about to split softmmu and user mode helpers into different
>>>> files. To facilitate this we will need to share access to the GDBState
>>>> between those files.
>>>> To keep building we have to temporarily define CONFIG_USER_ONLY just
>>>> before we include internals.h for the user-mode side of things. This
>>>> will get removed once the state is fully moved.
>>>
>>> You don't have to have this hack if you don't ...
>>>
>>>> +typedef struct GDBState {
>>>> +    bool init;       /* have we been initialised? */
>>>> +    CPUState *c_cpu; /* current CPU for step/continue ops */
>>>> +    CPUState *g_cpu; /* current CPU for other ops */
>>>> +    CPUState *query_cpu; /* for q{f|s}ThreadInfo */
>>>> +    enum RSState state; /* parsing state */
>>>> +    char line_buf[MAX_PACKET_LENGTH];
>>>> +    int line_buf_index;
>>>> +    int line_sum; /* running checksum */
>>>> +    int line_csum; /* checksum at the end of the packet */
>>>> +    GByteArray *last_packet;
>>>> +    int signal;
>>>> +#ifdef CONFIG_USER_ONLY
>>>> +    GDBUserState user;
>>>> +#else
>>>> +    GDBSystemState system;
>>>> +#endif
>>>
>>> ... nest these.  What's the point?
>> Well you end up having to ensure the chardev definitions are then
>> available in all files that include internals.h and I'm not sure that is
>> better:
>> --8<---------------cut here---------------start------------->8---
>> modified   gdbstub/internals.h
>> @@ -33,18 +33,16 @@ enum RSState {
>>   };
>>     /* Temporary home */
>> -#ifdef CONFIG_USER_ONLY
>>   typedef struct {
>>       int fd;
>>       char *socket_path;
>>       int running_state;
>>   } GDBUserState;
>> -#else
>> +
>>   typedef struct {
>>       CharBackend chr;
>>       Chardev *mon_chr;
>>   } GDBSystemState;
>> -#endif
>
> No, these typedefs and their data can be completely private to the two
> implementations.

Ahh right, so I've split that up now in:

  gdbstub: define separate user/system structures

and its made the subsequent patches much cleaner

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-02-21 10:59 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 16:42 [PATCH v2 00/21] gdbstub: re-organise to for better compilation behaviour Alex Bennée
2023-01-05 16:43 ` [PATCH v2 01/21] gdbstub/internals.h: clean up include guard Alex Bennée
2023-01-05 17:01   ` Philippe Mathieu-Daudé
2023-01-08 12:51   ` Bin Meng
2023-01-05 16:43 ` [PATCH v2 02/21] target/arm: fix handling of HLT semihosting in system mode Alex Bennée
2023-01-06 20:36   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 03/21] gdbstub: fix-up copyright and license files Alex Bennée
2023-01-05 17:02   ` Philippe Mathieu-Daudé
2023-01-05 16:43 ` [PATCH v2 04/21] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs Alex Bennée
2023-01-05 16:43 ` [PATCH v2 05/21] gdbstub: define separate user/system structures Alex Bennée
2023-01-06 20:39   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 06/21] gdbstub: move GDBState to shared internals header Alex Bennée
2023-01-06 20:42   ` Richard Henderson
2023-02-21 10:24     ` Alex Bennée
2023-02-21 10:36       ` Richard Henderson
2023-02-21 10:58         ` Alex Bennée [this message]
2023-01-05 16:43 ` [PATCH v2 07/21] includes: move tb_flush into its own header Alex Bennée
2023-01-05 16:43 ` [PATCH v2 08/21] gdbstub: move fromhex/tohex routines to internals Alex Bennée
2023-01-06 20:43   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 09/21] gdbstub: make various helpers visible to the rest of the module Alex Bennée
2023-01-05 17:09   ` Philippe Mathieu-Daudé
2023-01-06 21:37   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 10/21] gdbstub: move chunk of softmmu functionality to own file Alex Bennée
2023-01-06 21:51   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 11/21] gdbstub: move chunks of user code into own files Alex Bennée
2023-01-06 21:56   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 12/21] gdbstub: abstract target specific details from gdb_put_packet_binary Alex Bennée
2023-01-05 17:13   ` Philippe Mathieu-Daudé
2023-01-06 21:57   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 13/21] gdbstub: specialise handle_query_attached Alex Bennée
2023-01-05 17:22   ` Philippe Mathieu-Daudé
2023-01-06 21:59   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 14/21] gdbstub: specialise target_memory_rw_debug Alex Bennée
2023-01-06 23:14   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 15/21] gdbstub: introduce gdb_get_max_cpus Alex Bennée
2023-01-06 23:16   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 16/21] gdbstub: specialise stub_can_reverse Alex Bennée
2023-01-05 17:25   ` Philippe Mathieu-Daudé
2023-01-06 23:17   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 17/21] gdbstub: fix address type of gdb_set_cpu_pc Alex Bennée
2023-01-05 17:26   ` Philippe Mathieu-Daudé
2023-01-06 23:19   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 18/21] gdbstub: don't use target_ulong while handling registers Alex Bennée
2023-01-05 17:28   ` Philippe Mathieu-Daudé
2023-01-06 23:24     ` Richard Henderson
2023-01-06 23:23   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 19/21] gdbstub: move register helpers into standalone include Alex Bennée
2023-01-05 16:56   ` Taylor Simpson
2023-01-05 17:30   ` Philippe Mathieu-Daudé
2023-01-05 19:05   ` Max Filippov
2023-01-06 23:28   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 20/21] gdbstub: move syscall handling to new file Alex Bennée
2023-01-06 23:46   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 21/21] gdbstub: only compile gdbstub twice for whole build Alex Bennée
2023-01-06 23:55   ` 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=87r0ujqo6c.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.