> From: Gavin Shan <[email protected]>
> Sent: Tuesday, October 3, 2023 4:17 AM
> To: Salil Mehta <[email protected]>; [email protected]; qemu-
> [email protected]
> Cc: [email protected]; [email protected]; Jonathan Cameron
> <[email protected]>; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; zhukeqian
> <[email protected]>; wangxiongfeng (C) <[email protected]>;
> wangyanan (Y) <[email protected]>; [email protected];
> [email protected]; [email protected]; Linuxarm <[email protected]>
> Subject: Re: [PATCH V2 09/10] gdbstub: Add helper function to unregister
> GDB register space
> 
> 
> On 9/30/23 10:19, Salil Mehta wrote:
> > Add common function to help unregister the GDB Register Space. This shall
> be
> > done in context to the CPU unrealization.
> >
> > Signed-off-by: Salil Mehta <[email protected]>
> > ---
> >   gdbstub/gdbstub.c      | 14 ++++++++++++++
> >   include/exec/gdbstub.h |  5 +++++
> >   2 files changed, 19 insertions(+)
> >
> 
> With the following nits addressed:
> 
> Reviewed-by: Gavin Shan <[email protected]>
> 
> > diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> > index 349d348c7b..89ac0edfea 100644
> > --- a/gdbstub/gdbstub.c
> > +++ b/gdbstub/gdbstub.c
> > @@ -491,6 +491,20 @@ void gdb_register_coprocessor(CPUState *cpu,
> >       }
> >   }
> >
> > +void gdb_unregister_coprocessor_all(CPUState *cpu)
> > +{
> > +    GDBRegisterState *s, *p;
> > +
> > +    p = cpu->gdb_regs;
> > +    while (p) {
> > +        s = p;
> > +        p = p->next;
> > +        /* s->xml is static const char so isn't freed */
>                                       ^^^
>                                       string so that it needn't be freed
> > +        g_free(s);
> > +    }
> > +    cpu->gdb_regs = NULL;
> > +}
> > +
> 
> For consistency, CPUState::gdb_num_regs and CPUState::gdb_num_g_regs
> need to be updated accordingly, even the CPU instance will be destroyed
> shortly.

Good point.

Thanks
Salil.



Reply via email to