mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
cpus: Introduce SysemuCPUOps::monitor_defs hook
Allow targets to register their legacy target_monitor_defs() in SysemuCPUOps; check it first in get_monitor_def() otherwise fall back to previous per-target helper. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260427080738.77138-27-philmd@linaro.org>
This commit is contained in:
@@ -93,6 +93,12 @@ typedef struct SysemuCPUOps {
|
||||
*/
|
||||
int (*monitor_get_register)(CPUState *cs, const char *name, int64_t *pval);
|
||||
|
||||
/**
|
||||
* @monitor_defs: Array of MonitorDef entries. This field is legacy,
|
||||
* use @gdb_core_xml_file to dump registers instead.
|
||||
*/
|
||||
const MonitorDef *monitor_defs;
|
||||
|
||||
/**
|
||||
* @legacy_vmsd: Legacy state for migration.
|
||||
* Do not use in new targets, use #DeviceClass::vmsd instead.
|
||||
|
||||
@@ -1608,11 +1608,15 @@ void monitor_register_hmp_info_hrt(const char *name,
|
||||
*/
|
||||
static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
|
||||
{
|
||||
const MonitorDef *md = target_monitor_defs();
|
||||
CPUState *cs = mon_get_cpu(mon);
|
||||
const MonitorDef *md;
|
||||
void *ptr;
|
||||
|
||||
if (cs == NULL || md == NULL) {
|
||||
if (cs == NULL) {
|
||||
return -1;
|
||||
}
|
||||
md = cs->cc->sysemu_ops->monitor_defs ?: target_monitor_defs();
|
||||
if (md == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user