[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 14/24] gdbstub: Add members to identify registers to GDBFeatur
From: |
Akihiko Odaki |
Subject: |
[PATCH v2 14/24] gdbstub: Add members to identify registers to GDBFeature |
Date: |
Wed, 2 Aug 2023 17:46:02 +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 d6d1c1d5c9..da4b9173a9 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 e04d6b2df7..807af0e685 100755
--- a/scripts/feature_to_c.py
+++ b/scripts/feature_to_c.py
@@ -50,7 +50,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:
@@ -67,6 +69,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
@@ -85,6 +88,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
- [PATCH v2 04/24] gdbstub: Introduce gdb_find_static_feature(), (continued)
- [PATCH v2 04/24] gdbstub: Introduce gdb_find_static_feature(), Akihiko Odaki, 2023/08/02
- [PATCH v2 05/24] target/arm: Move the reference to arm-core.xml, Akihiko Odaki, 2023/08/02
- [PATCH v2 06/24] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature, Akihiko Odaki, 2023/08/02
- [PATCH v2 07/24] target/arm: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/08/02
- [PATCH v2 08/24] target/ppc: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/08/02
- [PATCH v2 09/24] target/riscv: Use GDBFeature for dynamic XML, Akihiko Odaki, 2023/08/02
- [PATCH v2 10/24] gdbstub: Use GDBFeature for gdb_register_coprocessor, Akihiko Odaki, 2023/08/02
- [PATCH v2 11/24] gdbstub: Use GDBFeature for GDBRegisterState, Akihiko Odaki, 2023/08/02
- [PATCH v2 12/24] gdbstub: Simplify XML lookup, Akihiko Odaki, 2023/08/02
- [PATCH v2 13/24] hw/core/cpu: Remove gdb_get_dynamic_xml member, Akihiko Odaki, 2023/08/02
- [PATCH v2 14/24] gdbstub: Add members to identify registers to GDBFeature,
Akihiko Odaki <=
- [PATCH v2 15/24] target/arm: Fill new members of GDBFeature, Akihiko Odaki, 2023/08/02
- [PATCH v2 16/24] target/ppc: Fill new members of GDBFeature, Akihiko Odaki, 2023/08/02
- [PATCH v2 17/24] target/riscv: Fill new members of GDBFeature, Akihiko Odaki, 2023/08/02
- [PATCH v2 18/24] hw/core/cpu: Add a parameter to gdb_read_register/gdb_write_register, Akihiko Odaki, 2023/08/02
- [PATCH v2 19/24] gdbstub: Hide gdb_has_xml, Akihiko Odaki, 2023/08/02
- [PATCH v2 20/24] gdbstub: Expose functions to read registers, Akihiko Odaki, 2023/08/02
- [PATCH v2 21/24] plugins: Allow to read registers, Akihiko Odaki, 2023/08/02
- [PATCH v2 22/24] contrib/plugins: Allow to log registers, Akihiko Odaki, 2023/08/02
- [PATCH v2 23/24] plugins: Support C++, Akihiko Odaki, 2023/08/02
- [PATCH v2 24/24] contrib/plugins: Add cc plugin, Akihiko Odaki, 2023/08/02