Re: [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-18 Thread Richard Henderson
On 11/18/19 10:19 AM, Damien Hedde wrote: > > > 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); >>> +

Re: [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-18 Thread Damien Hedde
On 11/15/19 6:29 PM, Alex Bennée wrote: > We use g_new0() as it is the preferred form for such allocations. We > can also ensure that gdbserver_state is reset in one place. > > Signed-off-by: Alex Bennée > --- > gdbstub.c | 14 +- > 1 file changed, 9 insertions(+), 5 deletions(-)

Re: [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-18 Thread Damien Hedde
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

Re: [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-17 Thread Richard Henderson
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

Re: [RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-17 Thread Richard Henderson
On 11/15/19 6:29 PM, Alex Bennée wrote: > We use g_new0() as it is the preferred form for such allocations. We > can also ensure that gdbserver_state is reset in one place. > > Signed-off-by: Alex Bennée > --- > gdbstub.c | 14 +- > 1 file changed, 9 insertions(+), 5 deletions(-)

[RFC PATCH 01/11] gdbstub: move allocation of GDBState to one place

2019-11-15 Thread Alex Bennée
We use g_new0() as it is the preferred form for such allocations. We can also ensure that gdbserver_state is reset in one place. Signed-off-by: Alex Bennée --- gdbstub.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index