[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 14/24] gdbstub: Add members to identify registers to GDBFeatu
From: |
Akihiko Odaki |
Subject: |
[RFC PATCH 14/24] gdbstub: Add members to identify registers to GDBFeature |
Date: |
Mon, 31 Jul 2023 17:43:41 +0900 |
These members will be used to help plugins to identify registers.
The added members in instances of GDBFeature dynamically generated by
CPUs will be filled in later changes.
Signed-off-by: Akihiko Odaki <akihiko.odaki@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')
--
2.41.0
- [RFC PATCH 04/24] gdbstub: Introduce gdb_find_static_feature(), (continued)
- [RFC PATCH 04/24] gdbstub: Introduce gdb_find_static_feature(), Akihiko Odaki, 2023/07/31
- [RFC PATCH 05/24] target/arm: Move the reference to arm-core.xml, Akihiko Odaki, 2023/07/31
- [RFC PATCH 06/24] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature, Akihiko Odaki, 2023/07/31
- [RFC PATCH 08/24] target/ppc: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/07/31
- [RFC PATCH 07/24] target/arm: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/07/31
- [RFC PATCH 09/24] target/riscv: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/07/31
- [RFC PATCH 10/24] gdbstub: Use GDBFeature for gdb_register_coprocessor, Akihiko Odaki, 2023/07/31
- [RFC PATCH 11/24] gdbstub: Use GDBFeature for GDBRegisterState, Akihiko Odaki, 2023/07/31
- [RFC PATCH 12/24] gdbstub: Simplify XML lookup, Akihiko Odaki, 2023/07/31
- [RFC PATCH 13/24] hw/core/cpu: Remove gdb_get_dynamic_xml member, Akihiko Odaki, 2023/07/31
- [RFC PATCH 14/24] gdbstub: Add members to identify registers to GDBFeature,
Akihiko Odaki <=
- [RFC PATCH 15/24] target/arm: Fill new members of GDBFeature, Akihiko Odaki, 2023/07/31
- [RFC PATCH 16/24] target/ppc: Fill new members of GDBFeature, Akihiko Odaki, 2023/07/31
- [RFC PATCH 17/24] target/riscv: Fill new members of GDBFeature, Akihiko Odaki, 2023/07/31
- [RFC PATCH 18/24] hw/core/cpu: Add a parameter to gdb_read_register/gdb_write_register, Akihiko Odaki, 2023/07/31
- [RFC PATCH 20/24] gdbstub: Expose functions to read registers, Akihiko Odaki, 2023/07/31
- [RFC PATCH 19/24] gdbstub: Hide gdb_has_xml, Akihiko Odaki, 2023/07/31
- [RFC PATCH 21/24] plugins: Allow to read registers, Akihiko Odaki, 2023/07/31
- [RFC PATCH 22/24] contrib/plugins: Allow to log registers, Akihiko Odaki, 2023/07/31
- [RFC PATCH 23/24] plugins: Support C++, Akihiko Odaki, 2023/07/31
- [RFC PATCH 24/24] contrib/plugins: Add cc plugin, Akihiko Odaki, 2023/07/31