Hi Gavin, > From: Gavin Shan <gs...@redhat.com> > Sent: Thursday, October 12, 2023 1:07 AM > To: Salil Mehta <salil.me...@huawei.com>; qemu-devel@nongnu.org; qemu- > a...@nongnu.org > Cc: m...@kernel.org; jean-phili...@linaro.org; Jonathan Cameron > <jonathan.came...@huawei.com>; lpieral...@kernel.org; > peter.mayd...@linaro.org; richard.hender...@linaro.org; > imamm...@redhat.com; andrew.jo...@linux.dev; da...@redhat.com; > phi...@linaro.org; eric.au...@redhat.com; oliver.up...@linux.dev; > pbonz...@redhat.com; m...@redhat.com; w...@kernel.org; raf...@kernel.org; > alex.ben...@linaro.org; li...@armlinux.org.uk; > dar...@os.amperecomputing.com; il...@os.amperecomputing.com; > vis...@os.amperecomputing.com; karl.heub...@oracle.com; > miguel.l...@oracle.com; salil.me...@opnsrc.net; zhukeqian > <zhukeqi...@huawei.com>; wangxiongfeng (C) <wangxiongfe...@huawei.com>; > wangyanan (Y) <wangyana...@huawei.com>; jiakern...@gmail.com; > maob...@loongson.cn; lixiang...@loongson.cn; Linuxarm <linux...@huawei.com> > Subject: Re: [PATCH V5 9/9] gdbstub: Add helper function to unregister GDB > register space > > Hi Salil, > > On 10/12/23 05:43, 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.me...@huawei.com> > > Tested-by: Vishnu Pajjuri <vis...@os.amperecomputing.com> > > --- > > gdbstub/gdbstub.c | 15 +++++++++++++++ > > include/exec/gdbstub.h | 5 +++++ > > 2 files changed, 20 insertions(+) > > > > With the following nits addressed: > > Reviewed-by: Gavin Shan <gs...@redhat.com> > > > diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c > > index 349d348c7b..97b89e2d00 100644 > > --- a/gdbstub/gdbstub.c > > +++ b/gdbstub/gdbstub.c > > @@ -491,6 +491,21 @@ 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 */ > > + g_free(s); > > + } > > + cpu->gdb_regs = NULL; > > cpu->base_reg = 0; > cpu->num_regs = 0;
Sure. thanks Salil. > > > + cpu->gdb_num_g_regs = 0; > > +}