#include <algorithm>
#include "common/gdb_optional.h"
#include "inline-frame.h"
+#include "stack.h"
/* Definition of struct thread_info exported to gdbthread.h. */
{
qcs_flags flags;
const char *cmd = NULL;
- const char *cmd_or_flags;
tid_range_parser parser;
if (tidlist == NULL || *tidlist == '\000')
int inf_num, thr_start, thr_end;
if (!parser.get_tid_range (&inf_num, &thr_start, &thr_end))
- {
- cmd = parser.cur_tok ();
- break;
- }
+ break;
}
- cmd_or_flags = cmd;
- while (cmd != NULL && parse_flags_qcs ("thread apply", &cmd, &flags))
+ cmd = parser.cur_tok ();
+
+ while (parse_flags_qcs ("thread apply", &cmd, &flags))
;
- if (cmd == NULL)
+ if (*cmd == '\0')
error (_("Please specify a command following the thread ID list"));
- if (tidlist == cmd || !isalpha (cmd[0]))
+ if (tidlist == cmd || isdigit (cmd[0]))
invalid_thread_id_error (cmd);
scoped_restore_current_thread restore_thread;
parser.init (tidlist, current_inferior ()->num);
- while (!parser.finished () && parser.cur_tok () < cmd_or_flags)
+ while (!parser.finished ())
{
struct thread_info *tp = NULL;
struct inferior *inf;
tfaas_command (const char *cmd, int from_tty)
{
std::string expanded
- = std::string ("thread apply all -s frame apply all -s ") + cmd;
+ = std::string ("thread apply all -s -- frame apply all -s ") + cmd;
execute_command (expanded.c_str (), from_tty);
}
_initialize_thread (void)
{
static struct cmd_list_element *thread_apply_list = NULL;
+ cmd_list_element *c;
add_info ("threads", info_threads_command,
_("Display currently known threads.\n\
Usage: taas COMMAND\n\
shortcut for 'thread apply all -s COMMAND'"));
- add_com ("tfaas", class_run, tfaas_command, _("\
+ c = add_com ("tfaas", class_run, tfaas_command, _("\
Apply a command to all frames of all threads (ignoring errors and empty output).\n\
-Usage: tfaas COMMAND\n\
-shortcut for 'thread apply all -s frame apply all -s COMMAND'"));
+Usage: tfaas [OPTION]... COMMAND\n\
+shortcut for 'thread apply all -s -- frame apply all -s [OPTION]... COMMAND'\n\
+See \"help frame apply all\" for available options."));
+ set_cmd_completer_handle_brkchars (c, frame_apply_all_cmd_completer);
add_cmd ("name", class_run, thread_name_command,
_("Set the current thread's name.\n\