[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 04/10] gdbstub: split GDBConnection from main structure
From: |
Fabiano Rosas |
Subject: |
Re: [PATCH v1 04/10] gdbstub: split GDBConnection from main structure |
Date: |
Fri, 16 Dec 2022 12:29:47 -0300 |
Alex Bennée <alex.bennee@linaro.org> writes:
> In preparation for moving user/softmmu specific bits from the main
> gdbstub file we need to separate the connection details to what will
> eventually become an anonymous pointer.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> gdbstub/gdbstub.c | 99 +++++++++++++++++++++++++++--------------------
> 1 file changed, 58 insertions(+), 41 deletions(-)
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index be88ca0d71..14ce911bf2 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -342,6 +342,20 @@ enum RSState {
> RS_CHKSUM1,
> RS_CHKSUM2,
> };
> +
> +#ifdef CONFIG_USER_ONLY
> +typedef struct {
> + int fd;
> + char *socket_path;
> + int running_state;
> +} GDBConnection;
> +#else
> +typedef struct {
> + CharBackend chr;
> + Chardev *mon_chr;
> +} GDBConnection;
> +#endif
> +
> typedef struct GDBState {
> bool init; /* have we been initialised? */
> CPUState *c_cpu; /* current CPU for step/continue ops */
> @@ -354,14 +368,7 @@ typedef struct GDBState {
> int line_csum; /* checksum at the end of the packet */
> GByteArray *last_packet;
> int signal;
> -#ifdef CONFIG_USER_ONLY
> - int fd;
> - char *socket_path;
> - int running_state;
> -#else
> - CharBackend chr;
> - Chardev *mon_chr;
> -#endif
> + GDBConnection *connection;
> bool multiprocess;
> GDBProcess *processes;
> int process_num;
> @@ -392,6 +399,12 @@ static void init_gdbserver_state(void)
> gdbserver_state.supported_sstep_flags =
> accel_supported_gdbstub_sstep_flags();
> gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
> gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
> +
> + /*
> + * The following is differs depending on USER/SOFTMMU, we just
> + * hid it in the typedef.
> + */
> + gdbserver_state.connection = g_new(GDBConnection, 1);
Does it need freeing at reset_gdbserver_state()?
- [PATCH v1 01/10] gdbstub/internals.h: clean up include guard, (continued)
- [PATCH v1 01/10] gdbstub/internals.h: clean up include guard, Alex Bennée, 2022/12/16
- [PATCH v1 03/10] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs, Alex Bennée, 2022/12/16
- [PATCH v1 07/10] includes: add new gdbstub include directory, Alex Bennée, 2022/12/16
- [PATCH v1 05/10] gdbstub: move GDBState to shared internals header, Alex Bennée, 2022/12/16
- [PATCH v1 06/10] includes: move tb_flush into its own header, Alex Bennée, 2022/12/16
- [PATCH v1 04/10] gdbstub: split GDBConnection from main structure, Alex Bennée, 2022/12/16
- [PATCH v1 08/10] gdbstub: move chunk of softmmu functionality to own file, Alex Bennée, 2022/12/16
- [PATCH v1 09/10] gdbstub: move chunks of user code into own files, Alex Bennée, 2022/12/16
- [PATCH v1 10/10] gdbstub: retire exec/gdbstub.h, Alex Bennée, 2022/12/16