aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-13 22:58:21 -0600
committerTom Tromey <tom@tromey.com>2017-11-07 13:59:09 -0700
commit5fed81ff351121887a93b5b57caebb86667cbbd2 (patch)
tree571f96134b9dd45b2778469c750a59ccc62bb624 /gdb/thread.c
parent1d12d88f186fe1ae66deccf877b5509c506c4d39 (diff)
downloadbinutils-5fed81ff351121887a93b5b57caebb86667cbbd2.zip
binutils-5fed81ff351121887a93b5b57caebb86667cbbd2.tar.gz
binutils-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/thread.c')
-rw-r--r--gdb/thread.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 7309302..1e81a61 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -60,7 +60,6 @@ static int highest_thread_num;
spawned new threads we haven't heard of yet. */
static int threads_executing;
-static void thread_apply_all_command (char *, int);
static int thread_alive (struct thread_info *);
/* RAII type used to increase / decrease the refcount of each thread
@@ -1652,7 +1651,7 @@ tp_array_compar (const thread_info *a, const thread_info *b)
thread apply all p x/i $pc Apply x/i $pc cmd to all threads. */
static void
-thread_apply_all_command (char *cmd, int from_tty)
+thread_apply_all_command (const char *cmd, int from_tty)
{
tp_array_compar_ascending = false;
if (cmd != NULL
@@ -1667,10 +1666,6 @@ thread_apply_all_command (char *cmd, int from_tty)
update_thread_list ();
- /* Save a copy of the command in case it is clobbered by
- execute_command. */
- std::string saved_cmd = cmd;
-
int tc = live_threads_count ();
if (tc != 0)
{
@@ -1708,10 +1703,11 @@ thread_apply_all_command (char *cmd, int from_tty)
printf_filtered (_("\nThread %s (%s):\n"),
print_thread_id (thr),
target_pid_to_str (inferior_ptid));
- execute_command (cmd, from_tty);
- /* Restore exact command used previously. */
- strcpy (cmd, saved_cmd.c_str ());
+ /* Use a copy of the command in case it is clobbered by
+ execute_command. */
+ std::string copy = cmd;
+ execute_command (&copy[0], from_tty);
}
}
}