diff --git a/console.h b/console.h index dd8b0397e6..fba9e299b3 100644 --- a/console.h +++ b/console.h @@ -175,6 +175,8 @@ void term_flush(void); void term_print_help(void); void monitor_readline(const char *prompt, int is_password, char *buf, int buf_size); +void monitor_suspend(void); +void monitor_resume(void); /* readline.c */ typedef void ReadLineFunc(void *opaque, const char *str); diff --git a/monitor.c b/monitor.c index 4f51eccdca..dd2e770e68 100644 --- a/monitor.c +++ b/monitor.c @@ -2694,10 +2694,27 @@ static void term_read(void *opaque, const uint8_t *buf, int size) readline_handle_byte(buf[i]); } +static int monitor_suspended; + static void monitor_handle_command1(void *opaque, const char *cmdline) { monitor_handle_command(cmdline); - monitor_start_input(); + if (!monitor_suspended) + monitor_start_input(); + else + monitor_suspended = 2; +} + +void monitor_suspend(void) +{ + monitor_suspended = 1; +} + +void monitor_resume(void) +{ + if (monitor_suspended == 2) + monitor_start_input(); + monitor_suspended = 0; } static void monitor_start_input(void)