34 #include "filenames.h" 121 bool function_is_regexp,
124 : m_file_is_glob (file_is_glob),
125 m_file (std::move (file)),
126 m_function_is_regexp (function_is_regexp),
127 m_function (std::move (function))
138 int flags = REG_NOSUB;
140 flags |= REG_EXTENDED;
156 std::move (
function),
175 error (
_(
"No default file now."));
207 const char *
name = NULL;
211 error (
_(
"No default function now."));
216 error (
_(
"No function found containing current program point %s."),
231 const char *file = NULL;
232 const char *gfile = NULL;
233 const char *
function = NULL;
234 const char *rfunction = NULL;
245 for (i = 0;
argv[i] != NULL; ++i)
247 const char *p =
argv[i];
250 if (strcmp (p,
"-fi") == 0
251 || strcmp (p,
"-file") == 0)
254 error (
_(
"Missing value for %s option."), p);
258 else if (strcmp (p,
"-gfi") == 0
259 || strcmp (p,
"-gfile") == 0)
262 error (
_(
"Missing value for %s option."), p);
266 else if (strcmp (p,
"-fu") == 0
267 || strcmp (p,
"-function") == 0)
270 error (
_(
"Missing value for %s option."), p);
274 else if (strcmp (p,
"-rfu") == 0
275 || strcmp (p,
"-rfunction") == 0)
278 error (
_(
"Missing value for %s option."), p);
283 error (
_(
"Invalid skip option: %s"), p);
294 error (
_(
"Invalid argument: %s"), p);
297 if (file != NULL && gfile != NULL)
298 error (
_(
"Cannot specify both -file and -gfile."));
300 if (
function != NULL && rfunction != NULL)
301 error (
_(
"Cannot specify both -function and -rfunction."));
306 ||
function != NULL || rfunction != NULL);
311 else if (gfile != NULL)
315 if (
function != NULL)
316 entry_function =
function;
317 else if (rfunction != NULL)
318 entry_function = rfunction;
321 rfunction != NULL, std::move (entry_function));
328 const char *file_to_print = file != NULL ? file : gfile;
329 const char *function_to_print =
function != NULL ? function : rfunction;
330 const char *file_text = gfile != NULL ?
_(
"File(s)") :
_(
"File");
331 const char *lower_file_text = gfile != NULL ?
_(
"file(s)") :
_(
"file");
332 const char *function_text
333 = rfunction != NULL ?
_(
"Function(s)") :
_(
"Function");
335 if (function_to_print == NULL)
338 file_text, file_to_print);
340 else if (file_to_print == NULL)
343 function_text, function_to_print);
348 " when stepping.\n"),
349 function_text, function_to_print,
350 lower_file_text, file_to_print);
358 int num_printable_entries = 0;
367 num_printable_entries++;
369 if (num_printable_entries == 0)
372 current_uiout->message (
_(
"Not skipping any files or functions.\n"));
375 _(
"No skiplist entries found with number %s.\n"), arg);
405 if (e.file_is_glob ())
411 e.file ().empty () ?
"<none>" 412 : e.file ().c_str ());
413 if (e.function_is_regexp ())
419 e.function ().empty () ?
"<none>" 420 : e.function ().c_str ());
439 error (
_(
"No skiplist entries found with number %s."), arg);
455 error (
_(
"No skiplist entries found with number %s."), arg);
479 error (
_(
"No skiplist entries found with number %s."), arg);
495 lbasename (
m_file.c_str ())) != 0)
515 FNM_FILE_NAME | FNM_NOESCAPE) == 0)
526 FNM_FILE_NAME | FNM_NOESCAPE) != 0)
546 if (function_sal.
symtab == NULL)
577 if (function_name == NULL)
585 bool skip_by_file = e.skip_file_p (function_sal);
586 bool skip_by_function = e.skip_function_p (function_name);
590 if (!e.file ().empty () && !e.function ().empty ())
592 if (skip_by_file && skip_by_function)
596 else if (skip_by_file || skip_by_function)
610 Ignore a function while stepping.\n\ 612 Usage: skip [FUNCTION-NAME]\n\ 613 skip [<file-spec>] [<function-spec>]\n\ 614 If no arguments are given, ignore the current function.\n\ 616 <file-spec> is one of:\n\ 617 -fi|-file FILE-NAME\n\ 618 -gfi|-gfile GLOB-FILE-PATTERN\n\ 619 <function-spec> is one of:\n\ 620 -fu|-function FUNCTION-NAME\n\ 621 -rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
622 &skiplist,
"skip ", 1, &
cmdlist);
625 Ignore a file while stepping.\n\ 626 Usage: skip file [FILE-NAME]\n\ 627 If no filename is given, ignore the current file."),
632 Ignore a function while stepping.\n\ 633 Usage: skip function [FUNCTION-NAME]\n\ 634 If no function name is given, skip the current function."),
639 Enable skip entries. You can specify numbers (e.g. \"skip enable 1 3\"), \ 640 ranges (e.g. \"skip enable 4-8\"), or both (e.g. \"skip enable 1 3 4-8\").\n\n\ 641 If you don't specify any numbers or ranges, we'll enable all skip entries.\n\n\ 642 Usage: skip enable [NUMBERS AND/OR RANGES]"),
646 Disable skip entries. You can specify numbers (e.g. \"skip disable 1 3\"), \ 647 ranges (e.g. \"skip disable 4-8\"), or both (e.g. \"skip disable 1 3 4-8\").\n\n\ 648 If you don't specify any numbers or ranges, we'll disable all skip entries.\n\n\ 649 Usage: skip disable [NUMBERS AND/OR RANGES]"),
653 Delete skip entries. You can specify numbers (e.g. \"skip delete 1 3\"), \ 654 ranges (e.g. \"skip delete 4-8\"), or both (e.g. \"skip delete 1 3 4-8\").\n\n\ 655 If you don't specify any numbers or ranges, we'll delete all skip entries.\n\n\ 656 Usage: skip delete [NUMBERS AND/OR RANGES]"),
660 Display the status of skips. You can specify numbers (e.g. \"skip info 1 3\"), \ 661 ranges (e.g. \"skip info 4-8\"), or both (e.g. \"skip info 1 3 4-8\").\n\n\ 662 If you don't specify any numbers or ranges, we'll show all skips.\n\n\ 663 Usage: skip info [NUMBERS AND/OR RANGES]\n\ 664 The \"Type\" column indicates one of:\n\ 665 \tfile - ignored file\n\ 666 \tfunction - ignored function"));
CORE_ADDR get_last_displayed_addr(void)
bool skip_file_p(const symtab_and_line &function_sal) const
void _initialize_step_skip(void)
bool m_function_is_regexp
bool skip_function_p(const char *function_name) const
static void info_skip_command(const char *arg, int from_tty)
static void skip_disable_command(const char *arg, int from_tty)
gdb::optional< compiled_regex > m_compiled_function_regexp
int strcmp_iw(const char *string1, const char *string2)
int number_is_in_list(const char *list, int number)
int compare_filenames_for_search(const char *filename, const char *search_name)
struct cmd_list_element * add_info(const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
int compare_glob_filenames_for_search(const char *filename, const char *search_name)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
struct cmd_list_element * cmdlist
bool file_is_glob() const
static void add_entry(bool file_is_glob, std::string &&file, bool function_is_regexp, std::string &&function)
static int highest_skiplist_entry_num
void printf_filtered(const char *format,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
const char * symtab_to_fullname(struct symtab *s)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
bool function_name_is_marked_for_skip(const char *function_name, const symtab_and_line &function_sal)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
bool function_is_regexp() const
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
static std::list< skiplist_entry > skiplist_entries
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
bool do_skip_file_p(const symtab_and_line &function_sal) const
static void skip_enable_command(const char *arg, int from_tty)
struct gdbarch * get_current_arch(void)
struct symtab * get_last_displayed_symtab(void)
void location_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *)
skiplist_entry(const skiplist_entry &)=delete
void operator=(const skiplist_entry &)=delete
T & emplace(Args &&... args)
int last_displayed_sal_is_valid(void)
static void skip_function(const char *name)
static void skip_command(const char *arg, int from_tty)
void get_user_print_options(struct value_print_options *opts)
bool do_skip_gfile_p(const symtab_and_line &function_sal) const
int gdb_filename_fnmatch(const char *pattern, const char *string, int flags)
static void skip_file_command(const char *arg, int from_tty)
static void skip_delete_command(const char *arg, int from_tty)
static void skip_function_command(const char *arg, int from_tty)
void error(const char *fmt,...)
const std::string & file() const
int exec(const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) const