@@ -59,6 +59,12 @@ void gdb_feature_builder_end(const GDBFeatureBuilder *builder);
const GDBFeature *gdb_find_static_feature(const char *xmlname);
+void gdb_foreach_feature(CPUState *cpu,
+ void (* callback)(void *, const GDBFeature *, int),
+ void *opaque);
+
+int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
+
void gdb_set_stop_cpu(CPUState *cpu);
/* in gdbstub-xml.c, generated by scripts/feature_to_c.py */
@@ -483,7 +483,25 @@ const GDBFeature *gdb_find_static_feature(const char *xmlname)
g_assert_not_reached();
}
-static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
+void gdb_foreach_feature(CPUState *cpu,
+ void (* callback)(void *, const GDBFeature *, int),
+ void *opaque)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+ GDBRegisterState *r;
+
+ if (!cc->gdb_core_feature) {
+ return;
+ }
+
+ callback(opaque, cc->gdb_core_feature, 0);
+
+ for (r = cpu->gdb_regs; r; r = r->next) {
+ callback(opaque, r->feature, r->base_reg);
+ }
+}
+
+int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
CPUArchState *env = cpu->env_ptr;
gdb_foreach_feature() enumerates features that are useful to identify registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> --- include/exec/gdbstub.h | 6 ++++++ gdbstub/gdbstub.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-)