aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-main.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-06-10 09:35:09 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-06-10 09:35:09 +0000
commitf7f9a841a31878b377a60bfc7c793e6c8400fafe (patch)
tree1554ae753adf4a06eee7b5129ff71c937f5245ad /gdb/mi/mi-main.c
parentf5871ec07bfb6388317ec60513286c51ecd06733 (diff)
downloadgdb-f7f9a841a31878b377a60bfc7c793e6c8400fafe.zip
gdb-f7f9a841a31878b377a60bfc7c793e6c8400fafe.tar.gz
gdb-f7f9a841a31878b377a60bfc7c793e6c8400fafe.tar.bz2
Use observers to report stop events in MI.
* mi/mi-interp.c (mi_on_normal_stop): New. (mi_interpreter_init): Register mi_on_normal_stop. (mi_interpreter_exec_continuation): Remove. (mi_cmd_interpreter_exec): Don't register the above. * mi/mi-main.c (captured_mi_execute_command): Don't care about sync_execution. (mi_execute_async_cli_command): Don't install continuation. Don't print *stopped. (mi_exec_async_cli_cmd_continuation): Remove.
Diffstat (limited to 'gdb/mi/mi-main.c')
-rw-r--r--gdb/mi/mi-main.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 4ae509e..6dc7609 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -103,10 +103,6 @@ static void mi_execute_cli_command (const char *cmd, int args_p,
const char *args);
static enum mi_cmd_result mi_execute_async_cli_command (char *cli_command,
char **argv, int argc);
-
-static void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg,
- int error_p);
-
static int register_changed_p (int regnum, struct regcache *,
struct regcache *);
static void get_register (int regnum, int format);
@@ -1087,15 +1083,11 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
fputs_unfiltered ("\n", raw_stdout);
}
else
+ /* The command does not want anything to be printed. In that
+ case, the command probably should not have written anything
+ to uiout, but in case it has written something, discard it. */
mi_out_rewind (uiout);
}
- else if (sync_execution)
- {
- /* Don't print the prompt. We are executing the target in
- synchronous mode. */
- args->action = EXECUTE_COMMAND_SUPPRESS_PROMPT;
- return;
- }
break;
case CLI_COMMAND:
@@ -1311,12 +1303,6 @@ mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
fputs_unfiltered (current_token, raw_stdout);
fputs_unfiltered ("^running\n", raw_stdout);
- /* Ideally, we should be intalling continuation only when
- the target is already running. However, this will break right now,
- because continuation installed by the 'finish' command must be after
- the continuation that prints *stopped. This issue will be
- fixed soon. */
- add_continuation (mi_exec_async_cli_cmd_continuation, NULL);
}
execute_command ( /*ui */ run, 0 /*from_tty */ );
@@ -1332,31 +1318,14 @@ mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
/* Do this before doing any printing. It would appear that some
print code leaves garbage around in the buffer. */
do_cleanups (old_cleanups);
- /* If the target was doing the operation synchronously we fake
- the stopped message. */
- fputs_unfiltered ("*stopped", raw_stdout);
- mi_out_put (uiout, raw_stdout);
- mi_out_rewind (uiout);
if (do_timings)
print_diff_now (current_command_ts);
- fputs_unfiltered ("\n", raw_stdout);
return MI_CMD_QUIET;
}
return MI_CMD_DONE;
}
void
-mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg, int error_p)
-{
- /* Assume 'error' means that target is stopped, too. */
- fputs_unfiltered ("*stopped", raw_stdout);
- mi_out_put (uiout, raw_stdout);
- fputs_unfiltered ("\n", raw_stdout);
- fputs_unfiltered ("(gdb) \n", raw_stdout);
- gdb_flush (raw_stdout);
-}
-
-void
mi_load_progress (const char *section_name,
unsigned long sent_so_far,
unsigned long total_section,