diff options
author | Tom Tromey <tom@tromey.com> | 2017-10-13 22:58:21 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-11-07 13:59:09 -0700 |
commit | 5fed81ff351121887a93b5b57caebb86667cbbd2 (patch) | |
tree | 571f96134b9dd45b2778469c750a59ccc62bb624 /gdb/maint.c | |
parent | 1d12d88f186fe1ae66deccf877b5509c506c4d39 (diff) | |
download | gdb-5fed81ff351121887a93b5b57caebb86667cbbd2.zip gdb-5fed81ff351121887a93b5b57caebb86667cbbd2.tar.gz gdb-5fed81ff351121887a93b5b57caebb86667cbbd2.tar.bz2 |
Remove cmd_cfunc_ftype
This removes cmd_cfunc_ftype and the non-const overload of add_cmd;
then fixes up the fallout.
For the most part this patch is straightforward. There are a few
files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not
compile; so I made a best effort there.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt)
(go32_pde, go32_pte, go32_pte_for_address): Constify.
* gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd)
(set_thread_default_pause_cmd, set_thread_default_run_cmd)
(show_thread_default_run_cmd, set_thread_default_detach_sc_cmd)
(parse_int_arg, show_thread_default_detach_sc_cmd)
(set_signals_cmd, show_signals_cmd, set_sig_thread_cmd)
(show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd)
(set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd)
(show_task_pause_cmd, set_task_detach_sc_cmd)
(show_task_detach_sc_cmd, set_task_exc_port_cmd)
(set_noninvasive_cmd, set_thread_pause_cmd)
(show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd)
(set_thread_detach_sc_cmd, show_thread_detach_sc_cmd)
(set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify.
* windows-nat.c (display_selectors): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Remove
non-const "cfunc".
* cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload.
(cmd_cfunc_eq): Likewise.
(struct cmd_list_element): Likewise.
(do_cfunc): Remove.
(cli_user_command_p): Update.
* command.h (add_cmd): Remove non-const overload.
(cmd_cfunc_ftype): Remove typedef.
(cmd_cfunc_eq): Remove non-const overload.
* value.c (show_values): Constify.
* thread.c (thread_apply_all_command): Constify.
* symfile.c (load_command): Constify.
* source.c (directory_command): Constify.
* maint.c (maintenance_internal_error)
(maintenance_demangler_warning, maintenance_space_display)
(maintenance_print_architecture, maintenance_translate_address)
(maintenance_info_selftests, maintenance_internal_warning):
Constify.
* breakpoint.c (disable_trace_command, enable_trace_command):
Constify.
* auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir):
Constify.
(add_auto_load_safe_path): Constify.
* guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify.
* top.h (show_commands): Constify.
* linux-thread-db.c (info_auto_load_libthread_db): Constify.
* sparc64-tdep.c (adi_examine_command): Constify.
(adi_assign_command): Constify.
Diffstat (limited to 'gdb/maint.c')
-rw-r--r-- | gdb/maint.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/gdb/maint.c b/gdb/maint.c index 65a056b..94293d5 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -44,10 +44,6 @@ #include "cli/cli-utils.h" #include "cli/cli-setshow.h" -static void maintenance_internal_error (char *args, int from_tty); - -static void maintenance_space_display (char *, int); - static void maintenance_do_deprecate (const char *, int); /* Set this to the maximum number of seconds to wait instead of waiting forever @@ -98,7 +94,7 @@ maintenance_dump_me (const char *args, int from_tty) GDB. */ static void -maintenance_internal_error (char *args, int from_tty) +maintenance_internal_error (const char *args, int from_tty) { internal_error (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); } @@ -109,7 +105,7 @@ maintenance_internal_error (char *args, int from_tty) GDB. */ static void -maintenance_internal_warning (char *args, int from_tty) +maintenance_internal_warning (const char *args, int from_tty) { internal_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); } @@ -118,7 +114,7 @@ maintenance_internal_warning (char *args, int from_tty) demangler problem is detected. Allows testing of the mechanism. */ static void -maintenance_demangler_warning (char *args, int from_tty) +maintenance_demangler_warning (const char *args, int from_tty) { demangler_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); } @@ -143,7 +139,7 @@ maintenance_time_display (const char *args, int from_tty) } static void -maintenance_space_display (char *args, int from_tty) +maintenance_space_display (const char *args, int from_tty) { if (args == NULL || *args == '\0') printf_unfiltered ("\"maintenance space\" takes a numeric argument.\n"); @@ -394,7 +390,7 @@ maintenance_print_statistics (const char *args, int from_tty) } static void -maintenance_print_architecture (char *args, int from_tty) +maintenance_print_architecture (const char *args, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); @@ -429,11 +425,11 @@ maintenance_print_command (const char *arg, int from_tty) or maintenance translate-address <addr>. */ static void -maintenance_translate_address (char *arg, int from_tty) +maintenance_translate_address (const char *arg, int from_tty) { CORE_ADDR address; struct obj_section *sect; - char *p; + const char *p; struct bound_minimal_symbol sym; struct objfile *objfile; @@ -449,12 +445,13 @@ maintenance_translate_address (char *arg, int from_tty) p++; if (*p == '\000') /* End of command? */ error (_("Need to specify <section-name> and <address>")); - *p++ = '\000'; - p = skip_spaces (p); + + int arg_len = p - arg; + p = skip_spaces (p + 1); ALL_OBJSECTIONS (objfile, sect) { - if (strcmp (sect->the_bfd_section->name, arg) == 0) + if (strncmp (sect->the_bfd_section->name, arg, arg_len) == 0) break; } @@ -946,7 +943,7 @@ maintenance_selftest (const char *args, int from_tty) } static void -maintenance_info_selftests (char *arg, int from_tty) +maintenance_info_selftests (const char *arg, int from_tty) { printf_filtered ("Registered selftests:\n"); selftests::for_each_selftest ([] (const std::string &name) { |