gdbstub: Add trace events for around XML parsing / generation
Add trace events to help follow how the various files in gdb-xml/ are parsed or generated at runtime. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Link: https://lore.kernel.org/qemu-devel/20260310232045.58440-8-philmd@linaro.org Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Philippe Mathieu-Daudé committed
Mar 11, 2026 at 00:20 UTC
1e06ef47df19f1901aac924d42c9841e9563b2c9
2 files changed
+20
gdbstub/gdbstub.c
+14
@@ -478,6 +478,10 @@ void gdb_feature_builder_end(const GDBFeatureBuilder *builder)
478
479
builder->feature->num_regs = builder->regs->len;
480
builder->feature->regs = (void *)g_ptr_array_free(builder->regs, FALSE);
481
+ trace_gdbxml_feature_builder_header(builder->feature->name,
482
+ builder->feature->xmlname,
483
+ builder->feature->num_regs);
484
+ trace_gdbxml_feature_builder_content(builder->feature->xml);
485
}
486
487
const GDBFeature *gdb_find_static_feature(const char *xmlname)
@@ -511,6 +515,10 @@ GArray *gdb_get_register_list(CPUState *cpu)
515
name,
516
r->feature->name
517
};
518
+ trace_gdbxml_get_register_list(r->feature->name,
519
+ r->feature->xmlname,
520
+ r->feature->base_reg,
521
+ r->base_reg + i, name);
522
g_array_append_val(results, desc);
523
}
524
}
@@ -563,6 +571,8 @@ static void gdb_register_feature(CPUState *cpu, int base_reg,
571
.feature = feature
572
};
573
574
+ trace_gdbxml_register_feature(feature->name, feature->xmlname,
575
+ base_reg, feature->num_regs);
576
g_array_append_val(cpu->gdb_regs, s);
577
}
578
@@ -598,6 +608,10 @@ void gdb_init_cpu(CPUState *cpu)
608
} else {
609
cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
610
}
611
+
612
+ trace_gdbxml_init_cpu(object_get_typename(OBJECT(cpu)), cpu->cpu_index,
613
+ cpu->gdb_num_regs, cpu->gdb_num_g_regs,
614
+ cc->gdb_num_core_regs);
615
}
616
617
void gdb_register_coprocessor(CPUState *cpu,
gdbstub/trace-events
+6
@@ -28,5 +28,11 @@ gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x
28
gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x"
29
gdbstub_err_unexpected_runpkt(uint8_t ch) "unexpected packet (0x%02x) while target running"
30
31
+gdbxml_init_cpu(const char *typename, unsigned id, unsigned gdb_num_regs, unsigned gdb_num_g_regs, unsigned gdb_num_core_regs) "%s:%d regs:%u g_regs:%u core_regs:%u"
32
+gdbxml_register_feature(const char *featname, const char *xmlname, unsigned base_reg, unsigned num_regs) "%s (%s) @%u +%u"
33
+gdbxml_feature_builder_header(const char *name, const char *xmlname, int num_regs) "%s (%s) regs:%d"
34
+gdbxml_feature_builder_content(const char *xml) "%s"
35
+gdbxml_get_register_list(const char *featname, const char *xmlname, unsigned feat_base_reg, unsigned base_reg, const char *regname) "%s (%s) [%u,%u]:%s"
36
+
37
# system.c
38
gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 ""