|
@@ -200,7 +200,7 @@ struct Monitor {
|
|
|
|
|
|
ReadLineState *rs;
|
|
ReadLineState *rs;
|
|
MonitorQMP qmp;
|
|
MonitorQMP qmp;
|
|
- CPUState *mon_cpu;
|
|
|
|
|
|
+ gchar *mon_cpu_path;
|
|
BlockCompletionFunc *password_completion_cb;
|
|
BlockCompletionFunc *password_completion_cb;
|
|
void *password_opaque;
|
|
void *password_opaque;
|
|
mon_cmd_t *cmd_table;
|
|
mon_cmd_t *cmd_table;
|
|
@@ -579,6 +579,7 @@ static void monitor_data_init(Monitor *mon)
|
|
|
|
|
|
static void monitor_data_destroy(Monitor *mon)
|
|
static void monitor_data_destroy(Monitor *mon)
|
|
{
|
|
{
|
|
|
|
+ g_free(mon->mon_cpu_path);
|
|
qemu_chr_fe_deinit(&mon->chr, false);
|
|
qemu_chr_fe_deinit(&mon->chr, false);
|
|
if (monitor_is_qmp(mon)) {
|
|
if (monitor_is_qmp(mon)) {
|
|
json_message_parser_destroy(&mon->qmp.parser);
|
|
json_message_parser_destroy(&mon->qmp.parser);
|
|
@@ -1047,20 +1048,32 @@ int monitor_set_cpu(int cpu_index)
|
|
if (cpu == NULL) {
|
|
if (cpu == NULL) {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
- cur_mon->mon_cpu = cpu;
|
|
|
|
|
|
+ g_free(cur_mon->mon_cpu_path);
|
|
|
|
+ cur_mon->mon_cpu_path = object_get_canonical_path(OBJECT(cpu));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
CPUState *mon_get_cpu(void)
|
|
CPUState *mon_get_cpu(void)
|
|
{
|
|
{
|
|
- if (!cur_mon->mon_cpu) {
|
|
|
|
|
|
+ CPUState *cpu;
|
|
|
|
+
|
|
|
|
+ if (cur_mon->mon_cpu_path) {
|
|
|
|
+ cpu = (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_path,
|
|
|
|
+ TYPE_CPU, NULL);
|
|
|
|
+ if (!cpu) {
|
|
|
|
+ g_free(cur_mon->mon_cpu_path);
|
|
|
|
+ cur_mon->mon_cpu_path = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!cur_mon->mon_cpu_path) {
|
|
if (!first_cpu) {
|
|
if (!first_cpu) {
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
monitor_set_cpu(first_cpu->cpu_index);
|
|
monitor_set_cpu(first_cpu->cpu_index);
|
|
|
|
+ cpu = first_cpu;
|
|
}
|
|
}
|
|
- cpu_synchronize_state(cur_mon->mon_cpu);
|
|
|
|
- return cur_mon->mon_cpu;
|
|
|
|
|
|
+ cpu_synchronize_state(cpu);
|
|
|
|
+ return cpu;
|
|
}
|
|
}
|
|
|
|
|
|
CPUArchState *mon_get_cpu_env(void)
|
|
CPUArchState *mon_get_cpu_env(void)
|