36#include "gdbsupport/gdb_regex.h"
37#include "gdbsupport/gdb_optional.h"
40#include "gdbsupport/buildargv.h"
127 bool function_is_regexp,
128 std::string &&function,
130 : m_file_is_glob (file_is_glob),
131 m_file (
std::move (file)),
132 m_function_is_regexp (function_is_regexp),
133 m_function (
std::move (function))
138 gdb_assert (!
m_file.empty ());
144 REG_NOSUB | REG_EXTENDED,
151 bool function_is_regexp, std::string &&function)
175 error (_(
"No default file now."));
185 false, std::string ());
198 gdb_printf (_(
"Function %s will be skipped when stepping.\n"),
name);
209 const char *
name = NULL;
214 error (_(
"No function found containing current program point %s."),
228 const char *file = NULL;
229 const char *gfile = NULL;
230 const char *function = NULL;
231 const char *rfunction = NULL;
242 for (i = 0; argv[i] != NULL; ++i)
244 const char *p = argv[i];
245 const char *
value = argv[i + 1];
247 if (strcmp (p,
"-fi") == 0
248 || strcmp (p,
"-file") == 0)
251 error (_(
"Missing value for %s option."), p);
255 else if (strcmp (p,
"-gfi") == 0
256 || strcmp (p,
"-gfile") == 0)
259 error (_(
"Missing value for %s option."), p);
263 else if (strcmp (p,
"-fu") == 0
264 || strcmp (p,
"-function") == 0)
267 error (_(
"Missing value for %s option."), p);
271 else if (strcmp (p,
"-rfu") == 0
272 || strcmp (p,
"-rfunction") == 0)
275 error (_(
"Missing value for %s option."), p);
280 error (_(
"Invalid skip option: %s"), p);
291 error (_(
"Invalid argument: %s"), p);
294 if (file != NULL && gfile != NULL)
295 error (_(
"Cannot specify both -file and -gfile."));
297 if (function != NULL && rfunction != NULL)
298 error (_(
"Cannot specify both -function and -rfunction."));
302 gdb_assert (file != NULL || gfile != NULL
303 || function != NULL || rfunction != NULL);
305 std::string entry_file;
308 else if (gfile != NULL)
311 std::string entry_function;
312 if (function != NULL)
313 entry_function = function;
314 else if (rfunction != NULL)
315 entry_function = rfunction;
318 rfunction != NULL, std::move (entry_function));
325 const char *file_to_print = file != NULL ? file : gfile;
326 const char *function_to_print = function != NULL ? function : rfunction;
327 const char *file_text = gfile != NULL ? _(
"File(s)") : _(
"File");
328 const char *lower_file_text = gfile != NULL ? _(
"file(s)") : _(
"file");
329 const char *function_text
330 = rfunction != NULL ? _(
"Function(s)") : _(
"Function");
332 if (function_to_print == NULL)
334 gdb_printf (_(
"%s %s will be skipped when stepping.\n"),
335 file_text, file_to_print);
337 else if (file_to_print == NULL)
339 gdb_printf (_(
"%s %s will be skipped when stepping.\n"),
340 function_text, function_to_print);
344 gdb_printf (_(
"%s %s in %s %s will be skipped"
345 " when stepping.\n"),
346 function_text, function_to_print,
347 lower_file_text, file_to_print);
355 int num_printable_entries = 0;
364 num_printable_entries++;
366 if (num_printable_entries == 0)
369 current_uiout->message (_(
"Not skipping any files or functions.\n"));
372 _(
"No skiplist entries found with number %s.\n"), arg);
402 if (e.file_is_glob ())
408 e.file ().empty () ?
"<none>"
409 : e.file ().c_str (),
413 if (e.function_is_regexp ())
419 e.function ().empty () ?
"<none>"
420 : e.function ().c_str (),
421 e.function ().empty ()
442 error (_(
"No skiplist entries found with number %s."), arg);
458 error (_(
"No skiplist entries found with number %s."), arg);
482 error (_(
"No skiplist entries found with number %s."), arg);
490 "skip: checking if file %s matches non-glob %s...",
505 lbasename (
m_file.c_str ())) != 0)
526 "skip: checking if file %s matches glob %s...",
534 FNM_FILE_NAME | FNM_NOESCAPE) == 0)
545 FNM_FILE_NAME | FNM_NOESCAPE) != 0)
567 if (function_sal.
symtab == NULL)
588 "skip: checking if function %s matches regex %s...",
599 (
"skip: checking if function %s matches non-regex "
617 if (function_name == NULL)
625 bool skip_by_file = e.skip_file_p (function_sal);
626 bool skip_by_function = e.skip_function_p (function_name);
630 if (!e.file ().empty () && !e.function ().empty ())
632 if (skip_by_file && skip_by_function)
636 else if (skip_by_file || skip_by_function)
648 const char *text,
const char *word)
650 size_t word_len = strlen (word);
654 gdb::unique_xmalloc_ptr<char>
name = xstrprintf (
"%d", entry.number ());
655 if (strncmp (word,
name.get (), word_len) == 0)
668Ignore a function while stepping.\n\
670Usage: skip [FUNCTION-NAME]\n\
671 skip [FILE-SPEC] [FUNCTION-SPEC]\n\
672If no arguments are given, ignore the current function.\n\
674FILE-SPEC is one of:\n\
675 -fi|-file FILE-NAME\n\
676 -gfi|-gfile GLOB-FILE-PATTERN\n\
677FUNCTION-SPEC is one of:\n\
678 -fu|-function FUNCTION-NAME\n\
679 -rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
683Ignore a file while stepping.\n\
684Usage: skip file [FILE-NAME]\n\
685If no filename is given, ignore the current file."),
690Ignore a function while stepping.\n\
691Usage: skip function [FUNCTION-NAME]\n\
692If no function name is given, skip the current function."),
697Enable skip entries.\n\
698Usage: skip enable [NUMBER | RANGE]...\n\
699You can specify numbers (e.g. \"skip enable 1 3\"),\n\
700ranges (e.g. \"skip enable 4-8\"), or both (e.g. \"skip enable 1 3 4-8\").\n\n\
701If you don't specify any numbers or ranges, we'll enable all skip entries."),
706Disable skip entries.\n\
707Usage: skip disable [NUMBER | RANGE]...\n\
708You can specify numbers (e.g. \"skip disable 1 3\"),\n\
709ranges (e.g. \"skip disable 4-8\"), or both (e.g. \"skip disable 1 3 4-8\").\n\n\
710If you don't specify any numbers or ranges, we'll disable all skip entries."),
715Delete skip entries.\n\
716Usage: skip delete [NUMBER | RANGES]...\n\
717You can specify numbers (e.g. \"skip delete 1 3\"),\n\
718ranges (e.g. \"skip delete 4-8\"), or both (e.g. \"skip delete 1 3 4-8\").\n\n\
719If you don't specify any numbers or ranges, we'll delete all skip entries."),
724Display the status of skips.\n\
725Usage: info skip [NUMBER | RANGES]...\n\
726You can specify numbers (e.g. \"info skip 1 3\"), \n\
727ranges (e.g. \"info skip 4-8\"), or both (e.g. \"info skip 1 3 4-8\").\n\n\
728If you don't specify any numbers or ranges, we'll show all skips."));
733Set whether to print the debug output about skipping files and functions."),
735Show whether the debug output about skipping files and functions is printed."),
737When non-zero, debug output about skipping files and functions is displayed."),
struct gdbarch * get_current_arch(void)
struct symbol * get_frame_function(frame_info_ptr frame)
ui_file_style style() const
void add_completion(gdb::unique_xmalloc_ptr< char > name, completion_match_for_lcd *match_for_lcd=NULL, const char *text=NULL, const char *word=NULL)
static void add_entry(bool file_is_glob, std::string &&file, bool function_is_regexp, std::string &&function)
bool do_skip_gfile_p(const symtab_and_line &function_sal) const
bool skip_function_p(const char *function_name) const
const std::string & file() const
gdb::optional< compiled_regex > m_compiled_function_regexp
bool function_is_regexp() const
bool m_function_is_regexp
const std::string & function() const
bool do_skip_file_p(const symtab_and_line &function_sal) const
skiplist_entry(const skiplist_entry &)=delete
bool file_is_glob() const
void operator=(const skiplist_entry &)=delete
bool skip_file_p(const symtab_and_line &function_sal) const
struct cmd_list_element * cmdlist
struct cmd_list_element * showdebuglist
struct cmd_list_element * setdebuglist
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info(const char *name, cmd_simple_func_ftype *fun, const char *doc)
cli_style_option function_name_style
cli_style_option file_name_style
cli_style_option metadata_style
int number_is_in_list(const char *list, int number)
void location_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *)
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
frame_info_ptr get_selected_frame(const char *message)
static void skip_delete_command(const char *arg, int from_tty)
static void skip_function_command(const char *arg, int from_tty)
void _initialize_step_skip()
static int highest_skiplist_entry_num
static void complete_skip_number(cmd_list_element *cmd, completion_tracker &completer, const char *text, const char *word)
static void skip_function(const char *name)
static void info_skip_command(const char *arg, int from_tty)
static void skip_file_command(const char *arg, int from_tty)
static void skip_disable_command(const char *arg, int from_tty)
static void skip_enable_command(const char *arg, int from_tty)
static void skip_command(const char *arg, int from_tty)
static std::list< skiplist_entry > skiplist_entries
bool function_name_is_marked_for_skip(const char *function_name, const symtab_and_line &function_sal)
const char * symtab_to_fullname(struct symtab *s)
struct symtab * get_last_displayed_symtab(void)
const char * print_name() const
bool compare_glob_filenames_for_search(const char *filename, const char *search_name)
bool compare_filenames_for_search(const char *filename, const char *search_name)
bool basenames_may_differ
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
int gdb_filename_fnmatch(const char *pattern, const char *string, int flags)
void gdb_printf(struct ui_file *stream, const char *format,...)
int strcmp_iw(const char *string1, const char *string2)
void get_user_print_options(struct value_print_options *opts)