diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-06-25 15:15:42 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-06-25 15:15:42 +0000 |
commit | ce8f13f88e2d8fc915e0af5039080ec0b293ee11 (patch) | |
tree | d4ac1035c7bd3666217ac13efa282175d78406e9 /gdb | |
parent | a2840c355960fdc116b12bd02abba2c5b9a9a653 (diff) | |
download | fsf-binutils-gdb-ce8f13f88e2d8fc915e0af5039080ec0b293ee11.zip fsf-binutils-gdb-ce8f13f88e2d8fc915e0af5039080ec0b293ee11.tar.gz fsf-binutils-gdb-ce8f13f88e2d8fc915e0af5039080ec0b293ee11.tar.bz2 |
Kill the return value for all MI command functions.
* mi/mi-cmds.h (enum mi_cmd_result): Remove.
(mi_cmd_argv_ftype): Change return type to void.
* mi/mi-main.c: Adjust all function that implement
MI commands to return nothing.
(struct captured_mi_execute_command_actions):
Remove the rc field.
(mi_cmd_execute): Return nothing.
(mi_execute_async_cli_command): Return nothing.
(mi_cmd_exec_interrupt): Don't print ^done here.
(mi_cmd_target_select): Don't print ^connected here.
(captured_mi_execute_command): Don't check for MI_CMD_DONE.
Special-case -target-select and output ^connected, not ^done.
* mi/mi-cmd-break.c: Adjust.
* mi/mi-cmd-disas.c: Adjust.
* mi/mi-cmd-env.c: Adjust.
* mi/mi-cmd-file.c: Adjust.
* mi/mi-cmd-stack.c: Adjust.
* mi/mi-cmd-target.c: Adjust.
* mi/mi-cmd-var.c: Adjust.
* mi/mi-interp.c: Adjust.
* mi/mi-symbol-cmds.c: Adjust.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 27 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-break.c | 8 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-disas.c | 4 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-env.c | 30 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-file.c | 8 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 23 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-target.c | 12 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-var.c | 48 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 18 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 127 | ||||
-rw-r--r-- | gdb/mi/mi-symbol-cmds.c | 4 |
12 files changed, 111 insertions, 201 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 265f2ae..a189dd6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,32 @@ 2008-06-25 Vladimir Prus <vladimir@codesourcery.com> + Kill the return value for all MI command functions. + * mi/mi-cmds.h (enum mi_cmd_result): Remove. + (mi_cmd_argv_ftype): Change return type to void. + + * mi/mi-main.c: Adjust all function that implement + MI commands to return nothing. + (struct captured_mi_execute_command_actions): + Remove the rc field. + (mi_cmd_execute): Return nothing. + (mi_execute_async_cli_command): Return nothing. + (mi_cmd_exec_interrupt): Don't print ^done here. + (mi_cmd_target_select): Don't print ^connected here. + (captured_mi_execute_command): Don't check for MI_CMD_DONE. + Special-case -target-select and output ^connected, not ^done. + + * mi/mi-cmd-break.c: Adjust. + * mi/mi-cmd-disas.c: Adjust. + * mi/mi-cmd-env.c: Adjust. + * mi/mi-cmd-file.c: Adjust. + * mi/mi-cmd-stack.c: Adjust. + * mi/mi-cmd-target.c: Adjust. + * mi/mi-cmd-var.c: Adjust. + * mi/mi-interp.c: Adjust. + * mi/mi-symbol-cmds.c: Adjust. + +2008-06-25 Vladimir Prus <vladimir@codesourcery.com> + Emit ^running via observer. * mi/mi-interp.c (mi_cmd_interpreter_exec): Do no print ^running here. diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 3a5faf3..1bfb567 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -60,7 +60,7 @@ enum bp_type /* Implements the -break-insert command. See the MI manual for the list of possible options. */ -enum mi_cmd_result +void mi_cmd_break_insert (char *command, char **argv, int argc) { char *address = NULL; @@ -156,7 +156,6 @@ mi_cmd_break_insert (char *command, char **argv, int argc) error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint")); else rbreak_command_wrapper (address, FROM_TTY); - return MI_CMD_DONE; break; #endif default: @@ -167,8 +166,6 @@ mi_cmd_break_insert (char *command, char **argv, int argc) deprecated_set_gdb_event_hooks (old_hooks); if (e.reason < 0) throw_exception (e); - - return MI_CMD_DONE; } enum wp_type @@ -184,7 +181,7 @@ enum wp_type -break-watch -r <expr> --> insert a read watchpoint. -break-watch -a <expr> --> insert an access wp. */ -enum mi_cmd_result +void mi_cmd_break_watch (char *command, char **argv, int argc) { char *expr = NULL; @@ -239,5 +236,4 @@ mi_cmd_break_watch (char *command, char **argv, int argc) default: error (_("mi_cmd_break_watch: Unknown watchpoint type.")); } - return MI_CMD_DONE; } diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index d2cb655..300f6b7 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -46,10 +46,9 @@ MODE: 0 or 1 for disassembly only, or mixed source and disassembly, respectively. */ -enum mi_cmd_result +void mi_cmd_disassemble (char *command, char **argv, int argc) { - enum mi_cmd_result retval; CORE_ADDR start; int mixed_source_and_assembly; @@ -157,5 +156,4 @@ mi_cmd_disassemble (char *command, char **argv, int argc) line_num, mixed_source_and_assembly, how_many, low, high); - return MI_CMD_DONE; } diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index aee7994..327ddc5 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -64,7 +64,7 @@ env_execute_cli_command (const char *cmd, const char *args) /* Print working directory. */ -enum mi_cmd_result +void mi_cmd_env_pwd (char *command, char **argv, int argc) { if (argc > 0) @@ -73,27 +73,23 @@ mi_cmd_env_pwd (char *command, char **argv, int argc) if (mi_version (uiout) < 2) { env_execute_cli_command ("pwd", NULL); - return MI_CMD_DONE; + return; } /* Otherwise the mi level is 2 or higher. */ getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); ui_out_field_string (uiout, "cwd", gdb_dirbuf); - - return MI_CMD_DONE; } /* Change working directory. */ -enum mi_cmd_result +void mi_cmd_env_cd (char *command, char **argv, int argc) { if (argc == 0 || argc > 1) error (_("mi_cmd_env_cd: Usage DIRECTORY")); env_execute_cli_command ("cd", argv[0]); - - return MI_CMD_DONE; } static void @@ -108,7 +104,7 @@ env_mod_path (char *dirname, char **which_path) } /* Add one or more directories to start of executable search path. */ -enum mi_cmd_result +void mi_cmd_env_path (char *command, char **argv, int argc) { char *exec_path; @@ -133,7 +129,7 @@ mi_cmd_env_path (char *command, char **argv, int argc) { for (i = argc - 1; i >= 0; --i) env_execute_cli_command ("path", argv[i]); - return MI_CMD_DONE; + return; } /* Otherwise the mi level is 2 or higher. */ @@ -177,12 +173,10 @@ mi_cmd_env_path (char *command, char **argv, int argc) xfree (exec_path); env = get_in_environ (inferior_environ, path_var_name); ui_out_field_string (uiout, "path", env); - - return MI_CMD_DONE; } /* Add zero or more directories to the front of the source path. */ -enum mi_cmd_result +void mi_cmd_env_dir (char *command, char **argv, int argc) { int i; @@ -205,7 +199,7 @@ mi_cmd_env_dir (char *command, char **argv, int argc) { for (i = argc - 1; i >= 0; --i) env_execute_cli_command ("dir", argv[i]); - return MI_CMD_DONE; + return; } /* Otherwise mi level is 2 or higher. */ @@ -238,21 +232,17 @@ mi_cmd_env_dir (char *command, char **argv, int argc) ui_out_field_string (uiout, "source-path", source_path); forget_cached_source_info (); - - return MI_CMD_DONE; } /* Set the inferior terminal device name. */ -enum mi_cmd_result +void mi_cmd_inferior_tty_set (char *command, char **argv, int argc) { set_inferior_io_terminal (argv[0]); - - return MI_CMD_DONE; } /* Print the inferior terminal device name */ -enum mi_cmd_result +void mi_cmd_inferior_tty_show (char *command, char **argv, int argc) { const char *inferior_io_terminal = get_inferior_io_terminal (); @@ -262,8 +252,6 @@ mi_cmd_inferior_tty_show (char *command, char **argv, int argc) if (inferior_io_terminal) ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal); - - return MI_CMD_DONE; } void diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 8c74170..de045cb 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -28,7 +28,7 @@ /* Return to the client the absolute path and line number of the current file being executed. */ -enum mi_cmd_result +void mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) { struct symtab_and_line st; @@ -60,11 +60,9 @@ mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) ui_out_field_string (uiout, "fullname", st.symtab->fullname); ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) { struct symtab *s; @@ -113,6 +111,4 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) } ui_out_end (uiout, ui_out_type_list); - - return MI_CMD_DONE; } diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index cddb8a1..baf9b6d 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -38,7 +38,7 @@ static void list_args_or_locals (int locals, int values, struct frame_info *fi); specifying the frame numbers at which to start and stop the display. If the two numbers are equal, a single frame will be displayed. */ -enum mi_cmd_result +void mi_cmd_stack_list_frames (char *command, char **argv, int argc) { int frame_low; @@ -88,11 +88,9 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc) } do_cleanups (cleanup_stack); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_stack_info_depth (char *command, char **argv, int argc) { int frame_high; @@ -115,14 +113,12 @@ mi_cmd_stack_info_depth (char *command, char **argv, int argc) QUIT; ui_out_field_int (uiout, "depth", i); - - return MI_CMD_DONE; } /* Print a list of the locals for the current frame. With argument of 0, print only the names, with argument of 1 print also the values. */ -enum mi_cmd_result +void mi_cmd_stack_list_locals (char *command, char **argv, int argc) { struct frame_info *frame; @@ -147,13 +143,12 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc) 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), mi_no_values, mi_all_values, mi_simple_values); list_args_or_locals (1, print_values, frame); - return MI_CMD_DONE; } /* Print a list of the arguments for the current frame. With argument of 0, print only the names, with argument of 1 print also the values. */ -enum mi_cmd_result +void mi_cmd_stack_list_args (char *command, char **argv, int argc) { int frame_low; @@ -205,8 +200,6 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc) } do_cleanups (cleanup_stack_args); - - return MI_CMD_DONE; } /* Print a list of the locals or the arguments for the currently @@ -315,22 +308,20 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) ui_out_stream_delete (stb); } -enum mi_cmd_result +void mi_cmd_stack_select_frame (char *command, char **argv, int argc) { if (argc == 0 || argc > 1) error (_("mi_cmd_stack_select_frame: Usage: FRAME_SPEC")); select_frame_command (argv[0], 1 /* not used */ ); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_stack_info_frame (char *command, char **argv, int argc) { if (argc > 0) error (_("mi_cmd_stack_info_frame: No arguments required")); - + print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0); - return MI_CMD_DONE; } diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c index 8ca4def..7dd55bd 100644 --- a/gdb/mi/mi-cmd-target.c +++ b/gdb/mi/mi-cmd-target.c @@ -23,7 +23,7 @@ /* Get a file from the target. */ -enum mi_cmd_result +void mi_cmd_target_file_get (char *command, char **argv, int argc) { int optind = 0; @@ -43,13 +43,11 @@ mi_cmd_target_file_get (char *command, char **argv, int argc) local_file = argv[optind + 1]; remote_file_get (remote_file, local_file, 0); - - return MI_CMD_DONE; } /* Send a file to the target. */ -enum mi_cmd_result +void mi_cmd_target_file_put (char *command, char **argv, int argc) { int optind = 0; @@ -69,13 +67,11 @@ mi_cmd_target_file_put (char *command, char **argv, int argc) remote_file = argv[optind + 1]; remote_file_put (local_file, remote_file, 0); - - return MI_CMD_DONE; } /* Delete a file on the target. */ -enum mi_cmd_result +void mi_cmd_target_file_delete (char *command, char **argv, int argc) { int optind = 0; @@ -94,7 +90,5 @@ mi_cmd_target_file_delete (char *command, char **argv, int argc) remote_file = argv[optind]; remote_file_delete (remote_file, 0); - - return MI_CMD_DONE; } diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 50f7add..0adcf1f 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -78,7 +78,7 @@ print_varobj (struct varobj *var, enum print_values print_values, /* VAROBJ operations */ -enum mi_cmd_result +void mi_cmd_var_create (char *command, char **argv, int argc) { CORE_ADDR frameaddr = 0; @@ -138,10 +138,9 @@ mi_cmd_var_create (char *command, char **argv, int argc) print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */); do_cleanups (old_cleanups); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_delete (char *command, char **argv, int argc) { char *name; @@ -193,7 +192,6 @@ mi_cmd_var_delete (char *command, char **argv, int argc) ui_out_field_int (uiout, "ndeleted", numdel); do_cleanups (old_cleanups); - return MI_CMD_DONE; } /* Parse a string argument into a format value. */ @@ -222,7 +220,7 @@ mi_parse_format (const char *arg) error (_("Must specify the format as: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\"")); } -enum mi_cmd_result +void mi_cmd_var_set_format (char *command, char **argv, int argc) { enum varobj_display_formats format; @@ -247,10 +245,9 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) /* Report the value in the new format */ ui_out_field_string (uiout, "value", varobj_get_value (var)); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_set_frozen (char *command, char **argv, int argc) { struct varobj *var; @@ -275,11 +272,10 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc) /* We don't automatically return the new value, or what varobjs got new values during unfreezing. If this information is required, client should call -var-update explicitly. */ - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_show_format (char *command, char **argv, int argc) { enum varobj_display_formats format; @@ -297,10 +293,9 @@ mi_cmd_var_show_format (char *command, char **argv, int argc) /* Report the current format */ ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_info_num_children (char *command, char **argv, int argc) { struct varobj *var; @@ -314,7 +309,6 @@ mi_cmd_var_info_num_children (char *command, char **argv, int argc) error (_("mi_cmd_var_info_num_children: Variable object not found")); ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); - return MI_CMD_DONE; } /* Parse a string argument into a print_values value. */ @@ -364,7 +358,7 @@ mi_print_value_p (struct type *type, enum print_values print_values) } } -enum mi_cmd_result +void mi_cmd_var_list_children (char *command, char **argv, int argc) { struct varobj *var; @@ -394,7 +388,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) print_values = PRINT_NO_VALUES; if (VEC_length (varobj_p, children) == 0) - return MI_CMD_DONE; + return; if (mi_version (uiout) == 1) cleanup_children = make_cleanup_ui_out_tuple_begin_end (uiout, "children"); @@ -408,10 +402,9 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) do_cleanups (cleanup_child); } do_cleanups (cleanup_children); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_info_type (char *command, char **argv, int argc) { struct varobj *var; @@ -425,10 +418,9 @@ mi_cmd_var_info_type (char *command, char **argv, int argc) error (_("mi_cmd_var_info_type: Variable object not found")); ui_out_field_string (uiout, "type", varobj_get_type (var)); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_info_path_expression (char *command, char **argv, int argc) { struct varobj *var; @@ -445,11 +437,9 @@ mi_cmd_var_info_path_expression (char *command, char **argv, int argc) path_expr = varobj_get_path_expr (var); ui_out_field_string (uiout, "path_expr", path_expr); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_info_expression (char *command, char **argv, int argc) { enum varobj_languages lang; @@ -467,10 +457,9 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc) ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]); ui_out_field_string (uiout, "exp", varobj_get_expression (var)); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_show_attributes (char *command, char **argv, int argc) { int attr; @@ -493,10 +482,9 @@ mi_cmd_var_show_attributes (char *command, char **argv, int argc) attstr = "noneditable"; ui_out_field_string (uiout, "attr", attstr); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) { struct varobj *var; @@ -552,11 +540,9 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) ui_out_field_string (uiout, "value", varobj_get_formatted_value (var, format)); else ui_out_field_string (uiout, "value", varobj_get_value (var)); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_assign (char *command, char **argv, int argc) { struct varobj *var; @@ -579,10 +565,9 @@ mi_cmd_var_assign (char *command, char **argv, int argc) error (_("mi_cmd_var_assign: Could not assign expression to variable object")); ui_out_field_string (uiout, "value", varobj_get_value (var)); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_var_update (char *command, char **argv, int argc) { struct varobj *var; @@ -620,7 +605,7 @@ mi_cmd_var_update (char *command, char **argv, int argc) if (nv <= 0) { do_cleanups (cleanup); - return MI_CMD_DONE; + return; } cr = rootlist; while (*cr != NULL) @@ -645,7 +630,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) varobj_update_one (var, print_values, 1 /* explicit */); do_cleanups (cleanup); } - return MI_CMD_DONE; } /* Helper for mi_cmd_var_update(). */ diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 087b5e4..e4450da 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -23,22 +23,6 @@ #ifndef MI_CMDS_H #define MI_CMDS_H -/* An MI command can return any of the following. */ - -enum mi_cmd_result - { - /* Report the command as ``done''. Display both the ``NNN^done'' - message and the completion prompt. */ - MI_CMD_DONE = 0, - /* The command is still running in the forground. Main loop should - display the completion prompt. */ - MI_CMD_FORGROUND, - /* The MI command has already displayed its completion message. - Main loop will not display a completion message but will display - the completion prompt. */ - MI_CMD_QUIET - }; - enum print_values { PRINT_NO_VALUES, PRINT_ALL_VALUES, @@ -49,7 +33,7 @@ extern const char mi_no_values[]; extern const char mi_simple_values[]; extern const char mi_all_values[]; -typedef enum mi_cmd_result (mi_cmd_argv_ftype) (char *command, char **argv, int argc); +typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc); /* Function implementing each command */ extern mi_cmd_argv_ftype mi_cmd_break_insert; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index e329b8b..4a1821d 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -175,7 +175,7 @@ mi_interpreter_prompt_p (void *data) return 0; } -enum mi_cmd_result +void mi_cmd_interpreter_exec (char *command, char **argv, int argc) { struct interp *interp_to_use; @@ -220,7 +220,6 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc) if (mi_error_message != NULL) error ("%s", mi_error_message); do_cleanups (old_chain); - return MI_CMD_DONE; } /* diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index dd015f5..5d90c75 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -75,9 +75,6 @@ enum captured_mi_execute_command_actions to mi_execute_command. */ struct captured_mi_execute_command_args { - /* This return result of the MI command (output). */ - enum mi_cmd_result rc; - /* What action to perform when the call is finished (output). */ enum captured_mi_execute_command_actions action; @@ -98,11 +95,11 @@ char *current_token; int running_result_record_printed = 1; extern void _initialize_mi_main (void); -static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse); +static void mi_cmd_execute (struct mi_parse *parse); 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, +static void mi_execute_async_cli_command (char *cli_command, char **argv, int argc); static int register_changed_p (int regnum, struct regcache *, struct regcache *); @@ -117,7 +114,7 @@ static void timestamp (struct mi_timestamp *tv); static void print_diff_now (struct mi_timestamp *start); static void print_diff (struct mi_timestamp *start, struct mi_timestamp *end); -enum mi_cmd_result +void mi_cmd_gdb_exit (char *command, char **argv, int argc) { /* We have to print everything right here because we never return. */ @@ -127,59 +124,58 @@ mi_cmd_gdb_exit (char *command, char **argv, int argc) mi_out_put (uiout, raw_stdout); /* FIXME: The function called is not yet a formal libgdb function. */ quit_force (NULL, FROM_TTY); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_exec_run (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("run", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_next (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("next", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_next_instruction (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("nexti", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_step (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("step", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_step_instruction (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("stepi", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_finish (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("finish", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_until (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ return mi_execute_async_cli_command ("until", argv, argc); } -enum mi_cmd_result +void mi_cmd_exec_return (char *command, char **argv, int argc) { /* This command doesn't really execute the target, it just pops the @@ -196,11 +192,9 @@ mi_cmd_exec_return (char *command, char **argv, int argc) /* Because we have called return_command with from_tty = 0, we need to print the frame here. */ print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_exec_continue (char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ @@ -212,23 +206,16 @@ mi_cmd_exec_continue (char *command, char **argv, int argc) the result of the interrupt command, and the previous execution token when the target finally stops. See comments in mi_cmd_execute. */ -enum mi_cmd_result +void mi_cmd_exec_interrupt (char *command, char **argv, int argc) { if (!target_executing) error ("mi_cmd_exec_interrupt: Inferior not executing."); interrupt_target_command (NULL, 0); - if (current_token) - fputs_unfiltered (current_token, raw_stdout); - fputs_unfiltered ("^done", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); - fputs_unfiltered ("\n", raw_stdout); - return MI_CMD_QUIET; } -enum mi_cmd_result +void mi_cmd_thread_select (char *command, char **argv, int argc) { enum gdb_rc rc; @@ -244,11 +231,9 @@ mi_cmd_thread_select (char *command, char **argv, int argc) make_cleanup (xfree, mi_error_message); error ("%s", mi_error_message); } - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_thread_list_ids (char *command, char **argv, int argc) { enum gdb_rc rc; @@ -264,11 +249,9 @@ mi_cmd_thread_list_ids (char *command, char **argv, int argc) make_cleanup (xfree, mi_error_message); error ("%s", mi_error_message); } - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_thread_info (char *command, char **argv, int argc) { int thread = -1; @@ -280,10 +263,9 @@ mi_cmd_thread_info (char *command, char **argv, int argc) thread = atoi (argv[0]); print_thread_info (uiout, thread); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_data_list_register_names (char *command, char **argv, int argc) { int regnum, numregs; @@ -332,10 +314,9 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc) gdbarch_register_name (current_gdbarch, regnum)); } do_cleanups (cleanup); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) { static struct regcache *this_regs = NULL; @@ -400,7 +381,6 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) error ("bad register number"); } do_cleanups (cleanup); - return MI_CMD_DONE; } static int @@ -436,7 +416,7 @@ register_changed_p (int regnum, struct regcache *prev_regs, format argumetn there can be a sequence of numbers, indicating which registers to fetch the content of. If the format is the only argument, a list of all the registers with their values is returned. */ -enum mi_cmd_result +void mi_cmd_data_list_register_values (char *command, char **argv, int argc) { int regnum, numregs, format; @@ -494,7 +474,6 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) error ("bad register number"); } do_cleanups (list_cleanup); - return MI_CMD_DONE; } /* Output one register's contents in the desired format. */ @@ -549,7 +528,7 @@ get_register (int regnum, int format) /* Write given values into registers. The registers and values are given as pairs. The corresponding MI command is -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]*/ -enum mi_cmd_result +void mi_cmd_data_write_register_values (char *command, char **argv, int argc) { int numregs, i; @@ -597,13 +576,12 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc) else error ("bad register number"); } - return MI_CMD_DONE; } /* Evaluate the value of the argument. The argument is an expression. If the expression contains spaces it needs to be included in double quotes. */ -enum mi_cmd_result +void mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) { struct expression *expr; @@ -634,11 +612,9 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) ui_out_stream_delete (stb); do_cleanups (old_chain); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_target_download (char *command, char **argv, int argc) { char *run; @@ -651,11 +627,10 @@ mi_cmd_target_download (char *command, char **argv, int argc) execute_command (run, 0); do_cleanups (old_cleanups); - return MI_CMD_DONE; } /* Connect to the remote target. */ -enum mi_cmd_result +void mi_cmd_target_select (char *command, char **argv, int argc) { char *run = NULL; @@ -687,15 +662,6 @@ mi_cmd_target_select (char *command, char **argv, int argc) execute_command (run, 0); do_cleanups (old_cleanups); - - /* Issue the completion message here. */ - if (current_token) - fputs_unfiltered (current_token, raw_stdout); - fputs_unfiltered ("^connected", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); - fputs_unfiltered ("\n", raw_stdout); - return MI_CMD_QUIET; } /* DATA-MEMORY-READ: @@ -717,7 +683,7 @@ mi_cmd_target_select (char *command, char **argv, int argc) Returns: The number of bytes read is SIZE*ROW*COL. */ -enum mi_cmd_result +void mi_cmd_data_read_memory (char *command, char **argv, int argc) { struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); @@ -891,7 +857,6 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) do_cleanups (cleanup_list_memory); } do_cleanups (cleanups); - return MI_CMD_DONE; } /* DATA-MEMORY-WRITE: @@ -910,7 +875,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE). Prints nothing. */ -enum mi_cmd_result +void mi_cmd_data_write_memory (char *command, char **argv, int argc) { CORE_ADDR addr; @@ -975,11 +940,9 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc) write_memory (addr, buffer, word_size); /* Free the buffer. */ do_cleanups (old_chain); - - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_enable_timings (char *command, char **argv, int argc) { if (argc == 0) @@ -996,14 +959,13 @@ mi_cmd_enable_timings (char *command, char **argv, int argc) else goto usage_error; - return MI_CMD_DONE; + return; usage_error: error ("mi_cmd_enable_timings: Usage: %s {yes|no}", command); - return MI_CMD_DONE; } -enum mi_cmd_result +void mi_cmd_list_features (char *command, char **argv, int argc) { if (argc == 0) @@ -1016,12 +978,10 @@ mi_cmd_list_features (char *command, char **argv, int argc) ui_out_field_string (uiout, NULL, "thread-info"); do_cleanups (cleanup); - - return MI_CMD_DONE; + return; } error ("-list-features should be passed no arguments"); - return MI_CMD_DONE; } /* Execute a command within a safe environment. @@ -1058,7 +1018,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) if (do_timings) current_command_ts = context->cmd_start; - args->rc = mi_cmd_execute (context); + mi_cmd_execute (context); if (do_timings) timestamp (&cmd_finished); @@ -1069,10 +1029,13 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) to directly use the mi_interp's uiout, since the command could have reset the interpreter, in which case the current uiout will most likely crash in the mi_out_* routines. */ - if (args->rc == MI_CMD_DONE && !running_result_record_printed) + if (!running_result_record_printed) { fputs_unfiltered (context->token, raw_stdout); - fputs_unfiltered ("^done", raw_stdout); + /* There's no particularly good reason why target-connect results + in not ^done. Should kill ^connected for MI3. */ + fputs_unfiltered (strcmp (context->command, "target-select") == 0 + ? "^connected" : "^done", raw_stdout); mi_out_put (uiout, raw_stdout); mi_out_rewind (uiout); /* Have to check cmd_start, since the command could be @@ -1099,7 +1062,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) /* Call the "console" interpreter. */ argv[0] = "console"; argv[1] = context->command; - args->rc = mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); + mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); /* If we changed interpreters, DON'T print out anything. */ if (current_interp_named_p (INTERP_MI) @@ -1107,7 +1070,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) || current_interp_named_p (INTERP_MI2) || current_interp_named_p (INTERP_MI3)) { - if (args->rc == MI_CMD_DONE && !running_result_record_printed) + if (!running_result_record_printed) { fputs_unfiltered (context->token, raw_stdout); fputs_unfiltered ("^done", raw_stdout); @@ -1184,11 +1147,10 @@ mi_execute_command (char *cmd, int from_tty) /* ..... */ } -static enum mi_cmd_result +static void mi_cmd_execute (struct mi_parse *parse) { struct cleanup *cleanup; - enum mi_cmd_result r; free_all_values (); if (parse->cmd->argv_func != NULL) @@ -1210,9 +1172,8 @@ mi_cmd_execute (struct mi_parse *parse) } current_token = xstrdup (parse->token); cleanup = make_cleanup (free_current_contents, ¤t_token); - r = parse->cmd->argv_func (parse->command, parse->argv, parse->argc); + parse->cmd->argv_func (parse->command, parse->argv, parse->argc); do_cleanups (cleanup); - return r; } else if (parse->cmd->cli.cmd != 0) { @@ -1221,7 +1182,6 @@ mi_cmd_execute (struct mi_parse *parse) /* Must be a synchronous one. */ mi_execute_cli_command (parse->cmd->cli.cmd, parse->cmd->cli.args_p, parse->args); - return MI_CMD_DONE; } else { @@ -1236,9 +1196,6 @@ mi_cmd_execute (struct mi_parse *parse) make_cleanup_ui_file_delete (stb); error_stream (stb); - - /* unreacheable */ - return MI_CMD_DONE; } } @@ -1268,7 +1225,7 @@ mi_execute_cli_command (const char *cmd, int args_p, const char *args) } } -enum mi_cmd_result +void mi_execute_async_cli_command (char *cli_command, char **argv, int argc) { struct cleanup *old_cleanups; @@ -1295,9 +1252,7 @@ mi_execute_async_cli_command (char *cli_command, char **argv, int argc) do_cleanups (old_cleanups); if (do_timings) print_diff_now (current_command_ts); - return MI_CMD_QUIET; - } - return MI_CMD_DONE; + } } void diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 4e8b3ff..b4b6c1a 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -27,7 +27,7 @@ the provided (full or base) source file name. The entries are sorted in ascending PC order. */ -enum mi_cmd_result +void mi_cmd_symbol_list_lines (char *command, char **argv, int argc) { char *filename; @@ -60,6 +60,4 @@ mi_cmd_symbol_list_lines (char *command, char **argv, int argc) } do_cleanups (cleanup_stack); - - return MI_CMD_DONE; } |