diff options
Diffstat (limited to 'gdb')
46 files changed, 355 insertions, 318 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 740d75f..25ece7f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,105 @@ 2017-11-07 Tom Tromey <tom@tromey.com> + * solib.h (no_shared_libraries): Constify. + * frame.h (return_command): Constify. + * cli/cli-cmds.h (quit_command): Constify. + * top.h (quit_command, execute_command): Constify. + * target.h (flash_erase_command): Constify. + * inferior.h (set_inferior_args, attach_command): Constify. + * tracepoint.h (start_tracing, stop_tracing): Constify. + * breakpoint.h (break_command, tbreak_command) + (hbreak_command_wrapper, thbreak_command_wrapper) + (rbreak_command_wrapper, watch_command_wrapper) + (awatch_command_wrapper, rwatch_command_wrapper) + (get_tracepoint_by_number): Constify. + * symtab.c (info_variables_command, rbreak_command) + (symtab_symbol_info): Constify. + (info_variables_command): Add non-const overload. + * top.c (dont_repeat_command): Constify. + * breakpoint.c (ignore_command, commands_command) + (condition_command, tbreak_command, hbreak_command) + (thbreak_command, clear_command, break_command) + (info_breakpoints_command, watch_command, rwatch_command) + (awatch_command, trace_command, ftrace_command, strace_command) + (trace_pass_command, break_range_command, dprintf_command) + (agent_printf_command, get_tracepoint_by_number) + (watch_maybe_just_location, trace_pass_command): Constify. + (info_breakpoints_command): Add non-const overload. + * tracefile.c (tsave_command): Constify. + * infcmd.c (attach_command, disconnect_command, signal_command) + (queue_signal_command, stepi_command, nexti_command) + (finish_command, next_command, step_command, until_command) + (advance_command, jump_command, continue_command, run_command) + (start_command, starti_command, interrupt_command) + (run_command_1, set_inferior_args, step_1): Constify. + * inferior.c (add_inferior_command, remove_inferior_command) + (clone_inferior_command): Constify. + * linux-fork.c (checkpoint_command, restart_command): Constify. + * windows-nat.c (signal_event_command): Constify. + * guile/guile.c (guile_repl_command, guile_command): Constify. + * printcmd.c (x_command, display_command, printf_command) + (output_command, set_command, call_command, print_command) + (eval_command): Constify. + (non_const_set_command): Remove. + (_initialize_printcmd): Update. + * source.c (forward_search_command, reverse_search_command): + Constify. + * jit.c (jit_reader_load_command, jit_reader_unload_command): + Constify. + * infrun.c (handle_command): Constify. + * memattr.c (mem_command): Constify. + * stack.c (return_command, up_command, up_silently_command) + (down_command, down_silently_command, frame_command) + (backtrace_command, func_command, backtrace_command_1): Constify. + (backtrace_command): Add non-const overload. + * remote-sim.c (simulator_command): Constify. + * exec.c (set_section_command): Constify. + * tracepoint.c (tdump_command, trace_variable_command) + (tstatus_command, tstop_command, tstart_command) + (end_actions_pseudocommand, while_stepping_pseudocommand) + (collect_pseudocommand, teval_pseudocommand, actions_command) + (start_tracing, stop_tracing): Constify. + * value.c (init_if_undefined_command): Constify. + * tui/tui-stack.c (tui_update_command): Constify. + * tui/tui-win.c (tui_refresh_all_command) + (tui_set_tab_width_command, tui_set_win_height_command) + (tui_set_focus_command, tui_scroll_forward_command) + (tui_scroll_backward_command, tui_scroll_left_command) + (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) + (tui_set_win_height): Constify. + * tui/tui-layout.c (tui_layout_command): Constify. + * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) + (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) + (proc_untrace_sysexit_cmd): Constify. + * remote.c (threadlist_test_cmd, threadinfo_test_cmd) + (threadset_test_cmd, threadlist_update_test_cmd) + (threadalive_test): Constify. + * objc-lang.c (print_object_command): Constify. + * command.h (add_com): Constify. + * cli/cli-dump.c (restore_command): Constify. + * cli/cli-cmds.c (pwd_command, echo_command, quit_command) + (help_command, complete_command, shell_command, edit_command) + (list_command, disassemble_command, make_command) + (apropos_command, alias_command): Constify. + * cli/cli-script.c (document_command, define_command) + (while_command, if_command, validate_comname): Constify. + * cli/cli-decode.c (struct cmd_list_element): Change type of + "fun". + * target.c (do_monitor_command, flash_erase_command): Constify. + * regcache.c (reg_flush_command): Constify. + * reverse.c (reverse_step, reverse_next, reverse_stepi) + (reverse_nexti, reverse_continue, reverse_finish) + (save_bookmark_command, goto_bookmark_command) + (exec_reverse_once): Constify. + * python/python.c (python_interactive_command, python_command): + Constify. + * typeprint.c (ptype_command, whatis_command, whatis_exp): + Constify. + * solib.c (sharedlibrary_command, no_shared_libraries): Constify. + * gcore.c (gcore_command): Constify. + +2017-11-07 Tom Tromey <tom@tromey.com> + * printcmd.c (x_command): Call set_repeat_arguments. * cli/cli-cmds.c (list_command): Call set_repeat_arguments. * top.c (repeat_arguments): New global. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 97f704a..4272378 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -96,8 +96,6 @@ enum exception_event_kind static void map_breakpoint_numbers (const char *, gdb::function_view<void (breakpoint *)>); -static void ignore_command (char *, int); - static void breakpoint_re_set_default (struct breakpoint *); static void @@ -119,8 +117,6 @@ static std::vector<symtab_and_line> decode_location_default (struct breakpoint *b, const struct event_location *location, struct program_space *search_pspace); -static void clear_command (char *, int); - static int can_use_hardware_watchpoint (struct value *); static void mention (struct breakpoint *); @@ -165,14 +161,8 @@ static int breakpoint_location_address_range_overlap (struct bp_location *, const address_space *, CORE_ADDR, int); -static void info_breakpoints_command (char *, int); - static void info_watchpoints_command (char *, int); -static void commands_command (char *, int); - -static void condition_command (char *, int); - static int remove_breakpoint (struct bp_location *); static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason); @@ -186,10 +176,6 @@ static int hw_watchpoint_used_count_others (struct breakpoint *except, enum bptype type, int *other_type_used); -static void hbreak_command (char *, int); - -static void thbreak_command (char *, int); - static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp, int count); @@ -248,7 +234,7 @@ static void enable_trace_command (char *, int); static void disable_trace_command (char *, int); -static void trace_pass_command (char *, int); +static void trace_pass_command (const char *, int); static void set_tracepoint_count (int num); @@ -980,10 +966,10 @@ condition_completer (struct cmd_list_element *cmd, /* condition N EXP -- set break condition of breakpoint N to EXP. */ static void -condition_command (char *arg, int from_tty) +condition_command (const char *arg, int from_tty) { struct breakpoint *b; - char *p; + const char *p; int bnum; if (arg == 0) @@ -1301,7 +1287,7 @@ commands_command_1 (const char *arg, int from_tty, } static void -commands_command (char *arg, int from_tty) +commands_command (const char *arg, int from_tty) { commands_command_1 (arg, from_tty, NULL); } @@ -6712,13 +6698,21 @@ default_collect_info (void) } static void -info_breakpoints_command (char *args, int from_tty) +info_breakpoints_command (const char *args, int from_tty) { breakpoint_1 (args, 0, NULL); default_collect_info (); } +/* Temporary non-const overload. */ + +static void +info_breakpoints_command (char *args, int from_tty) +{ + info_breakpoints_command ((const char *) args, from_tty); +} + static void info_watchpoints_command (char *args, int from_tty) { @@ -9632,25 +9626,25 @@ resolve_sal_pc (struct symtab_and_line *sal) } void -break_command (char *arg, int from_tty) +break_command (const char *arg, int from_tty) { break_command_1 (arg, 0, from_tty); } void -tbreak_command (char *arg, int from_tty) +tbreak_command (const char *arg, int from_tty) { break_command_1 (arg, BP_TEMPFLAG, from_tty); } static void -hbreak_command (char *arg, int from_tty) +hbreak_command (const char *arg, int from_tty) { break_command_1 (arg, BP_HARDWAREFLAG, from_tty); } static void -thbreak_command (char *arg, int from_tty) +thbreak_command (const char *arg, int from_tty) { break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty); } @@ -9734,9 +9728,8 @@ stopat_command (const char *arg, int from_tty) line. */ static void -dprintf_command (char *arg_in, int from_tty) +dprintf_command (const char *arg, int from_tty) { - const char *arg = arg_in; event_location_up location = string_to_event_location (&arg, current_language); /* If non-NULL, ARG should have been advanced past the location; @@ -9766,7 +9759,7 @@ dprintf_command (char *arg_in, int from_tty) } static void -agent_printf_command (char *arg, int from_tty) +agent_printf_command (const char *arg, int from_tty) { error (_("May only run agent-printf on the target")); } @@ -9950,9 +9943,8 @@ find_breakpoint_range_end (struct symtab_and_line sal) /* Implement the "break-range" CLI command. */ static void -break_range_command (char *arg_in, int from_tty) +break_range_command (const char *arg, int from_tty) { - const char *arg = arg_in; const char *arg_start; struct linespec_result canonical_start, canonical_end; int bp_count, can_use_bp, length; @@ -11056,7 +11048,7 @@ watch_command_wrapper (const char *arg, int from_tty, int internal) calls watch_command_1. */ static void -watch_maybe_just_location (char *arg, int accessflag, int from_tty) +watch_maybe_just_location (const char *arg, int accessflag, int from_tty) { int just_location = 0; @@ -11072,7 +11064,7 @@ watch_maybe_just_location (char *arg, int accessflag, int from_tty) } static void -watch_command (char *arg, int from_tty) +watch_command (const char *arg, int from_tty) { watch_maybe_just_location (arg, hw_write, from_tty); } @@ -11084,7 +11076,7 @@ rwatch_command_wrapper (const char *arg, int from_tty, int internal) } static void -rwatch_command (char *arg, int from_tty) +rwatch_command (const char *arg, int from_tty) { watch_maybe_just_location (arg, hw_read, from_tty); } @@ -11096,7 +11088,7 @@ awatch_command_wrapper (const char *arg, int from_tty, int internal) } static void -awatch_command (char *arg, int from_tty) +awatch_command (const char *arg, int from_tty) { watch_maybe_just_location (arg, hw_access, from_tty); } @@ -11503,7 +11495,7 @@ compare_breakpoints (const breakpoint *a, const breakpoint *b) /* Delete breakpoints by address or line. */ static void -clear_command (char *arg, int from_tty) +clear_command (const char *arg, int from_tty) { struct breakpoint *b; int default_match; @@ -14108,9 +14100,9 @@ set_ignore_count (int bptnum, int count, int from_tty) /* Command to set ignore-count of breakpoint N to COUNT. */ static void -ignore_command (char *args, int from_tty) +ignore_command (const char *args, int from_tty) { - char *p = args; + const char *p = args; int num; if (p == 0) @@ -14737,9 +14729,8 @@ set_tracepoint_count (int num) } static void -trace_command (char *arg_in, int from_tty) +trace_command (const char *arg, int from_tty) { - const char *arg = arg_in; struct breakpoint_ops *ops; event_location_up location = string_to_event_location (&arg, @@ -14764,9 +14755,8 @@ trace_command (char *arg_in, int from_tty) } static void -ftrace_command (char *arg_in, int from_tty) +ftrace_command (const char *arg, int from_tty) { - const char *arg = arg_in; event_location_up location = string_to_event_location (&arg, current_language); create_breakpoint (get_current_arch (), @@ -14785,9 +14775,8 @@ ftrace_command (char *arg_in, int from_tty) /* strace command implementation. Creates a static tracepoint. */ static void -strace_command (char *arg_in, int from_tty) +strace_command (const char *arg, int from_tty) { - const char *arg = arg_in; struct breakpoint_ops *ops; event_location_up location; @@ -15023,16 +15012,16 @@ trace_pass_set_count (struct tracepoint *tp, int count, int from_tty) Also accepts special argument "all". */ static void -trace_pass_command (char *args, int from_tty) +trace_pass_command (const char *args, int from_tty) { struct tracepoint *t1; - unsigned int count; + ULONGEST count; if (args == 0 || *args == 0) error (_("passcount command requires an " "argument (count + optional TP num)")); - count = strtoul (args, &args, 10); /* Count comes first, then TP num. */ + count = strtoulst (args, &args, 10); /* Count comes first, then TP num. */ args = skip_spaces (args); if (*args && strncasecmp (args, "all", 3) == 0) @@ -15105,12 +15094,12 @@ get_tracepoint_by_number_on_target (int num) (tracepoint_count) is returned. */ struct tracepoint * -get_tracepoint_by_number (char **arg, +get_tracepoint_by_number (const char **arg, number_or_range_parser *parser) { struct breakpoint *t; int tpnum; - char *instring = arg == NULL ? NULL : *arg; + const char *instring = arg == NULL ? NULL : *arg; if (parser != NULL) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index aa06d11..cf8f3f6 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1261,15 +1261,15 @@ extern struct command_line *breakpoint_commands (struct breakpoint *b); NOT be deallocated after use. */ const char *bpdisp_text (enum bpdisp disp); -extern void break_command (char *, int); +extern void break_command (const char *, int); -extern void hbreak_command_wrapper (char *, int); -extern void thbreak_command_wrapper (char *, int); -extern void rbreak_command_wrapper (char *, int); +extern void hbreak_command_wrapper (const char *, int); +extern void thbreak_command_wrapper (const char *, int); +extern void rbreak_command_wrapper (const char *, int); extern void watch_command_wrapper (const char *, int, int); extern void awatch_command_wrapper (const char *, int, int); extern void rwatch_command_wrapper (const char *, int, int); -extern void tbreak_command (char *, int); +extern void tbreak_command (const char *, int); extern struct breakpoint_ops base_breakpoint_ops; extern struct breakpoint_ops bkpt_breakpoint_ops; @@ -1591,7 +1591,7 @@ extern struct tracepoint *get_tracepoint_by_number_on_target (int num); /* Find a tracepoint by parsing a number in the supplied string. */ extern struct tracepoint * - get_tracepoint_by_number (char **arg, + get_tracepoint_by_number (const char **arg, number_or_range_parser *parser); /* Return a vector of all tracepoints currently defined. The vector diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index a8edb13..be022d3 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -58,24 +58,6 @@ #include <algorithm> #include <string> -/* Prototypes for local command functions */ - -static void complete_command (char *, int); - -static void echo_command (char *, int); - -static void pwd_command (char *, int); - -static void help_command (char *, int); - -static void make_command (char *, int); - -static void shell_escape (const char *, int); - -static void edit_command (char *, int); - -static void list_command (char *, int); - /* Prototypes for local utility functions */ static void print_sal_location (const symtab_and_line &sal); @@ -238,7 +220,7 @@ show_command (char *arg, int from_tty) is ignored. */ static void -help_command (char *command, int from_tty) +help_command (const char *command, int from_tty) { help_cmd (command, gdb_stdout); } @@ -248,10 +230,8 @@ help_command (char *command, int from_tty) [Is that why this function writes output with *_unfiltered?] */ static void -complete_command (char *arg_entry, int from_tty) +complete_command (const char *arg, int from_tty) { - const char *arg = arg_entry; - dont_repeat (); if (max_completions == 0) @@ -356,7 +336,7 @@ show_configuration (const char *args, int from_tty) /* Handle the quit command. */ void -quit_command (char *args, int from_tty) +quit_command (const char *args, int from_tty) { int exit_code = 0; @@ -378,7 +358,7 @@ quit_command (char *args, int from_tty) } static void -pwd_command (char *args, int from_tty) +pwd_command (const char *args, int from_tty) { if (args) error (_("The \"pwd\" command does not take an argument: %s"), args); @@ -693,7 +673,7 @@ source_command (const char *args, int from_tty) static void -echo_command (char *text, int from_tty) +echo_command (const char *text, int from_tty) { const char *p = text; int c; @@ -785,13 +765,13 @@ shell_escape (const char *arg, int from_tty) /* Implementation of the "shell" command. */ static void -shell_command (char *arg, int from_tty) +shell_command (const char *arg, int from_tty) { shell_escape (arg, from_tty); } static void -edit_command (char *arg, int from_tty) +edit_command (const char *arg, int from_tty) { struct symtab_and_line sal; struct symbol *sym; @@ -891,7 +871,7 @@ edit_command (char *arg, int from_tty) } static void -list_command (char *arg, int from_tty) +list_command (const char *arg, int from_tty) { struct symbol *sym; const char *arg1; @@ -899,7 +879,7 @@ list_command (char *arg, int from_tty) int dummy_end = 0; int dummy_beg = 0; int linenum_beg = 0; - char *p; + const char *p; /* Pull in the current default source line if necessary. */ if (arg == NULL || ((arg[0] == '+' || arg[0] == '-') && arg[1] == '\0')) @@ -1205,7 +1185,7 @@ disassemble_current_function (gdb_disassembly_flags flags) 2) File names and contents for all relevant source files are displayed. */ static void -disassemble_command (char *arg, int from_tty) +disassemble_command (const char *arg, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); CORE_ADDR low, high; @@ -1295,7 +1275,7 @@ disassemble_command (char *arg, int from_tty) } static void -make_command (char *arg, int from_tty) +make_command (const char *arg, int from_tty) { if (arg == 0) shell_escape ("make", from_tty); @@ -1336,7 +1316,7 @@ show_user (const char *args, int from_tty) regular expression. */ static void -apropos_command (char *searchstr, int from_tty) +apropos_command (const char *searchstr, int from_tty) { if (searchstr == NULL) error (_("REGEXP string is empty")); @@ -1405,11 +1385,11 @@ alias_usage_error (void) /* Make an alias of an existing command. */ static void -alias_command (char *args, int from_tty) +alias_command (const char *args, int from_tty) { int i, alias_argc, command_argc; int abbrev_flag = 0; - char *equals; + const char *equals; const char *alias, *command; if (args == NULL || strchr (args, '=') == NULL) diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index 34d19f5..14fc931 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -114,7 +114,7 @@ extern void cd_command (const char *, int); /* Exported to gdb/top.c and gdb/main.c */ -extern void quit_command (char *, int); +extern void quit_command (const char *, int); extern void source_script (const char *, int); diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 76be7d3..e9baf38 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -931,7 +931,8 @@ add_info_alias (const char *name, const char *oldname, int abbrev_flag) /* Add an element to the list of commands. */ struct cmd_list_element * -add_com (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, +add_com (const char *name, enum command_class theclass, + cmd_const_cfunc_ftype *fun, const char *doc) { return add_cmd (name, theclass, fun, doc, &cmdlist); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 4eafffa..3443299 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -513,12 +513,11 @@ restore_binary_file (const char *filename, struct callback_data *data) } static void -restore_command (char *args_in, int from_tty) +restore_command (const char *args, int from_tty) { struct callback_data data; bfd *ibfd; int binary_flag = 0; - const char *args = args_in; if (!target_has_execution) noprocess (); diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index bbdfa40..b06dbc2 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -673,7 +673,7 @@ execute_control_command_untraced (struct command_line *cmd) loop condition is nonzero. */ static void -while_command (char *arg, int from_tty) +while_command (const char *arg, int from_tty) { control_level = 1; command_line_up command = get_command_line (while_control, arg); @@ -690,7 +690,7 @@ while_command (char *arg, int from_tty) on the value of the if conditional. */ static void -if_command (char *arg, int from_tty) +if_command (const char *arg, int from_tty) { control_level = 1; command_line_up command = get_command_line (if_control, arg); @@ -1366,10 +1366,10 @@ copy_command_lines (struct command_line *cmds) prefix. */ static struct cmd_list_element ** -validate_comname (char **comname) +validate_comname (const char **comname) { struct cmd_list_element **list = &cmdlist; - char *p, *last_word; + const char *p, *last_word; if (*comname == 0) error_no_arg (_("name of command to define")); @@ -1386,19 +1386,16 @@ validate_comname (char **comname) if (last_word != *comname) { struct cmd_list_element *c; - char saved_char; - const char *tem = *comname; /* Separate the prefix and the command. */ - saved_char = last_word[-1]; - last_word[-1] = '\0'; + std::string prefix (*comname, last_word - 1); + const char *tem = prefix.c_str (); c = lookup_cmd (&tem, cmdlist, "", 0, 1); if (c->prefixlist == NULL) - error (_("\"%s\" is not a prefix command."), *comname); + error (_("\"%s\" is not a prefix command."), prefix.c_str ()); list = c->prefixlist; - last_word[-1] = saved_char; *comname = last_word; } @@ -1420,7 +1417,7 @@ user_defined_command (const char *ignore, int from_tty) } static void -define_command (char *comname, int from_tty) +define_command (const char *comname, int from_tty) { #define MAX_TMPBUF 128 enum cmd_hook_type @@ -1430,8 +1427,7 @@ define_command (char *comname, int from_tty) CMD_POST_HOOK }; struct cmd_list_element *c, *newc, *hookc = 0, **list; - char *tem, *comfull; - const char *tem_c; + const char *tem, *comfull; char tmpbuf[MAX_TMPBUF]; int hook_type = CMD_NO_HOOK; int hook_name_size = 0; @@ -1445,8 +1441,8 @@ define_command (char *comname, int from_tty) list = validate_comname (&comname); /* Look it up, and verify that we got an exact match. */ - tem_c = comname; - c = lookup_cmd (&tem_c, *list, "", -1, 1); + tem = comname; + c = lookup_cmd (&tem, *list, "", -1, 1); if (c && strcmp (comname, c->name) != 0) c = 0; @@ -1480,8 +1476,8 @@ define_command (char *comname, int from_tty) if (hook_type != CMD_NO_HOOK) { /* Look up cmd it hooks, and verify that we got an exact match. */ - tem_c = comname + hook_name_size; - hookc = lookup_cmd (&tem_c, *list, "", -1, 0); + tem = comname + hook_name_size; + hookc = lookup_cmd (&tem, *list, "", -1, 0); if (hookc && strcmp (comname + hook_name_size, hookc->name) != 0) hookc = 0; if (!hookc) @@ -1531,11 +1527,11 @@ define_command (char *comname, int from_tty) } static void -document_command (char *comname, int from_tty) +document_command (const char *comname, int from_tty) { struct cmd_list_element *c, **list; const char *tem; - char *comfull; + const char *comfull; char tmpbuf[128]; comfull = comname; diff --git a/gdb/command.h b/gdb/command.h index 63c7658..c3348bc 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -256,7 +256,7 @@ extern int lookup_cmd_composition (const char *text, struct cmd_list_element **cmd); extern struct cmd_list_element *add_com (const char *, enum command_class, - cmd_cfunc_ftype *fun, + cmd_const_cfunc_ftype *fun, const char *); extern struct cmd_list_element *add_com_alias (const char *, const char *, @@ -49,8 +49,6 @@ void (*deprecated_file_changed_hook) (const char *); /* Prototypes for local functions */ -static void set_section_command (char *, int); - static void exec_files_info (struct target_ops *); static void init_exec_ops (void); @@ -957,10 +955,10 @@ exec_files_info (struct target_ops *t) } static void -set_section_command (char *args, int from_tty) +set_section_command (const char *args, int from_tty) { struct target_section *p; - char *secname; + const char *secname; unsigned seclen; unsigned long secaddr; char secprint[100]; diff --git a/gdb/frame.h b/gdb/frame.h index c751002..7c24c3a 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -790,7 +790,7 @@ extern void info_args_command (char *, int); extern void info_locals_command (char *, int); -extern void return_command (char *, int); +extern void return_command (const char *, int); /* Set FRAME's unwinder temporarily, so that we can call a sniffer. If sniffing fails, the caller should be sure to call diff --git a/gdb/gcore.c b/gdb/gcore.c index 69e5eb9..0d5dcca 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -141,7 +141,7 @@ write_gcore_file (bfd *obfd) Generate a core file from the inferior process. */ static void -gcore_command (char *args, int from_tty) +gcore_command (const char *args, int from_tty) { gdb::unique_xmalloc_ptr<char> corefilename; diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 5c514f6..bc3c45f 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -161,7 +161,7 @@ const struct extension_language_ops guile_extension_ops = /* Implementation of the gdb "guile-repl" command. */ static void -guile_repl_command (char *arg, int from_tty) +guile_repl_command (const char *arg, int from_tty) { scoped_restore restore_async = make_scoped_restore (¤t_ui->async, 0); @@ -189,7 +189,7 @@ guile_repl_command (char *arg, int from_tty) TODO: Add the result to Guile's history? */ static void -guile_command (char *arg, int from_tty) +guile_command (const char *arg, int from_tty) { scoped_restore restore_async = make_scoped_restore (¤t_ui->async, 0); @@ -390,7 +390,7 @@ gdbscm_target_config (void) commands. */ static void -guile_repl_command (char *arg, int from_tty) +guile_repl_command (const char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) @@ -399,7 +399,7 @@ guile_repl_command (char *arg, int from_tty) } static void -guile_command (char *arg, int from_tty) +guile_command (const char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 71e4768..33244ee 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -66,29 +66,11 @@ static void info_registers_command (char *, int); static void until_next_command (int); -static void until_command (char *, int); - -static void path_command (char *, int); - static void info_float_command (char *, int); -static void disconnect_command (char *, int); - static void info_program_command (char *, int); -static void finish_command (char *, int); - -static void signal_command (char *, int); - -static void jump_command (char *, int); - -static void step_1 (int, int, char *); - -static void next_command (char *, int); - -static void step_command (char *, int); - -static void run_command (char *, int); +static void step_1 (int, int, const char *); #define ERROR_NO_INFERIOR \ if (!target_has_execution) error (_("The program is not being run.")); @@ -204,7 +186,7 @@ get_inferior_args (void) NEWARGS is not transferred. */ void -set_inferior_args (char *newargs) +set_inferior_args (const char *newargs) { xfree (current_inferior ()->args); current_inferior ()->args = newargs ? xstrdup (newargs) : NULL; @@ -585,7 +567,7 @@ enum run_how requested by RUN_HOW. */ static void -run_command_1 (char *args, int from_tty, enum run_how run_how) +run_command_1 (const char *args, int from_tty, enum run_how run_how) { const char *exec_file; struct cleanup *old_chain; @@ -708,7 +690,7 @@ run_command_1 (char *args, int from_tty, enum run_how run_how) } static void -run_command (char *args, int from_tty) +run_command (const char *args, int from_tty) { run_command_1 (args, from_tty, RUN_NORMAL); } @@ -717,7 +699,7 @@ run_command (char *args, int from_tty) program. */ static void -start_command (char *args, int from_tty) +start_command (const char *args, int from_tty) { /* Some languages such as Ada need to search inside the program minimal symbols for the location where to put the temporary @@ -733,7 +715,7 @@ start_command (char *args, int from_tty) instruction. */ static void -starti_command (char *args, int from_tty) +starti_command (const char *args, int from_tty) { run_command_1 (args, from_tty, RUN_STOP_AT_FIRST_INSN); } @@ -843,7 +825,7 @@ continue_1 (int all_threads) /* continue [-a] [proceed-count] [&] */ static void -continue_command (char *args, int from_tty) +continue_command (const char *args, int from_tty) { int async_exec; int all_threads = 0; @@ -949,7 +931,7 @@ set_step_frame (void) /* Step until outside of current statement. */ static void -step_command (char *count_string, int from_tty) +step_command (const char *count_string, int from_tty) { step_1 (0, 0, count_string); } @@ -957,7 +939,7 @@ step_command (char *count_string, int from_tty) /* Likewise, but skip over subroutine calls as if single instructions. */ static void -next_command (char *count_string, int from_tty) +next_command (const char *count_string, int from_tty) { step_1 (1, 0, count_string); } @@ -965,13 +947,13 @@ next_command (char *count_string, int from_tty) /* Likewise, but step only one instruction. */ static void -stepi_command (char *count_string, int from_tty) +stepi_command (const char *count_string, int from_tty) { step_1 (0, 1, count_string); } static void -nexti_command (char *count_string, int from_tty) +nexti_command (const char *count_string, int from_tty) { step_1 (1, 1, count_string); } @@ -1054,7 +1036,7 @@ step_command_fsm_prepare (struct step_command_fsm *sm, static int prepare_one_step (struct step_command_fsm *sm); static void -step_1 (int skip_subroutines, int single_inst, char *count_string) +step_1 (int skip_subroutines, int single_inst, const char *count_string) { int count; int async_exec; @@ -1242,7 +1224,7 @@ prepare_one_step (struct step_command_fsm *sm) /* Continue program at specified address. */ static void -jump_command (char *arg, int from_tty) +jump_command (const char *arg, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); CORE_ADDR addr; @@ -1323,7 +1305,7 @@ jump_command (char *arg, int from_tty) /* Continue program giving it specified signal. */ static void -signal_command (char *signum_exp, int from_tty) +signal_command (const char *signum_exp, int from_tty) { enum gdb_signal oursig; int async_exec; @@ -1420,7 +1402,7 @@ signal_command (char *signum_exp, int from_tty) /* Queue a signal to be delivered to the current thread. */ static void -queue_signal_command (char *signum_exp, int from_tty) +queue_signal_command (const char *signum_exp, int from_tty) { enum gdb_signal oursig; struct thread_info *tp; @@ -1601,7 +1583,7 @@ until_next_command (int from_tty) } static void -until_command (char *arg, int from_tty) +until_command (const char *arg, int from_tty) { int async_exec; @@ -1623,7 +1605,7 @@ until_command (char *arg, int from_tty) } static void -advance_command (char *arg, int from_tty) +advance_command (const char *arg, int from_tty) { int async_exec; @@ -2003,7 +1985,7 @@ skip_finish_frames (struct frame_info *frame) frame will return to, then continue. */ static void -finish_command (char *arg, int from_tty) +finish_command (const char *arg, int from_tty) { struct frame_info *frame; int async_exec; @@ -2291,7 +2273,7 @@ path_info (const char *args, int from_tty) /* Add zero or more directories to the front of the execution path. */ static void -path_command (char *dirname, int from_tty) +path_command (const char *dirname, int from_tty) { char *exec_path; const char *env; @@ -2815,7 +2797,7 @@ attach_command_continuation_free_args (void *args) and allows us to start debugging it. */ void -attach_command (char *args, int from_tty) +attach_command (const char *args, int from_tty) { int async_exec; struct target_ops *attach_target; @@ -3035,7 +3017,7 @@ detach_command (const char *args, int from_tty) stopped processes on some native platforms (e.g. GNU/Linux). */ static void -disconnect_command (char *args, int from_tty) +disconnect_command (const char *args, int from_tty) { dont_repeat (); /* Not for the faint of heart. */ query_if_trace_running (from_tty); @@ -3079,7 +3061,7 @@ interrupt_target_1 (int all_threads) if the `-a' switch is used. */ static void -interrupt_command (char *args, int from_tty) +interrupt_command (const char *args, int from_tty) { if (target_can_async_p ()) { diff --git a/gdb/inferior.c b/gdb/inferior.c index ba8efe2..0c60d30 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -726,7 +726,7 @@ info_inferiors_command (char *args, int from_tty) /* remove-inferior ID */ static void -remove_inferior_command (char *args, int from_tty) +remove_inferior_command (const char *args, int from_tty) { if (args == NULL || *args == '\0') error (_("Requires an argument (inferior id(s) to remove)")); @@ -790,7 +790,7 @@ add_inferior_with_spaces (void) /* add-inferior [-copies N] [-exec FILENAME] */ static void -add_inferior_command (char *args, int from_tty) +add_inferior_command (const char *args, int from_tty) { int i, copies = 1; gdb::unique_xmalloc_ptr<char> exec; @@ -852,7 +852,7 @@ add_inferior_command (char *args, int from_tty) /* clone-inferior [-copies N] [ID] */ static void -clone_inferior_command (char *args, int from_tty) +clone_inferior_command (const char *args, int from_tty) { int i, copies = 1; struct inferior *orginf = NULL; diff --git a/gdb/inferior.h b/gdb/inferior.h index 39a8877..f70c0ac 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -152,11 +152,11 @@ extern void setup_inferior (int from_tty); extern void post_create_inferior (struct target_ops *, int); -extern void attach_command (char *, int); +extern void attach_command (const char *, int); extern char *get_inferior_args (void); -extern void set_inferior_args (char *); +extern void set_inferior_args (const char *); extern void set_inferior_args_vector (int, char **); diff --git a/gdb/infrun.c b/gdb/infrun.c index d425664..b041ff1 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -72,8 +72,6 @@ static void info_signals_command (char *, int); -static void handle_command (char *, int); - static void sig_print_info (enum gdb_signal); static void sig_print_header (void); @@ -8468,7 +8466,7 @@ sig_print_info (enum gdb_signal oursig) /* Specify how various signals in the inferior should be handled. */ static void -handle_command (char *args, int from_tty) +handle_command (const char *args, int from_tty) { int digits, wordlen; int sigfirst, signum, siglast; @@ -208,7 +208,7 @@ jit_reader_load (const char *file_name) /* Provides the jit-reader-load command. */ static void -jit_reader_load_command (char *args, int from_tty) +jit_reader_load_command (const char *args, int from_tty) { if (args == NULL) error (_("No reader name provided.")); @@ -229,7 +229,7 @@ jit_reader_load_command (char *args, int from_tty) /* Provides the jit-reader-unload command. */ static void -jit_reader_unload_command (char *args, int from_tty) +jit_reader_unload_command (const char *args, int from_tty) { if (!loaded_jit_reader) error (_("No JIT reader loaded.")); diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 554cfae..c60d90c 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -668,7 +668,7 @@ inf_has_multiple_threads (void) } static void -checkpoint_command (char *args, int from_tty) +checkpoint_command (const char *args, int from_tty) { struct objfile *fork_objf; struct gdbarch *gdbarch; @@ -761,7 +761,7 @@ linux_fork_context (struct fork_info *newfp, int from_tty) /* Switch inferior process (checkpoint) context, by checkpoint id. */ static void -restart_command (char *args, int from_tty) +restart_command (const char *args, int from_tty) { struct fork_info *fp; diff --git a/gdb/memattr.c b/gdb/memattr.c index 6ef8e39..0498664 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -251,10 +251,9 @@ user_mem_clear (void) static void -mem_command (char *args, int from_tty) +mem_command (const char *args, int from_tty) { CORE_ADDR lo, hi; - char *tok; if (!args) error_no_arg (_("No mem")); @@ -273,41 +272,41 @@ mem_command (char *args, int from_tty) require_user_regions (from_tty); - tok = strtok (args, " \t"); - if (!tok) + std::string tok = extract_arg (&args); + if (tok == "") error (_("no lo address")); - lo = parse_and_eval_address (tok); + lo = parse_and_eval_address (tok.c_str ()); - tok = strtok (NULL, " \t"); - if (!tok) + tok = extract_arg (&args); + if (tok == "") error (_("no hi address")); - hi = parse_and_eval_address (tok); + hi = parse_and_eval_address (tok.c_str ()); mem_attrib attrib; - while ((tok = strtok (NULL, " \t")) != NULL) + while ((tok = extract_arg (&args)) != "") { - if (strcmp (tok, "rw") == 0) + if (tok == "rw") attrib.mode = MEM_RW; - else if (strcmp (tok, "ro") == 0) + else if (tok == "ro") attrib.mode = MEM_RO; - else if (strcmp (tok, "wo") == 0) + else if (tok == "wo") attrib.mode = MEM_WO; - else if (strcmp (tok, "8") == 0) + else if (tok == "8") attrib.width = MEM_WIDTH_8; - else if (strcmp (tok, "16") == 0) + else if (tok == "16") { if ((lo % 2 != 0) || (hi % 2 != 0)) error (_("region bounds not 16 bit aligned")); attrib.width = MEM_WIDTH_16; } - else if (strcmp (tok, "32") == 0) + else if (tok == "32") { if ((lo % 4 != 0) || (hi % 4 != 0)) error (_("region bounds not 32 bit aligned")); attrib.width = MEM_WIDTH_32; } - else if (strcmp (tok, "64") == 0) + else if (tok == "64") { if ((lo % 8 != 0) || (hi % 8 != 0)) error (_("region bounds not 64 bit aligned")); @@ -315,26 +314,26 @@ mem_command (char *args, int from_tty) } #if 0 - else if (strcmp (tok, "hwbreak") == 0) + else if (tok == "hwbreak") attrib.hwbreak = 1; - else if (strcmp (tok, "swbreak") == 0) + else if (tok == "swbreak") attrib.hwbreak = 0; #endif - else if (strcmp (tok, "cache") == 0) + else if (tok == "cache") attrib.cache = 1; - else if (strcmp (tok, "nocache") == 0) + else if (tok == "nocache") attrib.cache = 0; #if 0 - else if (strcmp (tok, "verify") == 0) + else if (tok == "verify") attrib.verify = 1; - else if (strcmp (tok, "noverify") == 0) + else if (tok == "noverify") attrib.verify = 0; #endif else - error (_("unknown attribute: %s"), tok); + error (_("unknown attribute: %s"), tok.c_str ()); } create_user_mem_region (lo, hi, attrib); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 0423832..43abf13 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -1184,7 +1184,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names) } static void -print_object_command (char *args, int from_tty) +print_object_command (const char *args, int from_tty) { struct value *object, *function, *description; CORE_ADDR string_addr, object_addr; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 51e3d38..48ff903 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1214,14 +1214,14 @@ print_command_1 (const char *exp, int voidprint) } static void -print_command (char *exp, int from_tty) +print_command (const char *exp, int from_tty) { print_command_1 (exp, 1); } /* Same as print, except it doesn't print void results. */ static void -call_command (char *exp, int from_tty) +call_command (const char *exp, int from_tty) { print_command_1 (exp, 0); } @@ -1229,7 +1229,7 @@ call_command (char *exp, int from_tty) /* Implementation of the "output" command. */ static void -output_command (char *exp, int from_tty) +output_command (const char *exp, int from_tty) { output_command_const (exp, from_tty); } @@ -1295,14 +1295,6 @@ set_command (const char *exp, int from_tty) evaluate_expression (expr.get ()); } -/* Temporary non-const version of set_command. */ - -static void -non_const_set_command (char *exp, int from_tty) -{ - set_command (exp, from_tty); -} - static void info_symbol_command (char *arg, int from_tty) { @@ -1619,7 +1611,7 @@ info_address_command (char *exp, int from_tty) static void -x_command (char *exp, int from_tty) +x_command (const char *exp, int from_tty) { struct format_data fmt; struct value *val; @@ -1702,7 +1694,7 @@ x_command (char *exp, int from_tty) Specify the expression. */ static void -display_command (char *arg, int from_tty) +display_command (const char *arg, int from_tty) { struct format_data fmt; struct display *newobj; @@ -2608,7 +2600,7 @@ ui_printf (const char *arg, struct ui_file *stream) /* Implement the "printf" command. */ static void -printf_command (char *arg, int from_tty) +printf_command (const char *arg, int from_tty) { ui_printf (arg, gdb_stdout); gdb_flush (gdb_stdout); @@ -2617,7 +2609,7 @@ printf_command (char *arg, int from_tty) /* Implement the "eval" command. */ static void -eval_command (char *arg, int from_tty) +eval_command (const char *arg, int from_tty) { string_file stb; @@ -2722,7 +2714,7 @@ With a subcommand, this command modifies parts of the gdb environment.\n\ You can see these environment settings with the \"show\" command."), &setlist, "set ", 1, &cmdlist); if (dbx_commands) - add_com ("assign", class_vars, non_const_set_command, _("\ + add_com ("assign", class_vars, set_command, _("\ Evaluate expression EXP and assign result to variable VAR, using assignment\n\ syntax appropriate for the current language (VAR = EXP or VAR := EXP for\n\ example). VAR may be a debugger \"convenience\" variable (names starting\n\ diff --git a/gdb/procfs.c b/gdb/procfs.c index fb3fa58..333a825 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -5224,7 +5224,7 @@ proc_trace_syscalls_1 (procinfo *pi, int syscallnum, int entry_or_exit, } static void -proc_trace_syscalls (char *args, int from_tty, int entry_or_exit, int mode) +proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode) { procinfo *pi; @@ -5244,25 +5244,25 @@ proc_trace_syscalls (char *args, int from_tty, int entry_or_exit, int mode) } static void -proc_trace_sysentry_cmd (char *args, int from_tty) +proc_trace_sysentry_cmd (const char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_SET); } static void -proc_trace_sysexit_cmd (char *args, int from_tty) +proc_trace_sysexit_cmd (const char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_SET); } static void -proc_untrace_sysentry_cmd (char *args, int from_tty) +proc_untrace_sysentry_cmd (const char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_RESET); } static void -proc_untrace_sysexit_cmd (char *args, int from_tty) +proc_untrace_sysexit_cmd (const char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_RESET); } diff --git a/gdb/python/python.c b/gdb/python/python.c index 5bb642a..88a31b0 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -289,7 +289,7 @@ eval_python_command (const char *command) /* Implementation of the gdb "python-interactive" command. */ static void -python_interactive_command (char *arg, int from_tty) +python_interactive_command (const char *arg, int from_tty) { struct ui *ui = current_ui; int err; @@ -404,7 +404,7 @@ gdbpy_eval_from_control_command (const struct extension_language_defn *extlang, /* Implementation of the gdb "python" command. */ static void -python_command (char *arg, int from_tty) +python_command (const char *arg, int from_tty) { gdbpy_enter enter_py (get_current_arch (), current_language); @@ -1397,7 +1397,7 @@ gdbpy_free_type_printers (const struct extension_language_defn *extlang, command. */ static void -python_interactive_command (char *arg, int from_tty) +python_interactive_command (const char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) @@ -1411,7 +1411,7 @@ python_interactive_command (char *arg, int from_tty) } static void -python_command (char *arg, int from_tty) +python_command (const char *arg, int from_tty) { python_interactive_command (arg, from_tty); } diff --git a/gdb/regcache.c b/gdb/regcache.c index 571aba1..9c68bdd 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1313,7 +1313,7 @@ regcache::debug_print_register (const char *func, int regno) } static void -reg_flush_command (char *command, int from_tty) +reg_flush_command (const char *command, int from_tty) { /* Force-flush the register cache. */ registers_changed (); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index d6efa75..a684d32 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -1179,7 +1179,7 @@ gdbsim_mourn_inferior (struct target_ops *target) simulator must do any command interpretation work. */ void -simulator_command (char *args, int from_tty) +simulator_command (const char *args, int from_tty) { struct sim_inferior_data *sim_data; diff --git a/gdb/remote.c b/gdb/remote.c index 57dbd1e..62b87c4 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10918,7 +10918,7 @@ static void init_remote_threadtests (void); #define SAMPLE_THREAD 0x05060708 /* Truncated 64 bit threadid. */ static void -threadset_test_cmd (char *cmd, int tty) +threadset_test_cmd (const char *cmd, int tty) { int sample_thread = SAMPLE_THREAD; @@ -10928,7 +10928,7 @@ threadset_test_cmd (char *cmd, int tty) static void -threadalive_test (char *cmd, int tty) +threadalive_test (const char *cmd, int tty) { int sample_thread = SAMPLE_THREAD; int pid = ptid_get_pid (inferior_ptid); @@ -10953,7 +10953,7 @@ output_threadid (char *title, threadref *ref) } static void -threadlist_test_cmd (char *cmd, int tty) +threadlist_test_cmd (const char *cmd, int tty) { int startflag = 1; threadref nextthread; @@ -10998,7 +10998,7 @@ get_and_display_threadinfo (threadref *ref) } static void -threadinfo_test_cmd (char *cmd, int tty) +threadinfo_test_cmd (const char *cmd, int tty) { int athread = SAMPLE_THREAD; threadref thread; @@ -11018,7 +11018,7 @@ thread_display_step (threadref *ref, void *context) } static void -threadlist_update_test_cmd (char *cmd, int tty) +threadlist_update_test_cmd (const char *cmd, int tty) { printf_filtered ("Remote Threadlist update test\n"); remote_threadlist_iterator (thread_display_step, 0, CRAZY_MAX_THREADS); diff --git a/gdb/reverse.c b/gdb/reverse.c index 2b303f7..28410a8 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -36,7 +36,7 @@ Used to implement reverse-next etc. commands. */ static void -exec_reverse_once (const char *cmd, char *args, int from_tty) +exec_reverse_once (const char *cmd, const char *args, int from_tty) { enum exec_direction_kind dir = execution_direction; @@ -54,37 +54,37 @@ exec_reverse_once (const char *cmd, char *args, int from_tty) } static void -reverse_step (char *args, int from_tty) +reverse_step (const char *args, int from_tty) { exec_reverse_once ("step", args, from_tty); } static void -reverse_stepi (char *args, int from_tty) +reverse_stepi (const char *args, int from_tty) { exec_reverse_once ("stepi", args, from_tty); } static void -reverse_next (char *args, int from_tty) +reverse_next (const char *args, int from_tty) { exec_reverse_once ("next", args, from_tty); } static void -reverse_nexti (char *args, int from_tty) +reverse_nexti (const char *args, int from_tty) { exec_reverse_once ("nexti", args, from_tty); } static void -reverse_continue (char *args, int from_tty) +reverse_continue (const char *args, int from_tty) { exec_reverse_once ("continue", args, from_tty); } static void -reverse_finish (char *args, int from_tty) +reverse_finish (const char *args, int from_tty) { exec_reverse_once ("finish", args, from_tty); } @@ -117,7 +117,7 @@ static int bookmark_count; Up to us to free it as required. */ static void -save_bookmark_command (char *args, int from_tty) +save_bookmark_command (const char *args, int from_tty) { /* Get target's idea of a bookmark. */ gdb_byte *bookmark_id = target_get_bookmark (args, from_tty); @@ -230,11 +230,11 @@ delete_bookmark_command (const char *args, int from_tty) /* Implement "goto-bookmark" command. */ static void -goto_bookmark_command (char *args, int from_tty) +goto_bookmark_command (const char *args, int from_tty) { struct bookmark *b; unsigned long num; - char *p = args; + const char *p = args; if (args == NULL || args[0] == '\0') error (_("Command requires an argument.")); diff --git a/gdb/solib.c b/gdb/solib.c index f9f7217..c70b9d8 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1246,7 +1246,7 @@ in_solib_dynsym_resolve_code (CORE_ADDR pc) /* Implements the "sharedlibrary" command. */ static void -sharedlibrary_command (char *args, int from_tty) +sharedlibrary_command (const char *args, int from_tty) { dont_repeat (); solib_add (args, from_tty, 1); @@ -1258,7 +1258,7 @@ sharedlibrary_command (char *args, int from_tty) are not discarded. Also called from remote.c. */ void -no_shared_libraries (char *ignored, int from_tty) +no_shared_libraries (const char *ignored, int from_tty) { /* The order of the two routines below is important: clear_solib notifies the solib_unloaded observers, and some of these observers might need diff --git a/gdb/solib.h b/gdb/solib.h index e91fb75..35f956b 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -71,7 +71,7 @@ extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* Discard symbols that were auto-loaded from shared libraries. */ -extern void no_shared_libraries (char *ignored, int from_tty); +extern void no_shared_libraries (const char *ignored, int from_tty); /* Set the solib operations for GDBARCH to NEW_OPS. */ diff --git a/gdb/source.c b/gdb/source.c index 4ae2ba2..e67209e 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -52,10 +52,6 @@ static int get_filename_and_charpos (struct symtab *, char **); -static void reverse_search_command (char *, int); - -static void forward_search_command (char *, int); - static void info_line_command (char *, int); static void info_source_command (char *, int); @@ -1591,7 +1587,7 @@ info_line_command (char *arg, int from_tty) /* Commands to search the source file for a regexp. */ static void -forward_search_command (char *regex, int from_tty) +forward_search_command (const char *regex, int from_tty) { int c; int desc; @@ -1676,7 +1672,7 @@ forward_search_command (char *regex, int from_tty) } static void -reverse_search_command (char *regex, int from_tty) +reverse_search_command (const char *regex, int from_tty) { int c; int desc; diff --git a/gdb/stack.c b/gdb/stack.c index 6256bbe..592f026 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1844,11 +1844,10 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters, } static void -backtrace_command (char *arg_in, int from_tty) +backtrace_command (const char *arg, int from_tty) { int fulltrace_arg = -1, arglen = 0, argc = 0, no_filters = -1; int user_arg = 0; - const char *arg = arg_in; std::string reconstructed_arg; if (arg) @@ -1904,6 +1903,14 @@ backtrace_command (char *arg_in, int from_tty) no_filters >= 0 /* no frame-filters */, from_tty); } +/* Temporary non-const overload. */ + +static void +backtrace_command (char *arg, int from_tty) +{ + backtrace_command ((const char *) arg, from_tty); +} + /* Iterate over the local variables of a block B, calling CB with CB_DATA. */ @@ -2281,7 +2288,7 @@ select_frame_command (const char *level_exp, int from_tty) the selected frame. */ static void -frame_command (char *level_exp, int from_tty) +frame_command (const char *level_exp, int from_tty) { struct frame_info *prev_frame = get_selected_frame_if_set (); @@ -2311,13 +2318,13 @@ up_silently_base (const char *count_exp) } static void -up_silently_command (char *count_exp, int from_tty) +up_silently_command (const char *count_exp, int from_tty) { up_silently_base (count_exp); } static void -up_command (char *count_exp, int from_tty) +up_command (const char *count_exp, int from_tty) { up_silently_base (count_exp); observer_notify_user_selected_context_changed (USER_SELECTED_FRAME); @@ -2350,20 +2357,20 @@ down_silently_base (const char *count_exp) } static void -down_silently_command (char *count_exp, int from_tty) +down_silently_command (const char *count_exp, int from_tty) { down_silently_base (count_exp); } static void -down_command (char *count_exp, int from_tty) +down_command (const char *count_exp, int from_tty) { down_silently_base (count_exp); observer_notify_user_selected_context_changed (USER_SELECTED_FRAME); } void -return_command (char *retval_exp, int from_tty) +return_command (const char *retval_exp, int from_tty) { /* Initialize it just to avoid a GCC false warning. */ enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION; @@ -2498,7 +2505,7 @@ struct function_bounds }; static void -func_command (char *arg, int from_tty) +func_command (const char *arg, int from_tty) { struct frame_info *frame; int found = 0; diff --git a/gdb/symtab.c b/gdb/symtab.c index db70590..d02b707 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -69,7 +69,7 @@ /* Forward declarations for local functions. */ -static void rbreak_command (char *, int); +static void rbreak_command (const char *, int); static int find_line_common (struct linetable *, int, int *, int); @@ -4436,7 +4436,7 @@ print_msymbol_info (struct bound_minimal_symbol msymbol) matches. */ static void -symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty) +symtab_symbol_info (const char *regexp, enum search_domain kind, int from_tty) { static const char * const classnames[] = {"variable", "function", "type"}; @@ -4480,6 +4480,14 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty) } static void +info_variables_command (const char *regexp, int from_tty) +{ + symtab_symbol_info (regexp, VARIABLES_DOMAIN, from_tty); +} + +/* Temporary non-const overload. */ + +static void info_variables_command (char *regexp, int from_tty) { symtab_symbol_info (regexp, VARIABLES_DOMAIN, from_tty); @@ -4507,7 +4515,7 @@ rbreak_command_wrapper (char *regexp, int from_tty) } static void -rbreak_command (char *regexp, int from_tty) +rbreak_command (const char *regexp, int from_tty) { std::string string; const char **files = NULL; @@ -4516,7 +4524,7 @@ rbreak_command (char *regexp, int from_tty) if (regexp) { - char *colon = strchr (regexp, ':'); + const char *colon = strchr (regexp, ':'); if (colon && *(colon + 1) != ':') { diff --git a/gdb/target.c b/gdb/target.c index bd81fcd..93bb6e9 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3798,8 +3798,7 @@ default_rcmd (struct target_ops *self, const char *command, } static void -do_monitor_command (char *cmd, - int from_tty) +do_monitor_command (const char *cmd, int from_tty) { target_rcmd (cmd, gdb_stdtarg); } @@ -3808,7 +3807,7 @@ do_monitor_command (char *cmd, ignored. */ void -flash_erase_command (char *cmd, int from_tty) +flash_erase_command (const char *cmd, int from_tty) { /* Used to communicate termination of flash operations to the target. */ bool found_flash_region = false; diff --git a/gdb/target.h b/gdb/target.h index e7577e1..1683af6 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1469,7 +1469,7 @@ extern int target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, std::vector<mem_region> target_memory_map (void); /* Erases all flash memory regions on the target. */ -void flash_erase_command (char *cmd, int from_tty); +void flash_erase_command (const char *cmd, int from_tty); /* Erase the specified flash region. */ void target_flash_erase (ULONGEST address, LONGEST length); @@ -1677,7 +1677,7 @@ input_interactive_p (struct ui *ui) } static void -dont_repeat_command (char *ignored, int from_tty) +dont_repeat_command (const char *ignored, int from_tty) { /* Can't call dont_repeat here because we're not necessarily reading from stdin. */ @@ -230,7 +230,7 @@ extern void init_history (void); extern void command_loop (void); extern int quit_confirm (void); extern void quit_force (int *, int); -extern void quit_command (char *, int); +extern void quit_command (const char *, int); extern void quit_cover (void); extern void execute_command (char *, int); diff --git a/gdb/tracefile.c b/gdb/tracefile.c index 93d8816..6fa083b 100644 --- a/gdb/tracefile.c +++ b/gdb/tracefile.c @@ -306,7 +306,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, } static void -tsave_command (char *args, int from_tty) +tsave_command (const char *args, int from_tty) { int target_does_save = 0; char **argv; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 78f4c86..3cae620 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -354,11 +354,11 @@ validate_trace_state_variable_name (const char *name) evaluate into an initial value. */ static void -trace_variable_command (char *args, int from_tty) +trace_variable_command (const char *args, int from_tty) { LONGEST initval = 0; struct trace_state_variable *tsv; - char *name_start, *p; + const char *name_start, *p; if (!args || !*args) error_no_arg (_("Syntax is $NAME [ = EXPR ]")); @@ -526,25 +526,25 @@ save_trace_state_variables (struct ui_file *fp) which is always an error. */ static void -end_actions_pseudocommand (char *args, int from_tty) +end_actions_pseudocommand (const char *args, int from_tty) { error (_("This command cannot be used at the top level.")); } static void -while_stepping_pseudocommand (char *args, int from_tty) +while_stepping_pseudocommand (const char *args, int from_tty) { error (_("This command can only be used in a tracepoint actions list.")); } static void -collect_pseudocommand (char *args, int from_tty) +collect_pseudocommand (const char *args, int from_tty) { error (_("This command can only be used in a tracepoint actions list.")); } static void -teval_pseudocommand (char *args, int from_tty) +teval_pseudocommand (const char *args, int from_tty) { error (_("This command can only be used in a tracepoint actions list.")); } @@ -593,7 +593,7 @@ decode_agent_options (const char *exp, int *trace_string) /* Enter a list of actions for a tracepoint. */ static void -actions_command (char *args, int from_tty) +actions_command (const char *args, int from_tty) { struct tracepoint *t; @@ -1587,7 +1587,7 @@ trace_reset_local_state (void) } void -start_tracing (char *notes) +start_tracing (const char *notes) { VEC(breakpoint_p) *tp_vec = NULL; int ix; @@ -1718,7 +1718,7 @@ start_tracing (char *notes) anybody else messing with the target. */ static void -tstart_command (char *args, int from_tty) +tstart_command (const char *args, int from_tty) { dont_repeat (); /* Like "run", dangerous to repeat accidentally. */ @@ -1738,7 +1738,7 @@ tstart_command (char *args, int from_tty) of the trace run's status. */ static void -tstop_command (char *args, int from_tty) +tstop_command (const char *args, int from_tty) { if (!current_trace_status ()->running) error (_("Trace is not running.")); @@ -1747,7 +1747,7 @@ tstop_command (char *args, int from_tty) } void -stop_tracing (char *note) +stop_tracing (const char *note) { int ret; VEC(breakpoint_p) *tp_vec = NULL; @@ -1795,7 +1795,7 @@ stop_tracing (char *note) /* tstatus command */ static void -tstatus_command (char *args, int from_tty) +tstatus_command (const char *args, int from_tty) { struct trace_status *ts = current_trace_status (); int status, ix; @@ -2865,7 +2865,7 @@ all_tracepoint_actions_and_cleanup (struct breakpoint *t) /* The tdump command. */ static void -tdump_command (char *args, int from_tty) +tdump_command (const char *args, int from_tty) { int stepping_frame = 0; struct bp_location *loc; diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 8364d38..18fdcf3 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -369,8 +369,8 @@ extern void trace_reset_local_state (void); extern void check_trace_running (struct trace_status *); -extern void start_tracing (char *notes); -extern void stop_tracing (char *notes); +extern void start_tracing (const char *notes); +extern void stop_tracing (const char *notes); extern void trace_status_mi (int on_stop); diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index fe68331..8b94ddf 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -62,7 +62,7 @@ static void show_source_disasm_command (void); static void show_data (enum tui_layout_type); static enum tui_layout_type next_layout (void); static enum tui_layout_type prev_layout (void); -static void tui_layout_command (char *, int); +static void tui_layout_command (const char *, int); static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *); @@ -492,12 +492,11 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) static void -tui_layout_command (char *arg, int from_tty) +tui_layout_command (const char *arg, int from_tty) { /* Switch to the selected layout. */ if (tui_set_layout_by_name (arg) != TUI_SUCCESS) warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE); - } /* Answer the previous layout to cycle to. */ diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index ce7c5ee..4a69b97 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -53,7 +53,7 @@ static int tui_set_locator_info (struct gdbarch *gdbarch, const char *procname, int lineno, CORE_ADDR addr); -static void tui_update_command (char *, int); +static void tui_update_command (const char *, int); /* Create the status line to display as much information as we can on @@ -497,7 +497,7 @@ _initialize_tui_stack (void) /* Command to update the display with the current execution point. */ static void -tui_update_command (char *arg, int from_tty) +tui_update_command (const char *arg, int from_tty) { char cmd[sizeof("frame 0")]; diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 26b6b5e..9482646 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -61,16 +61,16 @@ static void make_invisible_and_set_new_height (struct tui_win_info *, static enum tui_status tui_adjust_win_heights (struct tui_win_info *, int); static int new_height_ok (struct tui_win_info *, int); -static void tui_set_tab_width_command (char *, int); -static void tui_refresh_all_command (char *, int); -static void tui_set_win_height_command (char *, int); +static void tui_set_tab_width_command (const char *, int); +static void tui_refresh_all_command (const char *, int); +static void tui_set_win_height_command (const char *, int); static void tui_all_windows_info (char *, int); -static void tui_set_focus_command (char *, int); -static void tui_scroll_forward_command (char *, int); -static void tui_scroll_backward_command (char *, int); -static void tui_scroll_left_command (char *, int); -static void tui_scroll_right_command (char *, int); -static void parse_scrolling_args (char *, +static void tui_set_focus_command (const char *, int); +static void tui_scroll_forward_command (const char *, int); +static void tui_scroll_backward_command (const char *, int); +static void tui_scroll_left_command (const char *, int); +static void tui_scroll_right_command (const char *, int); +static void parse_scrolling_args (const char *, struct tui_win_info **, int *); @@ -980,7 +980,7 @@ tui_initialize_win (void) static void -tui_scroll_forward_command (char *arg, int from_tty) +tui_scroll_forward_command (const char *arg, int from_tty) { int num_to_scroll = 1; struct tui_win_info *win_to_scroll; @@ -996,7 +996,7 @@ tui_scroll_forward_command (char *arg, int from_tty) static void -tui_scroll_backward_command (char *arg, int from_tty) +tui_scroll_backward_command (const char *arg, int from_tty) { int num_to_scroll = 1; struct tui_win_info *win_to_scroll; @@ -1012,7 +1012,7 @@ tui_scroll_backward_command (char *arg, int from_tty) static void -tui_scroll_left_command (char *arg, int from_tty) +tui_scroll_left_command (const char *arg, int from_tty) { int num_to_scroll; struct tui_win_info *win_to_scroll; @@ -1025,7 +1025,7 @@ tui_scroll_left_command (char *arg, int from_tty) static void -tui_scroll_right_command (char *arg, int from_tty) +tui_scroll_right_command (const char *arg, int from_tty) { int num_to_scroll; struct tui_win_info *win_to_scroll; @@ -1039,7 +1039,7 @@ tui_scroll_right_command (char *arg, int from_tty) /* Set focus to the window named by 'arg'. */ static void -tui_set_focus (char *arg, int from_tty) +tui_set_focus (const char *arg, int from_tty) { if (arg != (char *) NULL) { @@ -1078,7 +1078,7 @@ The window name specified must be valid and visible.\n")); } static void -tui_set_focus_command (char *arg, int from_tty) +tui_set_focus_command (const char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -1109,7 +1109,7 @@ tui_all_windows_info (char *arg, int from_tty) static void -tui_refresh_all_command (char *arg, int from_tty) +tui_refresh_all_command (const char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -1120,7 +1120,7 @@ tui_refresh_all_command (char *arg, int from_tty) /* Set the tab width of the specified window. */ static void -tui_set_tab_width_command (char *arg, int from_tty) +tui_set_tab_width_command (const char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -1159,7 +1159,7 @@ tui_set_tab_width_command (char *arg, int from_tty) /* Set the height of the specified window. */ static void -tui_set_win_height (char *arg, int from_tty) +tui_set_win_height (const char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -1240,7 +1240,7 @@ The window name specified must be valid and visible.\n")); /* Set the height of the specified window, with va_list. */ static void -tui_set_win_height_command (char *arg, int from_tty) +tui_set_win_height_command (const char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -1646,7 +1646,7 @@ new_height_ok (struct tui_win_info *primary_win_info, static void -parse_scrolling_args (char *arg, +parse_scrolling_args (const char *arg, struct tui_win_info **win_to_scroll, int *num_to_scroll) { diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 441cbb8..15810e4 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -37,12 +37,6 @@ #include "extension.h" #include "completer.h" -static void ptype_command (char *, int); - -static void whatis_command (char *, int); - -static void whatis_exp (char *, int); - const struct type_print_options type_print_raw_options = { 1, /* raw */ @@ -405,7 +399,7 @@ error_unknown_type (const char *sym_print_name) show is passed to type_print. */ static void -whatis_exp (char *exp, int show) +whatis_exp (const char *exp, int show) { struct value *val; struct cleanup *old_chain; @@ -524,7 +518,7 @@ whatis_exp (char *exp, int show) } static void -whatis_command (char *exp, int from_tty) +whatis_command (const char *exp, int from_tty) { /* Most of the time users do not want to see all the fields in a structure. If they do they can use the "ptype" command. @@ -535,7 +529,7 @@ whatis_command (char *exp, int from_tty) /* TYPENAME is either the name of a type, or an expression. */ static void -ptype_command (char *type_name, int from_tty) +ptype_command (const char *type_name, int from_tty) { whatis_exp (type_name, 1); } diff --git a/gdb/value.c b/gdb/value.c index ade5ebd..d8d40c2 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2090,7 +2090,7 @@ static struct internalvar *internalvars; /* If the variable does not already exist create it and give it the value given. If no value is given then the default is zero. */ static void -init_if_undefined_command (char* args, int from_tty) +init_if_undefined_command (const char* args, int from_tty) { struct internalvar* intvar; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 128edc2..b7ff5cc 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -859,7 +859,7 @@ windows_clear_solib (void) } static void -signal_event_command (char *args, int from_tty) +signal_event_command (const char *args, int from_tty) { uintptr_t event_id = 0; char *endargs = NULL; |