From 1d12d88f186fe1ae66deccf877b5509c506c4d39 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 13 Oct 2017 22:07:26 -0600 Subject: [PATCH] Constify add_info This patch constifies add_info and updates all the info commands. The bulk of this patch was written using a script; and then I did a manual pass to fix up the remaining compilation errors. I could not compile every changed file; in particular nto-procfs.c, gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the correctness by inspection. gdb/ChangeLog 2017-11-07 Tom Tromey * frame.h (info_locals_command, info_args_command): Constify. * auto-load.h (auto_load_info_scripts): Constify. * inferior.h (registers_info): Constify. * copying.c: Rebuild. * copying.awk: Constify generated commands. * auto-load.c (auto_load_info_scripts) (info_auto_load_gdb_scripts): Constify. * cli/cli-decode.c (struct cmd_list_element): Take a cmd_const_cfunc_ftype. * command.h (add_info): Take a cmd_const_cfunc_ftype. * tui/tui-win.c (tui_all_windows_info): Constify. * python/py-auto-load.c (info_auto_load_python_scripts): Constify. * cli/cli-cmds.c (show_command): Remove non-const overload. * tracepoint.c (info_tvariables_command, info_scope_command): Constify. (info_static_tracepoint_markers_command): Constify. * thread.c (info_threads_command): Constify. (print_thread_info_1): Constify. * target.c (info_target_command): Constify. * symtab.c (info_sources_command, info_functions_command) (info_types_command): Constify. (info_variables_command): Remove non-const overload. * symfile.c (info_ext_lang_command): Constify. * stack.c (info_frame_command, info_locals_command) (info_args_command): Constify. (backtrace_command): Remove non-const overload. * source.c (info_source_command, info_line_command): Constify. * solib.c (info_sharedlibrary_command): Constify. * skip.c (info_skip_command): Constify. * ser-go32.c (info_serial_command): Constify. * reverse.c (info_bookmarks_command): Constify. * printcmd.c (info_symbol_command, info_address_command) (info_display_command): Constify. * osdata.c (info_osdata_command): Constify. * objc-lang.c (info_selectors_command, info_classes_command): Constify. * nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify. * memattr.c (info_mem_command): Constify. * macrocmd.c (info_macro_command, info_macros_command): Constify. * linux-fork.c (info_checkpoints_command): Constify. * infrun.c (info_signals_command): Constify. * inflow.c (info_terminal_command): Constify. * inferior.c (info_inferiors_command): Constify. (print_inferior): Constify. * infcmd.c (info_program_command, info_all_registers_command) (info_registers_command, info_vector_command) (info_float_command): Constify. (registers_info): Constify. * gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd) (info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd): Constify. * f-valprint.c (info_common_command): Constify. * dcache.c (info_dcache_command): Constify. (dcache_info_1): Constify. * darwin-nat-info.c (info_mach_tasks_command) (info_mach_task_command, info_mach_ports_command) (info_mach_port_command, info_mach_threads_command) (info_mach_thread_command, info_mach_regions_command) (info_mach_regions_recurse_command, info_mach_region_command) (info_mach_exceptions_command): Constify. (get_task_from_args): Constify. * cp-support.c (info_vtbl_command): Constify. * breakpoint.c (info_watchpoints_command) (info_tracepoints_command): Constify. (info_breakpoints_command): Remove non-const overload. * avr-tdep.c (avr_io_reg_read_command): Constify. * auxv.c (info_auxv_command): Constify. * ada-tasks.c (info_tasks_command): Constify. (info_task): Constify. * ada-lang.c (info_exceptions_command): Constify. --- gdb/ChangeLog | 74 +++++++++++++++++++++++++++++++++++++++ gdb/ada-lang.c | 2 +- gdb/ada-tasks.c | 4 +-- gdb/auto-load.c | 4 +-- gdb/auto-load.h | 2 +- gdb/auxv.c | 2 +- gdb/avr-tdep.c | 2 +- gdb/breakpoint.c | 16 ++------- gdb/cli/cli-cmds.c | 8 ----- gdb/cli/cli-decode.c | 2 +- gdb/command.h | 2 +- gdb/copying.awk | 8 ++--- gdb/copying.c | 8 ++--- gdb/cp-support.c | 2 +- gdb/darwin-nat-info.c | 22 ++++++------ gdb/dcache.c | 6 ++-- gdb/f-valprint.c | 3 +- gdb/frame.h | 4 +-- gdb/gnu-nat.c | 10 +++--- gdb/infcmd.c | 20 ++++------- gdb/inferior.c | 4 +-- gdb/inferior.h | 2 +- gdb/inflow.c | 2 +- gdb/infrun.c | 4 +-- gdb/linux-fork.c | 2 +- gdb/macrocmd.c | 17 +++++---- gdb/memattr.c | 2 +- gdb/nto-procfs.c | 4 +-- gdb/objc-lang.c | 4 +-- gdb/osdata.c | 2 +- gdb/printcmd.c | 6 ++-- gdb/python/py-auto-load.c | 2 +- gdb/reverse.c | 2 +- gdb/ser-go32.c | 2 +- gdb/skip.c | 2 +- gdb/solib.c | 2 +- gdb/source.c | 8 ++--- gdb/stack.c | 14 ++------ gdb/symfile.c | 4 +-- gdb/symtab.c | 14 ++------ gdb/target.c | 4 +-- gdb/thread.c | 5 ++- gdb/tracepoint.c | 6 ++-- gdb/tui/tui-win.c | 4 +-- 44 files changed, 168 insertions(+), 151 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25ece7f95b1..94cee5f379a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,77 @@ +2017-11-07 Tom Tromey + + * frame.h (info_locals_command, info_args_command): Constify. + * auto-load.h (auto_load_info_scripts): Constify. + * inferior.h (registers_info): Constify. + * copying.c: Rebuild. + * copying.awk: Constify generated commands. + * auto-load.c (auto_load_info_scripts) + (info_auto_load_gdb_scripts): Constify. + * cli/cli-decode.c (struct cmd_list_element): Take a + cmd_const_cfunc_ftype. + * command.h (add_info): Take a cmd_const_cfunc_ftype. + * tui/tui-win.c (tui_all_windows_info): Constify. + * python/py-auto-load.c (info_auto_load_python_scripts): + Constify. + * cli/cli-cmds.c (show_command): Remove non-const overload. + * tracepoint.c (info_tvariables_command, info_scope_command): + Constify. + (info_static_tracepoint_markers_command): Constify. + * thread.c (info_threads_command): Constify. + (print_thread_info_1): Constify. + * target.c (info_target_command): Constify. + * symtab.c (info_sources_command, info_functions_command) + (info_types_command): Constify. + (info_variables_command): Remove non-const overload. + * symfile.c (info_ext_lang_command): Constify. + * stack.c (info_frame_command, info_locals_command) + (info_args_command): Constify. + (backtrace_command): Remove non-const overload. + * source.c (info_source_command, info_line_command): Constify. + * solib.c (info_sharedlibrary_command): Constify. + * skip.c (info_skip_command): Constify. + * ser-go32.c (info_serial_command): Constify. + * reverse.c (info_bookmarks_command): Constify. + * printcmd.c (info_symbol_command, info_address_command) + (info_display_command): Constify. + * osdata.c (info_osdata_command): Constify. + * objc-lang.c (info_selectors_command, info_classes_command): + Constify. + * nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify. + * memattr.c (info_mem_command): Constify. + * macrocmd.c (info_macro_command, info_macros_command): Constify. + * linux-fork.c (info_checkpoints_command): Constify. + * infrun.c (info_signals_command): Constify. + * inflow.c (info_terminal_command): Constify. + * inferior.c (info_inferiors_command): Constify. + (print_inferior): Constify. + * infcmd.c (info_program_command, info_all_registers_command) + (info_registers_command, info_vector_command) + (info_float_command): Constify. + (registers_info): Constify. + * gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd) + (info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd): + Constify. + * f-valprint.c (info_common_command): Constify. + * dcache.c (info_dcache_command): Constify. + (dcache_info_1): Constify. + * darwin-nat-info.c (info_mach_tasks_command) + (info_mach_task_command, info_mach_ports_command) + (info_mach_port_command, info_mach_threads_command) + (info_mach_thread_command, info_mach_regions_command) + (info_mach_regions_recurse_command, info_mach_region_command) + (info_mach_exceptions_command): Constify. + (get_task_from_args): Constify. + * cp-support.c (info_vtbl_command): Constify. + * breakpoint.c (info_watchpoints_command) + (info_tracepoints_command): Constify. + (info_breakpoints_command): Remove non-const overload. + * avr-tdep.c (avr_io_reg_read_command): Constify. + * auxv.c (info_auxv_command): Constify. + * ada-tasks.c (info_tasks_command): Constify. + (info_task): Constify. + * ada-lang.c (info_exceptions_command): Constify. + 2017-11-07 Tom Tromey * solib.h (no_shared_libraries): Constify. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 32b978c33cf..690ed651a6b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13359,7 +13359,7 @@ ada_exceptions_list (const char *regexp) /* Implement the "info exceptions" command. */ static void -info_exceptions_command (char *regexp, int from_tty) +info_exceptions_command (const char *regexp, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index e0070d5b9ab..1d5542d5d64 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1147,7 +1147,7 @@ print_ada_task_info (struct ui_out *uiout, for the given inferior (INF). */ static void -info_task (struct ui_out *uiout, char *taskno_str, struct inferior *inf) +info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf) { const int taskno = value_as_long (parse_and_eval (taskno_str)); struct ada_task_info *task_info; @@ -1237,7 +1237,7 @@ info_task (struct ui_out *uiout, char *taskno_str, struct inferior *inf) Does nothing if the program doesn't use Ada tasking. */ static void -info_tasks_command (char *arg, int from_tty) +info_tasks_command (const char *arg, int from_tty) { struct ui_out *uiout = current_uiout; diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 0ccef19491e..47533da7095 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1290,7 +1290,7 @@ print_scripts (const std::vector &scripts) PATTERN. FROM_TTY is the usual GDB boolean for user interactivity. */ void -auto_load_info_scripts (char *pattern, int from_tty, +auto_load_info_scripts (const char *pattern, int from_tty, const struct extension_language_defn *language) { struct ui_out *uiout = current_uiout; @@ -1373,7 +1373,7 @@ auto_load_info_scripts (char *pattern, int from_tty, /* Wrapper for "info auto-load gdb-scripts". */ static void -info_auto_load_gdb_scripts (char *pattern, int from_tty) +info_auto_load_gdb_scripts (const char *pattern, int from_tty) { auto_load_info_scripts (pattern, from_tty, &extension_language_gdb); } diff --git a/gdb/auto-load.h b/gdb/auto-load.h index f8b5b0d7a79..f02a9043b11 100644 --- a/gdb/auto-load.h +++ b/gdb/auto-load.h @@ -37,7 +37,7 @@ extern void auto_load_objfile_script (struct objfile *objfile, const struct extension_language_defn *); extern void load_auto_scripts_for_objfile (struct objfile *objfile); extern char auto_load_info_scripts_pattern_nl[]; -extern void auto_load_info_scripts (char *pattern, int from_tty, +extern void auto_load_info_scripts (const char *pattern, int from_tty, const struct extension_language_defn *); extern struct cmd_list_element **auto_load_set_cmdlist_get (void); diff --git a/gdb/auxv.c b/gdb/auxv.c index 95cbeecd797..dfba94b4e1e 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -552,7 +552,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops) } static void -info_auxv_command (char *cmd, int from_tty) +info_auxv_command (const char *cmd, int from_tty) { if (! target_has_stack) error (_("The program has no auxiliary information now.")); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 9aca8c32e5e..f4ce2706d45 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1546,7 +1546,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) All io registers are 8-bit. */ static void -avr_io_reg_read_command (char *args, int from_tty) +avr_io_reg_read_command (const char *args, int from_tty) { LONGEST bufsiz = 0; gdb_byte *buf; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4272378a694..5645ecdeabf 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -161,8 +161,6 @@ static int breakpoint_location_address_range_overlap (struct bp_location *, const address_space *, CORE_ADDR, int); -static void info_watchpoints_command (char *, int); - static int remove_breakpoint (struct bp_location *); static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason); @@ -228,8 +226,6 @@ static int is_hardware_watchpoint (const struct breakpoint *bpt); static void insert_breakpoint_locations (void); -static void info_tracepoints_command (char *, int); - static void enable_trace_command (char *, int); static void disable_trace_command (char *, int); @@ -6705,16 +6701,8 @@ info_breakpoints_command (const char *args, int from_tty) 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) +info_watchpoints_command (const char *args, int from_tty) { int num_printed = breakpoint_1 (args, 0, is_watchpoint); struct ui_out *uiout = current_uiout; @@ -14919,7 +14907,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp) omitted. */ static void -info_tracepoints_command (char *args, int from_tty) +info_tracepoints_command (const char *args, int from_tty) { struct ui_out *uiout = current_uiout; int num_printed; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index be022d32152..ccfedb2a5fa 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -207,14 +207,6 @@ show_command (const char *arg, int from_tty) cmd_show_list (showlist, from_tty, ""); } -/* A temporary non-const overload of show_command. */ - -static void -show_command (char *arg, int from_tty) -{ - cmd_show_list (showlist, from_tty, ""); -} - /* Provide documentation on command or list given by COMMAND. FROM_TTY is ignored. */ diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index e9baf38d132..0c555268b30 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -915,7 +915,7 @@ delete_cmd (const char *name, struct cmd_list_element **list, /* Add an element to the list of info subcommands. */ struct cmd_list_element * -add_info (const char *name, cmd_cfunc_ftype *fun, const char *doc) +add_info (const char *name, cmd_const_cfunc_ftype *fun, const char *doc) { return add_cmd (name, class_info, fun, doc, &infolist); } diff --git a/gdb/command.h b/gdb/command.h index c3348bcedee..258f7f7de26 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -268,7 +268,7 @@ extern struct cmd_list_element *add_com_suppress_notification int *supress_notification); extern struct cmd_list_element *add_info (const char *, - cmd_cfunc_ftype *fun, + cmd_const_cfunc_ftype *fun, const char *); extern struct cmd_list_element *add_info_alias (const char *, const char *, diff --git a/gdb/copying.awk b/gdb/copying.awk index 2a71939a6f5..1cd596a5641 100644 --- a/gdb/copying.awk +++ b/gdb/copying.awk @@ -10,12 +10,12 @@ BEGIN { print "#include \"command.h\"" print "#include \"gdbcmd.h\"" print "" - print "static void show_copying_command (char *, int);" + print "static void show_copying_command (const char *, int);" print "" - print "static void show_warranty_command (char *, int);" + print "static void show_warranty_command (const char *, int);" print "" print "static void"; - print "show_copying_command (char *ignore, int from_tty)"; + print "show_copying_command (const char *ignore, int from_tty)"; print "{"; } NR == 1,/^[ ]*15\. Disclaimer of Warranty\.[ ]*$/ { @@ -35,7 +35,7 @@ NR == 1,/^[ ]*15\. Disclaimer of Warranty\.[ ]*$/ { print "}"; print ""; print "static void"; - print "show_warranty_command (char *ignore, int from_tty)"; + print "show_warranty_command (const char *ignore, int from_tty)"; print "{"; } /^[ ]*15\. Disclaimer of Warranty\.[ ]*$/, /^[ ]*END OF TERMS AND CONDITIONS[ ]*$/{ diff --git a/gdb/copying.c b/gdb/copying.c index db024627cd3..8e4077ccb91 100644 --- a/gdb/copying.c +++ b/gdb/copying.c @@ -6,12 +6,12 @@ #include "command.h" #include "gdbcmd.h" -static void show_copying_command (char *, int); +static void show_copying_command (const char *, int); -static void show_warranty_command (char *, int); +static void show_warranty_command (const char *, int); static void -show_copying_command (char *ignore, int from_tty) +show_copying_command (const char *ignore, int from_tty) { printf_filtered (" GNU GENERAL PUBLIC LICENSE\n"); printf_filtered (" Version 3, 29 June 2007\n"); @@ -604,7 +604,7 @@ show_copying_command (char *ignore, int from_tty) } static void -show_warranty_command (char *ignore, int from_tty) +show_warranty_command (const char *ignore, int from_tty) { printf_filtered (" 15. Disclaimer of Warranty.\n"); printf_filtered ("\n"); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 817de59f12f..6045cb06dd1 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1601,7 +1601,7 @@ first_component_command (const char *arg, int from_tty) /* Implement "info vtbl". */ static void -info_vtbl_command (char *arg, int from_tty) +info_vtbl_command (const char *arg, int from_tty) { struct value *value; diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c index fc9aeaaad73..44782bfa78d 100644 --- a/gdb/darwin-nat-info.c +++ b/gdb/darwin-nat-info.c @@ -66,7 +66,7 @@ #define port_type_array_t mach_port_array_t static void -info_mach_tasks_command (char *args, int from_tty) +info_mach_tasks_command (const char *args, int from_tty) { int sysControl[4]; int count, index; @@ -109,7 +109,7 @@ info_mach_tasks_command (char *args, int from_tty) } static task_t -get_task_from_args (char *args) +get_task_from_args (const char *args) { task_t task; char *eptr; @@ -132,7 +132,7 @@ get_task_from_args (char *args) } static void -info_mach_task_command (char *args, int from_tty) +info_mach_task_command (const char *args, int from_tty) { union { @@ -189,7 +189,7 @@ info_mach_task_command (char *args, int from_tty) } static void -info_mach_ports_command (char *args, int from_tty) +info_mach_ports_command (const char *args, int from_tty) { port_name_array_t names; port_type_array_t types; @@ -326,7 +326,7 @@ darwin_debug_port_info (task_t task, mach_port_t port) } static void -info_mach_port_command (char *args, int from_tty) +info_mach_port_command (const char *args, int from_tty) { task_t task; mach_port_t port; @@ -338,7 +338,7 @@ info_mach_port_command (char *args, int from_tty) } static void -info_mach_threads_command (char *args, int from_tty) +info_mach_threads_command (const char *args, int from_tty) { thread_array_t threads; unsigned int thread_count; @@ -365,7 +365,7 @@ info_mach_threads_command (char *args, int from_tty) } static void -info_mach_thread_command (char *args, int from_tty) +info_mach_thread_command (const char *args, int from_tty) { union { @@ -696,7 +696,7 @@ darwin_debug_region (task_t task, mach_vm_address_t address) } static void -info_mach_regions_command (char *args, int from_tty) +info_mach_regions_command (const char *args, int from_tty) { task_t task; @@ -708,7 +708,7 @@ info_mach_regions_command (char *args, int from_tty) } static void -info_mach_regions_recurse_command (char *args, int from_tty) +info_mach_regions_recurse_command (const char *args, int from_tty) { task_t task; @@ -720,7 +720,7 @@ info_mach_regions_recurse_command (char *args, int from_tty) } static void -info_mach_region_command (char *exp, int from_tty) +info_mach_region_command (const char *exp, int from_tty) { struct value *val; mach_vm_address_t address; @@ -792,7 +792,7 @@ disp_exception (const darwin_exception_info *info) } static void -info_mach_exceptions_command (char *args, int from_tty) +info_mach_exceptions_command (const char *args, int from_tty) { int i; task_t task; diff --git a/gdb/dcache.c b/gdb/dcache.c index c8832fd36b5..e7b1e1440e9 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -125,8 +125,6 @@ static int dcache_read_line (DCACHE *dcache, struct dcache_block *db); static struct dcache_block *dcache_alloc (DCACHE *dcache, CORE_ADDR addr); -static void info_dcache_command (char *exp, int tty); - static int dcache_enabled_p = 0; /* OBSOLETE */ static void @@ -585,7 +583,7 @@ dcache_print_line (DCACHE *dcache, int index) /* Parse EXP and show the info about DCACHE. */ static void -dcache_info_1 (DCACHE *dcache, char *exp) +dcache_info_1 (DCACHE *dcache, const char *exp) { splay_tree_node n; int i, refcount; @@ -640,7 +638,7 @@ dcache_info_1 (DCACHE *dcache, char *exp) } static void -info_dcache_command (char *exp, int tty) +info_dcache_command (const char *exp, int tty) { dcache_info_1 (target_dcache_get (), exp); } diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 5bcab9d525f..c9ece0d5c04 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -34,7 +34,6 @@ #include "block.h" #include "dictionary.h" -static void info_common_command (char *, int); static void f77_get_dynamic_length_of_aggregate (struct type *); int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -433,7 +432,7 @@ info_common_command_for_block (const struct block *block, const char *comname, given name. */ static void -info_common_command (char *comname, int from_tty) +info_common_command (const char *comname, int from_tty) { struct frame_info *fi; const struct block *block; diff --git a/gdb/frame.h b/gdb/frame.h index 7c24c3ac3c0..0ed7a14d032 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -786,9 +786,9 @@ extern void read_frame_arg (struct symbol *sym, struct frame_info *frame, extern void read_frame_local (struct symbol *sym, struct frame_info *frame, struct frame_arg *argp); -extern void info_args_command (char *, int); +extern void info_args_command (const char *, int); -extern void info_locals_command (char *, int); +extern void info_locals_command (const char *, int); extern void return_command (const char *, int); diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 2ae20318f96..609ba502a52 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -3145,31 +3145,31 @@ info_port_rights (const char *args, mach_port_type_t only) } static void -info_send_rights_cmd (char *args, int from_tty) +info_send_rights_cmd (const char *args, int from_tty) { info_port_rights (args, MACH_PORT_TYPE_SEND); } static void -info_recv_rights_cmd (char *args, int from_tty) +info_recv_rights_cmd (const char *args, int from_tty) { info_port_rights (args, MACH_PORT_TYPE_RECEIVE); } static void -info_port_sets_cmd (char *args, int from_tty) +info_port_sets_cmd (const char *args, int from_tty) { info_port_rights (args, MACH_PORT_TYPE_PORT_SET); } static void -info_dead_names_cmd (char *args, int from_tty) +info_dead_names_cmd (const char *args, int from_tty) { info_port_rights (args, MACH_PORT_TYPE_DEAD_NAME); } static void -info_port_rights_cmd (char *args, int from_tty) +info_port_rights_cmd (const char *args, int from_tty) { info_port_rights (args, ~0); } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 33244eed5f9..07dbdfe2b3f 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -62,14 +62,8 @@ /* Local functions: */ -static void info_registers_command (char *, int); - static void until_next_command (int); -static void info_float_command (char *, int); - -static void info_program_command (char *, int); - static void step_1 (int, int, const char *); #define ERROR_NO_INFERIOR \ @@ -2083,7 +2077,7 @@ finish_command (const char *arg, int from_tty) static void -info_program_command (char *args, int from_tty) +info_program_command (const char *args, int from_tty) { bpstat bs; int num, stat; @@ -2416,7 +2410,7 @@ default_print_registers_info (struct gdbarch *gdbarch, } void -registers_info (char *addr_exp, int fpregs) +registers_info (const char *addr_exp, int fpregs) { struct frame_info *frame; struct gdbarch *gdbarch; @@ -2435,7 +2429,7 @@ registers_info (char *addr_exp, int fpregs) while (*addr_exp != '\0') { - char *start; + const char *start; const char *end; /* Skip leading white space. */ @@ -2524,13 +2518,13 @@ registers_info (char *addr_exp, int fpregs) } static void -info_all_registers_command (char *addr_exp, int from_tty) +info_all_registers_command (const char *addr_exp, int from_tty) { registers_info (addr_exp, 1); } static void -info_registers_command (char *addr_exp, int from_tty) +info_registers_command (const char *addr_exp, int from_tty) { registers_info (addr_exp, 0); } @@ -2565,7 +2559,7 @@ print_vector_info (struct ui_file *file, } static void -info_vector_command (char *args, int from_tty) +info_vector_command (const char *args, int from_tty) { if (!target_has_registers) error (_("The program has no registers now.")); @@ -3106,7 +3100,7 @@ default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, } static void -info_float_command (char *args, int from_tty) +info_float_command (const char *args, int from_tty) { struct frame_info *frame; diff --git a/gdb/inferior.c b/gdb/inferior.c index 0c60d30fa22..bcac98180a2 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -529,7 +529,7 @@ print_selected_inferior (struct ui_out *uiout) printed. */ static void -print_inferior (struct ui_out *uiout, char *requested_inferiors) +print_inferior (struct ui_out *uiout, const char *requested_inferiors) { struct inferior *inf; int inf_count = 0; @@ -718,7 +718,7 @@ inferior_command (const char *args, int from_tty) /* Print information about currently known inferiors. */ static void -info_inferiors_command (char *args, int from_tty) +info_inferiors_command (const char *args, int from_tty) { print_inferior (current_uiout, args); } diff --git a/gdb/inferior.h b/gdb/inferior.h index f70c0accc53..37252a695cd 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -160,7 +160,7 @@ extern void set_inferior_args (const char *); extern void set_inferior_args_vector (int, char **); -extern void registers_info (char *, int); +extern void registers_info (const char *, int); extern void continue_1 (int all_threads); diff --git a/gdb/inflow.c b/gdb/inflow.c index 2fba0fa2a7e..0c279e6a9f3 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -467,7 +467,7 @@ copy_terminal_info (struct inferior *to, struct inferior *from) } void -info_terminal_command (char *arg, int from_tty) +info_terminal_command (const char *arg, int from_tty) { target_terminal::info (arg, from_tty); } diff --git a/gdb/infrun.c b/gdb/infrun.c index b041ff1199d..4bf21c02e81 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -70,8 +70,6 @@ /* Prototypes for local functions */ -static void info_signals_command (char *, int); - static void sig_print_info (enum gdb_signal); static void sig_print_header (void); @@ -8679,7 +8677,7 @@ Use \"info signals\" for a list of symbolic signals.")); targets, all signals should be in the signal tables). */ static void -info_signals_command (char *signum_exp, int from_tty) +info_signals_command (const char *signum_exp, int from_tty) { enum gdb_signal oursig; diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index c60d90c3e51..f55f743ed16 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -571,7 +571,7 @@ Please switch to another checkpoint before detaching the current one")); /* Print information about currently known checkpoints. */ static void -info_checkpoints_command (char *arg, int from_tty) +info_checkpoints_command (const char *arg, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); struct symtab_and_line sal; diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c index 2bb8705fd6a..0ec8f822870 100644 --- a/gdb/macrocmd.c +++ b/gdb/macrocmd.c @@ -188,19 +188,19 @@ print_macro_definition (const char *name, /* The implementation of the `info macro' command. */ static void -info_macro_command (char *args, int from_tty) +info_macro_command (const char *args, int from_tty) { struct macro_scope *ms = NULL; struct cleanup *cleanup_chain; - char *name; + const char *name; int show_all_macros_named = 0; - char *arg_start = args; + const char *arg_start = args; int processing_args = 1; while (processing_args && arg_start && *arg_start == '-' && *arg_start != '\0') { - char *p = skip_to_space (arg_start); + const char *p = skip_to_space (arg_start); if (strncmp (arg_start, "-a", p - arg_start) == 0 || strncmp (arg_start, "-all", p - arg_start) == 0) @@ -212,10 +212,9 @@ info_macro_command (char *args, int from_tty) processing_args = 0; else { - /* Relies on modified 'args' not making it in to history */ - *p = '\0'; - error (_("Unrecognized option '%s' to info macro command. " - "Try \"help info macro\"."), arg_start); + error (_("Unrecognized option '%.*s' to info macro command. " + "Try \"help info macro\"."), + int (p - arg_start), arg_start); } arg_start = skip_spaces (p); @@ -270,7 +269,7 @@ info_macro_command (char *args, int from_tty) /* Implementation of the "info macros" command. */ static void -info_macros_command (char *args, int from_tty) +info_macros_command (const char *args, int from_tty) { struct macro_scope *ms = NULL; struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms); diff --git a/gdb/memattr.c b/gdb/memattr.c index 04986646db8..02b93e838b8 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -341,7 +341,7 @@ mem_command (const char *args, int from_tty) static void -info_mem_command (char *args, int from_tty) +info_mem_command (const char *args, int from_tty) { if (mem_use_target ()) printf_filtered (_("Using memory regions provided by the target.\n")); diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index eb74c711322..1da1a98f93d 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -359,7 +359,7 @@ do_closedir_cleanup (void *dir) } static void -procfs_pidlist (char *args, int from_tty) +procfs_pidlist (const char *args, int from_tty) { DIR *dp = NULL; struct dirent *dirp = NULL; @@ -461,7 +461,7 @@ procfs_pidlist (char *args, int from_tty) } static void -procfs_meminfo (char *args, int from_tty) +procfs_meminfo (const char *args, int from_tty) { procfs_mapinfo *mapinfos = NULL; static int num_mapinfos = 0; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 43abf13bc3e..eb9da74e7c6 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -561,7 +561,7 @@ compare_selectors (const void *a, const void *b) */ static void -info_selectors_command (char *regexp, int from_tty) +info_selectors_command (const char *regexp, int from_tty) { struct objfile *objfile; struct minimal_symbol *msymbol; @@ -723,7 +723,7 @@ compare_classes (const void *a, const void *b) */ static void -info_classes_command (char *regexp, int from_tty) +info_classes_command (const char *regexp, int from_tty) { struct objfile *objfile; struct minimal_symbol *msymbol; diff --git a/gdb/osdata.c b/gdb/osdata.c index 276d22427a6..a8b106b2a79 100644 --- a/gdb/osdata.c +++ b/gdb/osdata.c @@ -405,7 +405,7 @@ info_osdata (const char *type) } static void -info_osdata_command (char *arg, int from_tty) +info_osdata_command (const char *arg, int from_tty) { info_osdata (arg); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 48ff9038cf2..707b3319192 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1296,7 +1296,7 @@ set_command (const char *exp, int from_tty) } static void -info_symbol_command (char *arg, int from_tty) +info_symbol_command (const char *arg, int from_tty) { struct minimal_symbol *msymbol; struct objfile *objfile; @@ -1387,7 +1387,7 @@ info_symbol_command (char *arg, int from_tty) } static void -info_address_command (char *exp, int from_tty) +info_address_command (const char *exp, int from_tty) { struct gdbarch *gdbarch; int regno; @@ -2053,7 +2053,7 @@ disable_current_display (void) } static void -info_display_command (char *ignore, int from_tty) +info_display_command (const char *ignore, int from_tty) { struct display *d; diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 32cb7e92b7c..336955a6784 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -52,7 +52,7 @@ gdbpy_auto_load_enabled (const struct extension_language_defn *extlang) /* Wrapper for "info auto-load python-scripts". */ static void -info_auto_load_python_scripts (char *pattern, int from_tty) +info_auto_load_python_scripts (const char *pattern, int from_tty) { auto_load_info_scripts (pattern, from_tty, &extension_language_python); } diff --git a/gdb/reverse.c b/gdb/reverse.c index 28410a8788b..7362f321e36 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -305,7 +305,7 @@ bookmark_1 (int bnum) /* Implement "info bookmarks" command. */ static void -info_bookmarks_command (char *args, int from_tty) +info_bookmarks_command (const char *args, int from_tty) { if (!bookmark_chain) printf_filtered (_("No bookmarks.\n")); diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c index 6965f19a805..4884092afcf 100644 --- a/gdb/ser-go32.c +++ b/gdb/ser-go32.c @@ -887,7 +887,7 @@ gdb_pipe (int pdes[2]) } static void -info_serial_command (char *arg, int from_tty) +info_serial_command (const char *arg, int from_tty) { struct dos_ttystate *port; #ifdef DOS_STATS diff --git a/gdb/skip.c b/gdb/skip.c index af60eb74042..20fca784334 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -353,7 +353,7 @@ skip_command (const char *arg, int from_tty) } static void -info_skip_command (char *arg, int from_tty) +info_skip_command (const char *arg, int from_tty) { int num_printable_entries = 0; struct value_print_options opts; diff --git a/gdb/solib.c b/gdb/solib.c index c70b9d81933..b63bb9d4954 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1045,7 +1045,7 @@ solib_add (const char *pattern, int from_tty, int readsyms) all. */ static void -info_sharedlibrary_command (char *pattern, int from_tty) +info_sharedlibrary_command (const char *pattern, int from_tty) { struct so_list *so = NULL; /* link map state variable */ int so_missing_debug_info = 0; diff --git a/gdb/source.c b/gdb/source.c index e67209e2010..cefc612f3e6 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -52,10 +52,6 @@ static int get_filename_and_charpos (struct symtab *, char **); -static void info_line_command (char *, int); - -static void info_source_command (char *, int); - /* Path of directories to search for source files. Same format as the PATH environment variable's value. */ @@ -639,7 +635,7 @@ add_path (const char *dirname, char **which_path, int parse_separators) static void -info_source_command (char *ignore, int from_tty) +info_source_command (const char *ignore, int from_tty) { struct symtab *s = current_source_symtab; struct compunit_symtab *cust; @@ -1480,7 +1476,7 @@ print_source_lines (struct symtab *s, int line, int stopline, /* Print info on range of pc's in a specified line. */ static void -info_line_command (char *arg, int from_tty) +info_line_command (const char *arg, int from_tty) { CORE_ADDR start_pc, end_pc; diff --git a/gdb/stack.c b/gdb/stack.c index 592f0265b4c..81032fc895c 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1380,7 +1380,7 @@ parse_frame_specification (const char *frame_exp, int *selected_frame_p) ADDR_EXP. Absolutely all information in the frame is printed. */ static void -info_frame_command (char *addr_exp, int from_tty) +info_frame_command (const char *addr_exp, int from_tty) { struct frame_info *fi; struct symbol *func; @@ -1903,14 +1903,6 @@ backtrace_command (const char *arg, 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. */ @@ -2114,7 +2106,7 @@ print_frame_local_vars (struct frame_info *frame, int num_tabs, } void -info_locals_command (char *args, int from_tty) +info_locals_command (const char *args, int from_tty) { print_frame_local_vars (get_selected_frame (_("No frame selected.")), 0, gdb_stdout); @@ -2196,7 +2188,7 @@ print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream) } void -info_args_command (char *ignore, int from_tty) +info_args_command (const char *ignore, int from_tty) { print_frame_arg_vars (get_selected_frame (_("No frame selected.")), gdb_stdout); diff --git a/gdb/symfile.c b/gdb/symfile.c index 9afd9943d9c..8cc76e36459 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -102,8 +102,6 @@ static int simple_read_overlay_table (void); static int simple_overlay_update_1 (struct obj_section *); -static void info_ext_lang_command (char *args, int from_tty); - static void symfile_find_segment_sections (struct objfile *objfile); /* List of all available sym_fns. On gdb startup, each object file reader @@ -2723,7 +2721,7 @@ set_ext_lang_command (char *args, int from_tty, struct cmd_list_element *e) } static void -info_ext_lang_command (char *args, int from_tty) +info_ext_lang_command (const char *args, int from_tty) { printf_filtered (_("Filename extensions and the languages they represent:")); printf_filtered ("\n\n"); diff --git a/gdb/symtab.c b/gdb/symtab.c index d02b707c52a..1df980ab65a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4033,7 +4033,7 @@ output_partial_symbol_filename (const char *filename, const char *fullname, } static void -info_sources_command (char *ignore, int from_tty) +info_sources_command (const char *ignore, int from_tty) { struct compunit_symtab *cu; struct symtab *s; @@ -4485,23 +4485,15 @@ 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); -} - static void -info_functions_command (char *regexp, int from_tty) +info_functions_command (const char *regexp, int from_tty) { symtab_symbol_info (regexp, FUNCTIONS_DOMAIN, from_tty); } static void -info_types_command (char *regexp, int from_tty) +info_types_command (const char *regexp, int from_tty) { symtab_symbol_info (regexp, TYPES_DOMAIN, from_tty); } diff --git a/gdb/target.c b/gdb/target.c index 93bb6e93c76..5c612d14134 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -48,8 +48,6 @@ #include #include "byte-vector.h" -static void info_target_command (char *, int); - static void generic_tls_error (void) ATTRIBUTE_NORETURN; static void default_terminal_info (struct target_ops *, const char *, int); @@ -2019,7 +2017,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch, } static void -info_target_command (char *args, int from_tty) +info_target_command (const char *args, int from_tty) { struct target_ops *t; int has_all_mem = 0; diff --git a/gdb/thread.c b/gdb/thread.c index f6140979265..7309302b6b6 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -62,7 +62,6 @@ static int threads_executing; static void thread_apply_all_command (char *, int); static int thread_alive (struct thread_info *); -static void info_threads_command (char *, int); /* RAII type used to increase / decrease the refcount of each thread in a given list of threads. */ @@ -1197,7 +1196,7 @@ should_print_thread (const char *requested_threads, int default_inf_num, thread ids. */ static void -print_thread_info_1 (struct ui_out *uiout, char *requested_threads, +print_thread_info_1 (struct ui_out *uiout, const char *requested_threads, int global_ids, int pid, int show_global_ids) { @@ -1384,7 +1383,7 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid) effects info-threads command would be nicer. */ static void -info_threads_command (char *arg, int from_tty) +info_threads_command (const char *arg, int from_tty) { int show_global_ids = 0; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 3cae62065a1..f7e35da0829 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -492,7 +492,7 @@ tvariables_info_1 (void) /* List all the trace state variables. */ static void -info_tvariables_command (char *args, int from_tty) +info_tvariables_command (const char *args, int from_tty) { tvariables_info_1 (); } @@ -2514,7 +2514,7 @@ tfind_outside_command (const char *args, int from_tty) /* info scope command: list the locals for a scope. */ static void -info_scope_command (char *args_in, int from_tty) +info_scope_command (const char *args_in, int from_tty) { struct symbol *sym; struct bound_minimal_symbol msym; @@ -3874,7 +3874,7 @@ print_one_static_tracepoint_marker (int count, } static void -info_static_tracepoint_markers_command (char *arg, int from_tty) +info_static_tracepoint_markers_command (const char *arg, int from_tty) { VEC(static_tracepoint_marker_p) *markers; struct cleanup *old_chain; diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 9482646c95f..685cf0621e0 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -64,7 +64,7 @@ static int new_height_ok (struct tui_win_info *, 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_all_windows_info (const char *, int); 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); @@ -1087,7 +1087,7 @@ tui_set_focus_command (const char *arg, int from_tty) static void -tui_all_windows_info (char *arg, int from_tty) +tui_all_windows_info (const char *arg, int from_tty) { int type; struct tui_win_info *win_with_focus = tui_win_with_focus (); -- 2.30.2