Akihiko Odaki <akihiko.od...@daynix.com> writes:
> These members will be used to help plugins to identify registers. I'm wary of exposing gdb'isms directly to plugins. However making stuff easier for the gdbstub internals is ok. I shall reserve judgement until I've read the rest of the series. > The added members in instances of GDBFeature dynamically generated by > CPUs will be filled in later changes. > > Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> > --- > include/exec/gdbstub.h | 2 ++ > scripts/feature_to_c.py | 14 +++++++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h > index 9b3da5b257..6da4af9612 100644 > --- a/include/exec/gdbstub.h > +++ b/include/exec/gdbstub.h > @@ -13,6 +13,8 @@ > typedef struct GDBFeature { > const char *xmlname; > const char *xml; > + const char *name; > + const char * const *regs; > int num_regs; > } GDBFeature; > > diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py > index 8eb8c81cf8..11b1bc05c9 100755 > --- a/scripts/feature_to_c.py > +++ b/scripts/feature_to_c.py > @@ -46,7 +46,9 @@ def writeliteral(indent, bytes): > sys.stderr.write(f'unexpected start tag: {element.tag}\n') > exit(1) > > + feature_name = element.attrib['name'] > regnum = 0 > + regnames = [] > regnums = [] > tags = ['feature'] > for event, element in events: > @@ -63,6 +65,7 @@ def writeliteral(indent, bytes): > if 'regnum' in element.attrib: > regnum = int(element.attrib['regnum']) > > + regnames.append(element.attrib['name']) > regnums.append(regnum) > regnum += 1 > > @@ -81,6 +84,15 @@ def writeliteral(indent, bytes): > writeliteral(8, bytes(os.path.basename(input), 'utf-8')) > sys.stdout.write(',\n') > writeliteral(8, read) > - sys.stdout.write(f',\n {num_regs},\n }},\n') > + sys.stdout.write(',\n') > + writeliteral(8, bytes(feature_name, 'utf-8')) > + sys.stdout.write(',\n (const char * const []) {\n') > + > + for index, regname in enumerate(regnames): > + sys.stdout.write(f' [{regnums[index] - base_reg}] =\n') > + writeliteral(16, bytes(regname, 'utf-8')) > + sys.stdout.write(',\n') > + > + sys.stdout.write(f' }},\n {num_regs},\n }},\n') > > sys.stdout.write(' { NULL }\n};\n') -- Alex Bennée Virtualisation Tech Lead @ Linaro