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
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
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)
{
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 (©[0], from_tty);
}
}
}