On 11/18/19 8:41 AM, Richard Henderson wrote: > On 11/15/19 6:29 PM, Alex Bennée wrote: >> >> static GDBState *gdbserver_state; >> >> +static GDBState *gdb_allocate_state(void) >> +{ >> + g_assert(!gdbserver_state); >> + gdbserver_state = g_new0(GDBState, 1); >> + return gdbserver_state; >> +} >> + > > Actually, if we're only going to have one, why are we allocating it > dynamically? We might as well allocate it statically and drop the pointer > indirection. In use_gdb_syscalls(), we check if gdbserver_state is NULL: | /* -semihosting-config target=auto */ | /* On the first call check if gdb is connected and remember. */ | if (gdb_syscall_mode == GDB_SYS_UNKNOWN) { | gdb_syscall_mode = (gdbserver_state ? GDB_SYS_ENABLED | : GDB_SYS_DISABLED); | } So we cannot drop the pointer or we have to add some flag to do this test. Damien
- [RFC PATCH 00/11] gdbstub re-factor and SVE support Alex Bennée
- [RFC PATCH 06/11] target/arm: use gdb_get_reg help... Alex Bennée
- Re: [RFC PATCH 06/11] target/arm: use gdb_get_r... Richard Henderson
- [RFC PATCH 01/11] gdbstub: move allocation of GDBS... Alex Bennée
- Re: [RFC PATCH 01/11] gdbstub: move allocation ... Richard Henderson
- Re: [RFC PATCH 01/11] gdbstub: move allocation ... Richard Henderson
- Re: [RFC PATCH 01/11] gdbstub: move allocat... Damien Hedde
- Re: [RFC PATCH 01/11] gdbstub: move all... Richard Henderson
- Re: [RFC PATCH 01/11] gdbstub: move allocation ... Damien Hedde
- [RFC PATCH 07/11] target/m68k: use gdb_get_reg hel... Alex Bennée
- Re: [RFC PATCH 07/11] target/m68k: use gdb_get_... Richard Henderson
- [RFC PATCH 02/11] gdbstub: stop passing GDBState *... Alex Bennée
- Re: [RFC PATCH 02/11] gdbstub: stop passing GDB... Richard Henderson
- Re: [RFC PATCH 02/11] gdbstub: stop passing... Alex Bennée
- Re: [RFC PATCH 02/11] gdbstub: stop pas... Richard Henderson
- Re: [RFC PATCH 02/11] gdbstub: stop passing GDB... Damien Hedde
- Re: [RFC PATCH 02/11] gdbstub: stop passing... Alex Bennée