[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH V2 09/10] gdbstub: Add helper function to unregister GDB regi
From: |
Salil Mehta |
Subject: |
RE: [PATCH V2 09/10] gdbstub: Add helper function to unregister GDB register space |
Date: |
Tue, 3 Oct 2023 11:56:12 +0000 |
> From: Gavin Shan <gshan@redhat.com>
> Sent: Tuesday, October 3, 2023 4:17 AM
> To: Salil Mehta <salil.mehta@huawei.com>; qemu-devel@nongnu.org; qemu-
> arm@nongnu.org
> Cc: maz@kernel.org; jean-philippe@linaro.org; Jonathan Cameron
> <jonathan.cameron@huawei.com>; lpieralisi@kernel.org;
> peter.maydell@linaro.org; richard.henderson@linaro.org;
> imammedo@redhat.com; andrew.jones@linux.dev; david@redhat.com;
> philmd@linaro.org; eric.auger@redhat.com; oliver.upton@linux.dev;
> pbonzini@redhat.com; mst@redhat.com; will@kernel.org; rafael@kernel.org;
> alex.bennee@linaro.org; linux@armlinux.org.uk;
> darren@os.amperecomputing.com; ilkka@os.amperecomputing.com;
> vishnu@os.amperecomputing.com; karl.heubaum@oracle.com;
> miguel.luis@oracle.com; salil.mehta@opnsrc.net; zhukeqian
> <zhukeqian1@huawei.com>; wangxiongfeng (C) <wangxiongfeng2@huawei.com>;
> wangyanan (Y) <wangyanan55@huawei.com>; jiakernel2@gmail.com;
> maobibo@loongson.cn; lixianglai@loongson.cn; Linuxarm <linuxarm@huawei.com>
> 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 <salil.mehta@huawei.com>
> > ---
> > gdbstub/gdbstub.c | 14 ++++++++++++++
> > include/exec/gdbstub.h | 5 +++++
> > 2 files changed, 19 insertions(+)
> >
>
> With the following nits addressed:
>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
>
> > 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.