Revision a7aec5da monitor.c
b/monitor.c | ||
---|---|---|
85 | 85 |
|
86 | 86 |
struct Monitor { |
87 | 87 |
CharDriverState *chr; |
88 |
int mux_out; |
|
89 |
int reset_seen; |
|
88 | 90 |
int flags; |
89 | 91 |
int suspend_cnt; |
90 | 92 |
uint8_t outbuf[1024]; |
... | ... | |
129 | 131 |
|
130 | 132 |
void monitor_flush(Monitor *mon) |
131 | 133 |
{ |
132 |
if (mon && mon->outbuf_index != 0 && mon->chr->focus == 0) {
|
|
134 |
if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
|
|
133 | 135 |
qemu_chr_write(mon->chr, mon->outbuf, mon->outbuf_index); |
134 | 136 |
mon->outbuf_index = 0; |
135 | 137 |
} |
... | ... | |
3111 | 3113 |
|
3112 | 3114 |
switch (event) { |
3113 | 3115 |
case CHR_EVENT_MUX_IN: |
3114 |
readline_restart(mon->rs); |
|
3115 |
monitor_resume(mon); |
|
3116 |
monitor_flush(mon); |
|
3116 |
mon->mux_out = 0; |
|
3117 |
if (mon->reset_seen) { |
|
3118 |
readline_restart(mon->rs); |
|
3119 |
monitor_resume(mon); |
|
3120 |
monitor_flush(mon); |
|
3121 |
} else { |
|
3122 |
mon->suspend_cnt = 0; |
|
3123 |
} |
|
3117 | 3124 |
break; |
3118 | 3125 |
|
3119 | 3126 |
case CHR_EVENT_MUX_OUT: |
3120 |
if (mon->suspend_cnt == 0) |
|
3121 |
monitor_printf(mon, "\n"); |
|
3122 |
monitor_flush(mon); |
|
3123 |
monitor_suspend(mon); |
|
3127 |
if (mon->reset_seen) { |
|
3128 |
if (mon->suspend_cnt == 0) { |
|
3129 |
monitor_printf(mon, "\n"); |
|
3130 |
} |
|
3131 |
monitor_flush(mon); |
|
3132 |
monitor_suspend(mon); |
|
3133 |
} else { |
|
3134 |
mon->suspend_cnt++; |
|
3135 |
} |
|
3136 |
mon->mux_out = 1; |
|
3124 | 3137 |
break; |
3125 | 3138 |
|
3126 | 3139 |
case CHR_EVENT_RESET: |
3127 | 3140 |
monitor_printf(mon, "QEMU %s monitor - type 'help' for more " |
3128 | 3141 |
"information\n", QEMU_VERSION); |
3129 |
if (mon->chr->focus == 0)
|
|
3142 |
if (!mon->mux_out) {
|
|
3130 | 3143 |
readline_show_prompt(mon->rs); |
3144 |
} |
|
3145 |
mon->reset_seen = 1; |
|
3131 | 3146 |
break; |
3132 | 3147 |
} |
3133 | 3148 |
} |
... | ... | |
3155 | 3170 |
|
3156 | 3171 |
mon->chr = chr; |
3157 | 3172 |
mon->flags = flags; |
3158 |
if (mon->chr->focus != 0) |
|
3159 |
mon->suspend_cnt = 1; /* mux'ed monitors start suspended */ |
|
3160 | 3173 |
if (flags & MONITOR_USE_READLINE) { |
3161 | 3174 |
mon->rs = readline_init(mon, monitor_find_completion); |
3162 | 3175 |
monitor_read_command(mon, 0); |
Also available in: Unified diff