From 9f33b8b7c19413efbb37638bdba54706e4da8573 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 5 Apr 2017 19:21:34 +0100 Subject: [PATCH] -Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter. --- gdb/ChangeLog | 61 +++++++++++++++++++++++++++++++ gdb/mi/mi-cmd-break.c | 12 +++---- gdb/mi/mi-cmd-catch.c | 8 ++--- gdb/mi/mi-cmd-disas.c | 2 +- gdb/mi/mi-cmd-env.c | 12 +++---- gdb/mi/mi-cmd-file.c | 6 ++-- gdb/mi/mi-cmd-info.c | 6 ++-- gdb/mi/mi-cmd-stack.c | 16 ++++----- gdb/mi/mi-cmd-target.c | 6 ++-- gdb/mi/mi-cmd-var.c | 34 +++++++++--------- gdb/mi/mi-cmds.h | 2 +- gdb/mi/mi-interp.c | 2 +- gdb/mi/mi-main.c | 80 ++++++++++++++++++++--------------------- gdb/mi/mi-symbol-cmds.c | 2 +- 14 files changed, 155 insertions(+), 94 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bc9fa4f6fa2..821aeafa8f9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,64 @@ +2017-04-05 Pedro Alves + + * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) + (mi_cmd_dprintf_insert, mi_cmd_break_passcount) + (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' + parameter. + * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) + (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. + * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' + parameter. + * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) + (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) + * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) + (mi_cmd_file_list_exec_source_files) + (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. + * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) + (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' + parameter. + * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) + (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) + (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) + (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) + (mi_cmd_stack_info_frame): Constify 'command' parameter. + * mi/mi-cmd-target.c (mi_cmd_target_file_get) + (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify + 'command' parameter. + * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) + (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) + (mi_cmd_var_set_frozen, mi_cmd_var_show_format) + (mi_cmd_var_info_num_children, mi_cmd_var_list_children) + (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) + (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) + (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) + (mi_cmd_var_update, mi_cmd_enable_pretty_printing) + (mi_cmd_var_set_update_range): Constify 'command' parameter. + * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. + * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' + parameter. + * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) + (mi_cmd_exec_next_instruction, mi_cmd_exec_step) + (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) + (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) + (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) + (mi_cmd_target_flash_erase, mi_cmd_thread_select) + (mi_cmd_thread_list_ids, mi_cmd_thread_info) + (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) + (mi_cmd_data_list_changed_registers) + (mi_cmd_data_write_register_values) + (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) + (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) + (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) + (mi_cmd_list_features, mi_cmd_list_target_features) + (mi_cmd_add_inferior, mi_cmd_remove_inferior) + (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) + (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) + (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) + (mi_cmd_trace_frame_collected): Constify 'command' + parameter. + * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify + 'command' parameter. + 2017-04-05 Pedro Alves * ada-lang.c (ada_completer_word_break_characters): Now a const diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index d80f35a1390..8cc6034e283 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -167,7 +167,7 @@ mi_argv_to_format (char **argv, int argc) If not, it will insert other type breakpoint. */ static void -mi_cmd_break_insert_1 (int dprintf, char *command, char **argv, int argc) +mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc) { char *address = NULL; int hardware = 0; @@ -365,7 +365,7 @@ mi_cmd_break_insert_1 (int dprintf, char *command, char **argv, int argc) See the MI manual for the list of possible options. */ void -mi_cmd_break_insert (char *command, char **argv, int argc) +mi_cmd_break_insert (const char *command, char **argv, int argc) { mi_cmd_break_insert_1 (0, command, argv, argc); } @@ -374,7 +374,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc) See the MI manual for the list of possible options. */ void -mi_cmd_dprintf_insert (char *command, char **argv, int argc) +mi_cmd_dprintf_insert (const char *command, char **argv, int argc) { mi_cmd_break_insert_1 (1, command, argv, argc); } @@ -387,7 +387,7 @@ enum wp_type }; void -mi_cmd_break_passcount (char *command, char **argv, int argc) +mi_cmd_break_passcount (const char *command, char **argv, int argc) { int n; int p; @@ -418,7 +418,7 @@ mi_cmd_break_passcount (char *command, char **argv, int argc) -break-watch -a --> insert an access wp. */ void -mi_cmd_break_watch (char *command, char **argv, int argc) +mi_cmd_break_watch (const char *command, char **argv, int argc) { char *expr = NULL; enum wp_type type = REG_WP; @@ -496,7 +496,7 @@ mi_read_next_line (void) } void -mi_cmd_break_commands (char *command, char **argv, int argc) +mi_cmd_break_commands (const char *command, char **argv, int argc) { struct command_line *break_command; char *endptr; diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c index ee189f3b348..a767ee77861 100644 --- a/gdb/mi/mi-cmd-catch.c +++ b/gdb/mi/mi-cmd-catch.c @@ -30,7 +30,7 @@ /* Handler for the -catch-assert command. */ void -mi_cmd_catch_assert (char *cmd, char *argv[], int argc) +mi_cmd_catch_assert (const char *cmd, char *argv[], int argc) { struct gdbarch *gdbarch = get_current_arch(); char *condition = NULL; @@ -91,7 +91,7 @@ mi_cmd_catch_assert (char *cmd, char *argv[], int argc) /* Handler for the -catch-exception command. */ void -mi_cmd_catch_exception (char *cmd, char *argv[], int argc) +mi_cmd_catch_exception (const char *cmd, char *argv[], int argc) { struct gdbarch *gdbarch = get_current_arch(); char *condition = NULL; @@ -225,7 +225,7 @@ mi_catch_load_unload (int load, char *argv[], int argc) /* Handler for the -catch-load. */ void -mi_cmd_catch_load (char *cmd, char *argv[], int argc) +mi_cmd_catch_load (const char *cmd, char *argv[], int argc) { mi_catch_load_unload (1, argv, argc); } @@ -234,7 +234,7 @@ mi_cmd_catch_load (char *cmd, char *argv[], int argc) /* Handler for the -catch-unload. */ void -mi_cmd_catch_unload (char *cmd, char *argv[], int argc) +mi_cmd_catch_unload (const char *cmd, char *argv[], int argc) { mi_catch_load_unload (0, argv, argc); } diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index 9338f7bdec4..fa36311f897 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -51,7 +51,7 @@ 5 -- disassembly, source (pc-centric) and opcodes. */ void -mi_cmd_disassemble (char *command, char **argv, int argc) +mi_cmd_disassemble (const char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); struct ui_out *uiout = current_uiout; diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index dd13de46584..a6347ee11e2 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -65,7 +65,7 @@ env_execute_cli_command (const char *cmd, const char *args) /* Print working directory. */ void -mi_cmd_env_pwd (char *command, char **argv, int argc) +mi_cmd_env_pwd (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; @@ -90,7 +90,7 @@ mi_cmd_env_pwd (char *command, char **argv, int argc) /* Change working directory. */ void -mi_cmd_env_cd (char *command, char **argv, int argc) +mi_cmd_env_cd (const char *command, char **argv, int argc) { if (argc == 0 || argc > 1) error (_("-environment-cd: Usage DIRECTORY")); @@ -112,7 +112,7 @@ env_mod_path (char *dirname, char **which_path) /* Add one or more directories to start of executable search path. */ void -mi_cmd_env_path (char *command, char **argv, int argc) +mi_cmd_env_path (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; char *exec_path; @@ -187,7 +187,7 @@ mi_cmd_env_path (char *command, char **argv, int argc) /* Add zero or more directories to the front of the source path. */ void -mi_cmd_env_dir (char *command, char **argv, int argc) +mi_cmd_env_dir (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; int i; @@ -248,7 +248,7 @@ mi_cmd_env_dir (char *command, char **argv, int argc) /* Set the inferior terminal device name. */ void -mi_cmd_inferior_tty_set (char *command, char **argv, int argc) +mi_cmd_inferior_tty_set (const char *command, char **argv, int argc) { set_inferior_io_terminal (argv[0]); } @@ -256,7 +256,7 @@ mi_cmd_inferior_tty_set (char *command, char **argv, int argc) /* Print the inferior terminal device name. */ void -mi_cmd_inferior_tty_show (char *command, char **argv, int argc) +mi_cmd_inferior_tty_show (const char *command, char **argv, int argc) { const char *inferior_io_terminal = get_inferior_io_terminal (); diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index a2ad392c9fd..d166ff6ee3c 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -34,7 +34,7 @@ current file being executed. */ void -mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) +mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc) { struct symtab_and_line st; struct ui_out *uiout = current_uiout; @@ -81,7 +81,7 @@ print_partial_file_name (const char *filename, const char *fullname, } void -mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) +mi_cmd_file_list_exec_source_files (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct compunit_symtab *cu; @@ -114,7 +114,7 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) /* See mi-cmds.h. */ void -mi_cmd_file_list_shared_libraries (char *command, char **argv, int argc) +mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; const char *pattern; diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c index e8d2c607ec2..eba1ca283b7 100644 --- a/gdb/mi/mi-cmd-info.c +++ b/gdb/mi/mi-cmd-info.c @@ -25,7 +25,7 @@ /* Implement the "-info-ada-exceptions" GDB/MI command. */ void -mi_cmd_info_ada_exceptions (char *command, char **argv, int argc) +mi_cmd_info_ada_exceptions (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct gdbarch *gdbarch = get_current_arch (); @@ -74,7 +74,7 @@ mi_cmd_info_ada_exceptions (char *command, char **argv, int argc) /* Implement the "-info-gdb-mi-command" GDB/MI command. */ void -mi_cmd_info_gdb_mi_command (char *command, char **argv, int argc) +mi_cmd_info_gdb_mi_command (const char *command, char **argv, int argc) { const char *cmd_name; struct mi_cmd *cmd; @@ -101,7 +101,7 @@ mi_cmd_info_gdb_mi_command (char *command, char **argv, int argc) } void -mi_cmd_info_os (char *command, char **argv, int argc) +mi_cmd_info_os (const char *command, char **argv, int argc) { switch (argc) { diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index acb44a28ee5..bb56205f058 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -46,7 +46,7 @@ static void list_args_or_locals (enum what_to_list what, static int frame_filters = 0; void -mi_cmd_enable_frame_filters (char *command, char **argv, int argc) +mi_cmd_enable_frame_filters (const char *command, char **argv, int argc) { if (argc != 0) error (_("-enable-frame-filters: no arguments allowed")); @@ -76,7 +76,7 @@ mi_apply_ext_lang_frame_filter (struct frame_info *frame, int flags, displayed. */ void -mi_cmd_stack_list_frames (char *command, char **argv, int argc) +mi_cmd_stack_list_frames (const char *command, char **argv, int argc) { int frame_low; int frame_high; @@ -181,7 +181,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc) } void -mi_cmd_stack_info_depth (char *command, char **argv, int argc) +mi_cmd_stack_info_depth (const char *command, char **argv, int argc) { int frame_high; int i; @@ -210,7 +210,7 @@ mi_cmd_stack_info_depth (char *command, char **argv, int argc) values. */ void -mi_cmd_stack_list_locals (char *command, char **argv, int argc) +mi_cmd_stack_list_locals (const char *command, char **argv, int argc) { struct frame_info *frame; int raw_arg = 0; @@ -284,7 +284,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc) values. */ void -mi_cmd_stack_list_args (char *command, char **argv, int argc) +mi_cmd_stack_list_args (const char *command, char **argv, int argc) { int frame_low; int frame_high; @@ -405,7 +405,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc) parse_print_value for possible values. */ void -mi_cmd_stack_list_variables (char *command, char **argv, int argc) +mi_cmd_stack_list_variables (const char *command, char **argv, int argc) { struct frame_info *frame; int raw_arg = 0; @@ -691,7 +691,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values, } void -mi_cmd_stack_select_frame (char *command, char **argv, int argc) +mi_cmd_stack_select_frame (const char *command, char **argv, int argc) { if (argc == 0 || argc > 1) error (_("-stack-select-frame: Usage: FRAME_SPEC")); @@ -700,7 +700,7 @@ mi_cmd_stack_select_frame (char *command, char **argv, int argc) } void -mi_cmd_stack_info_frame (char *command, char **argv, int argc) +mi_cmd_stack_info_frame (const char *command, char **argv, int argc) { if (argc > 0) error (_("-stack-info-frame: No arguments allowed")); diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c index 8345ad8d69c..cdf45b9f7d6 100644 --- a/gdb/mi/mi-cmd-target.c +++ b/gdb/mi/mi-cmd-target.c @@ -24,7 +24,7 @@ /* Get a file from the target. */ void -mi_cmd_target_file_get (char *command, char **argv, int argc) +mi_cmd_target_file_get (const char *command, char **argv, int argc) { int oind = 0; char *oarg; @@ -48,7 +48,7 @@ mi_cmd_target_file_get (char *command, char **argv, int argc) /* Send a file to the target. */ void -mi_cmd_target_file_put (char *command, char **argv, int argc) +mi_cmd_target_file_put (const char *command, char **argv, int argc) { int oind = 0; char *oarg; @@ -72,7 +72,7 @@ mi_cmd_target_file_put (char *command, char **argv, int argc) /* Delete a file on the target. */ void -mi_cmd_target_file_delete (char *command, char **argv, int argc) +mi_cmd_target_file_delete (const char *command, char **argv, int argc) { int oind = 0; char *oarg; diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index fdfc72604ab..430c07b9de0 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -89,7 +89,7 @@ print_varobj (struct varobj *var, enum print_values print_values, /* VAROBJ operations */ void -mi_cmd_var_create (char *command, char **argv, int argc) +mi_cmd_var_create (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; CORE_ADDR frameaddr = 0; @@ -150,7 +150,7 @@ mi_cmd_var_create (char *command, char **argv, int argc) } void -mi_cmd_var_delete (char *command, char **argv, int argc) +mi_cmd_var_delete (const char *command, char **argv, int argc) { char *name; struct varobj *var; @@ -232,7 +232,7 @@ mi_parse_format (const char *arg) } void -mi_cmd_var_set_format (char *command, char **argv, int argc) +mi_cmd_var_set_format (const char *command, char **argv, int argc) { enum varobj_display_formats format; struct varobj *var; @@ -258,7 +258,7 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) } void -mi_cmd_var_set_visualizer (char *command, char **argv, int argc) +mi_cmd_var_set_visualizer (const char *command, char **argv, int argc) { struct varobj *var; @@ -274,7 +274,7 @@ mi_cmd_var_set_visualizer (char *command, char **argv, int argc) } void -mi_cmd_var_set_frozen (char *command, char **argv, int argc) +mi_cmd_var_set_frozen (const char *command, char **argv, int argc) { struct varobj *var; int frozen; @@ -299,7 +299,7 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc) } void -mi_cmd_var_show_format (char *command, char **argv, int argc) +mi_cmd_var_show_format (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; enum varobj_display_formats format; @@ -318,7 +318,7 @@ mi_cmd_var_show_format (char *command, char **argv, int argc) } void -mi_cmd_var_info_num_children (char *command, char **argv, int argc) +mi_cmd_var_info_num_children (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -365,7 +365,7 @@ mi_print_value_p (struct varobj *var, enum print_values print_values) } void -mi_cmd_var_list_children (char *command, char **argv, int argc) +mi_cmd_var_list_children (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -434,7 +434,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) } void -mi_cmd_var_info_type (char *command, char **argv, int argc) +mi_cmd_var_info_type (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -450,7 +450,7 @@ mi_cmd_var_info_type (char *command, char **argv, int argc) } void -mi_cmd_var_info_path_expression (char *command, char **argv, int argc) +mi_cmd_var_info_path_expression (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -467,7 +467,7 @@ mi_cmd_var_info_path_expression (char *command, char **argv, int argc) } void -mi_cmd_var_info_expression (char *command, char **argv, int argc) +mi_cmd_var_info_expression (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; const struct language_defn *lang; @@ -488,7 +488,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc) } void -mi_cmd_var_show_attributes (char *command, char **argv, int argc) +mi_cmd_var_show_attributes (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; int attr; @@ -512,7 +512,7 @@ mi_cmd_var_show_attributes (char *command, char **argv, int argc) } void -mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) +mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -579,7 +579,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) } void -mi_cmd_var_assign (char *command, char **argv, int argc) +mi_cmd_var_assign (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct varobj *var; @@ -646,7 +646,7 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer) } void -mi_cmd_var_update (char *command, char **argv, int argc) +mi_cmd_var_update (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct cleanup *cleanup; @@ -797,7 +797,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values, } void -mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) +mi_cmd_enable_pretty_printing (const char *command, char **argv, int argc) { if (argc != 0) error (_("-enable-pretty-printing: no arguments allowed")); @@ -806,7 +806,7 @@ mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) } void -mi_cmd_var_set_update_range (char *command, char **argv, int argc) +mi_cmd_var_set_update_range (const char *command, char **argv, int argc) { struct varobj *var; int from, to; diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index fcadfff92ca..03a11c0d739 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -28,7 +28,7 @@ enum print_values { PRINT_SIMPLE_VALUES }; -typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc); +typedef void (mi_cmd_argv_ftype) (const char *command, char **argv, int argc); /* Declarations of the functions implementing each command. */ diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index b2ac80037cf..a769fe9f5cf 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -202,7 +202,7 @@ mi_interp::exec (const char *command) } void -mi_cmd_interpreter_exec (char *command, char **argv, int argc) +mi_cmd_interpreter_exec (const char *command, char **argv, int argc) { struct interp *interp_to_use; int i; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index cf4e45ad413..9a876574201 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -145,7 +145,7 @@ static void print_diff (struct ui_file *file, struct mi_timestamp *start, struct mi_timestamp *end); void -mi_cmd_gdb_exit (char *command, char **argv, int argc) +mi_cmd_gdb_exit (const char *command, char **argv, int argc) { struct mi_interp *mi = (struct mi_interp *) current_interpreter (); @@ -160,7 +160,7 @@ mi_cmd_gdb_exit (char *command, char **argv, int argc) } void -mi_cmd_exec_next (char *command, char **argv, int argc) +mi_cmd_exec_next (const char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ if (argc > 0 && strcmp(argv[0], "--reverse") == 0) @@ -170,7 +170,7 @@ mi_cmd_exec_next (char *command, char **argv, int argc) } void -mi_cmd_exec_next_instruction (char *command, char **argv, int argc) +mi_cmd_exec_next_instruction (const char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ if (argc > 0 && strcmp(argv[0], "--reverse") == 0) @@ -180,7 +180,7 @@ mi_cmd_exec_next_instruction (char *command, char **argv, int argc) } void -mi_cmd_exec_step (char *command, char **argv, int argc) +mi_cmd_exec_step (const char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ if (argc > 0 && strcmp(argv[0], "--reverse") == 0) @@ -190,7 +190,7 @@ mi_cmd_exec_step (char *command, char **argv, int argc) } void -mi_cmd_exec_step_instruction (char *command, char **argv, int argc) +mi_cmd_exec_step_instruction (const char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ if (argc > 0 && strcmp(argv[0], "--reverse") == 0) @@ -200,7 +200,7 @@ mi_cmd_exec_step_instruction (char *command, char **argv, int argc) } void -mi_cmd_exec_finish (char *command, char **argv, int argc) +mi_cmd_exec_finish (const char *command, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ if (argc > 0 && strcmp(argv[0], "--reverse") == 0) @@ -210,7 +210,7 @@ mi_cmd_exec_finish (char *command, char **argv, int argc) } void -mi_cmd_exec_return (char *command, char **argv, int argc) +mi_cmd_exec_return (const char *command, char **argv, int argc) { /* This command doesn't really execute the target, it just pops the specified number of frames. */ @@ -229,7 +229,7 @@ mi_cmd_exec_return (char *command, char **argv, int argc) } void -mi_cmd_exec_jump (char *args, char **argv, int argc) +mi_cmd_exec_jump (const char *args, char **argv, int argc) { /* FIXME: Should call a libgdb function, not a cli wrapper. */ mi_execute_async_cli_command ("jump", argv, argc); @@ -336,7 +336,7 @@ exec_reverse_continue (char **argv, int argc) } void -mi_cmd_exec_continue (char *command, char **argv, int argc) +mi_cmd_exec_continue (const char *command, char **argv, int argc) { if (argc > 0 && strcmp (argv[0], "--reverse") == 0) exec_reverse_continue (argv + 1, argc - 1); @@ -366,7 +366,7 @@ interrupt_thread_callback (struct thread_info *thread, void *arg) mi_cmd_execute. */ void -mi_cmd_exec_interrupt (char *command, char **argv, int argc) +mi_cmd_exec_interrupt (const char *command, char **argv, int argc) { /* In all-stop mode, everything stops, so we don't need to try anything specific. */ @@ -436,7 +436,7 @@ run_one_inferior (struct inferior *inf, void *arg) } void -mi_cmd_exec_run (char *command, char **argv, int argc) +mi_cmd_exec_run (const char *command, char **argv, int argc) { int start_p = 0; @@ -504,7 +504,7 @@ find_thread_of_process (struct thread_info *ti, void *p) } void -mi_cmd_target_detach (char *command, char **argv, int argc) +mi_cmd_target_detach (const char *command, char **argv, int argc) { if (argc != 0 && argc != 1) error (_("Usage: -target-detach [pid | thread-group]")); @@ -552,13 +552,13 @@ mi_cmd_target_detach (char *command, char **argv, int argc) } void -mi_cmd_target_flash_erase (char *command, char **argv, int argc) +mi_cmd_target_flash_erase (const char *command, char **argv, int argc) { flash_erase_command (NULL, 0); } void -mi_cmd_thread_select (char *command, char **argv, int argc) +mi_cmd_thread_select (const char *command, char **argv, int argc) { enum gdb_rc rc; char *mi_error_message; @@ -588,7 +588,7 @@ mi_cmd_thread_select (char *command, char **argv, int argc) } void -mi_cmd_thread_list_ids (char *command, char **argv, int argc) +mi_cmd_thread_list_ids (const char *command, char **argv, int argc) { enum gdb_rc rc; char *mi_error_message; @@ -606,7 +606,7 @@ mi_cmd_thread_list_ids (char *command, char **argv, int argc) } void -mi_cmd_thread_info (char *command, char **argv, int argc) +mi_cmd_thread_info (const char *command, char **argv, int argc) { if (argc != 0 && argc != 1) error (_("Invalid MI command")); @@ -903,7 +903,7 @@ list_available_thread_groups (VEC (int) *ids, int recurse) } void -mi_cmd_list_thread_groups (char *command, char **argv, int argc) +mi_cmd_list_thread_groups (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct cleanup *back_to; @@ -1005,7 +1005,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc) } void -mi_cmd_data_list_register_names (char *command, char **argv, int argc) +mi_cmd_data_list_register_names (const char *command, char **argv, int argc) { struct gdbarch *gdbarch; struct ui_out *uiout = current_uiout; @@ -1056,7 +1056,7 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc) } void -mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) +mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) { static struct regcache *this_regs = NULL; struct ui_out *uiout = current_uiout; @@ -1167,7 +1167,7 @@ register_changed_p (int regnum, struct regcache *prev_regs, their values is returned. */ void -mi_cmd_data_list_register_values (char *command, char **argv, int argc) +mi_cmd_data_list_register_values (const char *command, char **argv, int argc) { struct ui_out *uiout = current_uiout; struct frame_info *frame; @@ -1296,7 +1296,7 @@ output_register (struct frame_info *frame, int regnum, int format, -data-write-register-values [ ... ] */ void -mi_cmd_data_write_register_values (char *command, char **argv, int argc) +mi_cmd_data_write_register_values (const char *command, char **argv, int argc) { struct regcache *regcache; struct gdbarch *gdbarch; @@ -1353,7 +1353,7 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc) included in double quotes. */ void -mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) +mi_cmd_data_evaluate_expression (const char *command, char **argv, int argc) { struct value *val; struct value_print_options opts; @@ -1397,7 +1397,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) The number of bytes read is SIZE*ROW*COL. */ void -mi_cmd_data_read_memory (char *command, char **argv, int argc) +mi_cmd_data_read_memory (const char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); struct ui_out *uiout = current_uiout; @@ -1578,7 +1578,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) } void -mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc) +mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); struct ui_out *uiout = current_uiout; @@ -1679,7 +1679,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc) Prints nothing. */ void -mi_cmd_data_write_memory (char *command, char **argv, int argc) +mi_cmd_data_write_memory (const char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -1752,7 +1752,7 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc) COUNT: number of bytes to be filled (decimal integer). */ void -mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc) +mi_cmd_data_write_memory_bytes (const char *command, char **argv, int argc) { CORE_ADDR addr; char *cdata; @@ -1826,7 +1826,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc) } void -mi_cmd_enable_timings (char *command, char **argv, int argc) +mi_cmd_enable_timings (const char *command, char **argv, int argc) { if (argc == 0) do_timings = 1; @@ -1849,7 +1849,7 @@ mi_cmd_enable_timings (char *command, char **argv, int argc) } void -mi_cmd_list_features (char *command, char **argv, int argc) +mi_cmd_list_features (const char *command, char **argv, int argc) { if (argc == 0) { @@ -1879,7 +1879,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) } void -mi_cmd_list_target_features (char *command, char **argv, int argc) +mi_cmd_list_target_features (const char *command, char **argv, int argc) { if (argc == 0) { @@ -1899,7 +1899,7 @@ mi_cmd_list_target_features (char *command, char **argv, int argc) } void -mi_cmd_add_inferior (char *command, char **argv, int argc) +mi_cmd_add_inferior (const char *command, char **argv, int argc) { struct inferior *inf; @@ -1924,7 +1924,7 @@ get_other_inferior (struct inferior *inf, void *arg) } void -mi_cmd_remove_inferior (char *command, char **argv, int argc) +mi_cmd_remove_inferior (const char *command, char **argv, int argc) { int id; struct inferior *inf; @@ -2485,7 +2485,7 @@ print_diff (struct ui_file *file, struct mi_timestamp *start, } void -mi_cmd_trace_define_variable (char *command, char **argv, int argc) +mi_cmd_trace_define_variable (const char *command, char **argv, int argc) { LONGEST initval = 0; struct trace_state_variable *tsv; @@ -2511,7 +2511,7 @@ mi_cmd_trace_define_variable (char *command, char **argv, int argc) } void -mi_cmd_trace_list_variables (char *command, char **argv, int argc) +mi_cmd_trace_list_variables (const char *command, char **argv, int argc) { if (argc != 0) error (_("-trace-list-variables: no arguments allowed")); @@ -2520,7 +2520,7 @@ mi_cmd_trace_list_variables (char *command, char **argv, int argc) } void -mi_cmd_trace_find (char *command, char **argv, int argc) +mi_cmd_trace_find (const char *command, char **argv, int argc) { char *mode; @@ -2603,7 +2603,7 @@ mi_cmd_trace_find (char *command, char **argv, int argc) } void -mi_cmd_trace_save (char *command, char **argv, int argc) +mi_cmd_trace_save (const char *command, char **argv, int argc) { int target_saves = 0; int generate_ctf = 0; @@ -2653,19 +2653,19 @@ mi_cmd_trace_save (char *command, char **argv, int argc) } void -mi_cmd_trace_start (char *command, char **argv, int argc) +mi_cmd_trace_start (const char *command, char **argv, int argc) { start_tracing (NULL); } void -mi_cmd_trace_status (char *command, char **argv, int argc) +mi_cmd_trace_status (const char *command, char **argv, int argc) { trace_status_mi (0); } void -mi_cmd_trace_stop (char *command, char **argv, int argc) +mi_cmd_trace_stop (const char *command, char **argv, int argc) { stop_tracing (NULL); trace_status_mi (1); @@ -2674,7 +2674,7 @@ mi_cmd_trace_stop (char *command, char **argv, int argc) /* Implement the "-ada-task-info" command. */ void -mi_cmd_ada_task_info (char *command, char **argv, int argc) +mi_cmd_ada_task_info (const char *command, char **argv, int argc) { if (argc != 0 && argc != 1) error (_("Invalid MI command")); @@ -2742,7 +2742,7 @@ print_variable_or_computed (const char *expression, enum print_values values) /* Implement the "-trace-frame-collected" command. */ void -mi_cmd_trace_frame_collected (char *command, char **argv, int argc) +mi_cmd_trace_frame_collected (const char *command, char **argv, int argc) { struct cleanup *old_chain; struct bp_location *tloc; diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index acbb27b0bf7..6614447cb94 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -27,7 +27,7 @@ in ascending PC order. */ void -mi_cmd_symbol_list_lines (char *command, char **argv, int argc) +mi_cmd_symbol_list_lines (const char *command, char **argv, int argc) { struct gdbarch *gdbarch; char *filename; -- 2.30.2