AArch64: Add MOVPRFX tests and update testsuite
[deliverable/binutils-gdb.git] / gdb / skip.c
index 8db0cd5d12e6f6d63ea5b3fa0a1443ebe8420a3a..13db0f6b43c617d8495fe6edc45bf902dea323d5 100644 (file)
@@ -1,6 +1,6 @@
 /* Skipping uninteresting files and functions while stepping.
 
-   Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   Copyright (C) 2011-2018 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include "common/gdb_optional.h"
 #include <list>
 
+/* True if we want to print debug printouts related to file/function
+   skipping. */
+static int debug_skip = 0;
+
 class skiplist_entry
 {
 public:
@@ -161,7 +165,7 @@ skiplist_entry::add_entry (bool file_is_glob, std::string &&file,
 }
 
 static void
-skip_file_command (char *arg, int from_tty)
+skip_file_command (const char *arg, int from_tty)
 {
   struct symtab *symtab;
   const char *filename = NULL;
@@ -199,7 +203,7 @@ skip_function (const char *name)
 }
 
 static void
-skip_function_command (char *arg, int from_tty)
+skip_function_command (const char *arg, int from_tty)
 {
   /* Default to the current function if no argument is given.  */
   if (arg == NULL)
@@ -226,7 +230,7 @@ skip_function_command (char *arg, int from_tty)
 /* Process "skip ..." that does not match "skip file" or "skip function".  */
 
 static void
-skip_command (char *arg, int from_tty)
+skip_command (const char *arg, int from_tty)
 {
   const char *file = NULL;
   const char *gfile = NULL;
@@ -353,7 +357,7 @@ skip_command (char *arg, int from_tty)
 }
 
 static void
-info_skip_command (char *arg, int from_tty)
+info_skip_command (const char *arg, int from_tty)
 {
   int num_printable_entries = 0;
   struct value_print_options opts;
@@ -424,7 +428,7 @@ info_skip_command (char *arg, int from_tty)
 }
 
 static void
-skip_enable_command (char *arg, int from_tty)
+skip_enable_command (const char *arg, int from_tty)
 {
   bool found = false;
 
@@ -440,7 +444,7 @@ skip_enable_command (char *arg, int from_tty)
 }
 
 static void
-skip_disable_command (char *arg, int from_tty)
+skip_disable_command (const char *arg, int from_tty)
 {
   bool found = false;
 
@@ -456,7 +460,7 @@ skip_disable_command (char *arg, int from_tty)
 }
 
 static void
-skip_delete_command (char *arg, int from_tty)
+skip_delete_command (const char *arg, int from_tty)
 {
   bool found = false;
 
@@ -482,59 +486,77 @@ skip_delete_command (char *arg, int from_tty)
 bool
 skiplist_entry::do_skip_file_p (const symtab_and_line &function_sal) const
 {
+  if (debug_skip)
+    fprintf_unfiltered (gdb_stdlog,
+                       "skip: checking if file %s matches non-glob %s...",
+                       function_sal.symtab->filename, m_file.c_str ());
+
+  bool result;
+
   /* Check first sole SYMTAB->FILENAME.  It may not be a substring of
      symtab_to_fullname as it may contain "./" etc.  */
   if (compare_filenames_for_search (function_sal.symtab->filename,
                                    m_file.c_str ()))
-    return true;
+    result = true;
 
   /* Before we invoke realpath, which can get expensive when many
      files are involved, do a quick comparison of the basenames.  */
-  if (!basenames_may_differ
-      && filename_cmp (lbasename (function_sal.symtab->filename),
-                      lbasename (m_file.c_str ())) != 0)
-    return false;
+  else if (!basenames_may_differ
+          && filename_cmp (lbasename (function_sal.symtab->filename),
+                           lbasename (m_file.c_str ())) != 0)
+    result = false;
+  else
+    {
+      /* Note: symtab_to_fullname caches its result, thus we don't have to.  */
+      const char *fullname = symtab_to_fullname (function_sal.symtab);
 
-  /* Note: symtab_to_fullname caches its result, thus we don't have to.  */
-  {
-    const char *fullname = symtab_to_fullname (function_sal.symtab);
+      result = compare_filenames_for_search (fullname, m_file.c_str ());
+    }
 
-    if (compare_filenames_for_search (fullname, m_file.c_str ()))
-      return true;
-  }
+  if (debug_skip)
+    fprintf_unfiltered (gdb_stdlog, result ? "yes.\n" : "no.\n");
 
-  return false;
+  return result;
 }
 
 bool
 skiplist_entry::do_skip_gfile_p (const symtab_and_line &function_sal) const
 {
+  if (debug_skip)
+    fprintf_unfiltered (gdb_stdlog,
+                       "skip: checking if file %s matches glob %s...",
+                       function_sal.symtab->filename, m_file.c_str ());
+
+  bool result;
+
   /* Check first sole SYMTAB->FILENAME.  It may not be a substring of
      symtab_to_fullname as it may contain "./" etc.  */
   if (gdb_filename_fnmatch (m_file.c_str (), function_sal.symtab->filename,
                            FNM_FILE_NAME | FNM_NOESCAPE) == 0)
-    return true;
+    result = true;
 
   /* Before we invoke symtab_to_fullname, which is expensive, do a quick
      comparison of the basenames.
      Note that we assume that lbasename works with glob-style patterns.
      If the basename of the glob pattern is something like "*.c" then this
      isn't much of a win.  Oh well.  */
-  if (!basenames_may_differ
+  else if (!basenames_may_differ
       && gdb_filename_fnmatch (lbasename (m_file.c_str ()),
                               lbasename (function_sal.symtab->filename),
                               FNM_FILE_NAME | FNM_NOESCAPE) != 0)
-    return false;
+    result = false;
+  else
+    {
+      /* Note: symtab_to_fullname caches its result, thus we don't have to.  */
+      const char *fullname = symtab_to_fullname (function_sal.symtab);
 
-  /* Note: symtab_to_fullname caches its result, thus we don't have to.  */
-  {
-    const char *fullname = symtab_to_fullname (function_sal.symtab);
+      result = compare_glob_filenames_for_search (fullname, m_file.c_str ());
+    }
 
-    if (compare_glob_filenames_for_search (fullname, m_file.c_str ()))
-      return true;
-  }
+  if (debug_skip)
+    fprintf_unfiltered (gdb_stdlog, result ? "yes.\n" : "no.\n");
 
-  return false;
+  return result;
 }
 
 bool
@@ -558,14 +580,33 @@ skiplist_entry::skip_function_p (const char *function_name) const
   if (m_function.empty ())
     return false;
 
+  bool result;
+
   if (m_function_is_regexp)
     {
+      if (debug_skip)
+        fprintf_unfiltered (gdb_stdlog,
+                           "skip: checking if function %s matches regex %s...",
+                           function_name, m_function.c_str ());
+
       gdb_assert (m_compiled_function_regexp);
-      return (m_compiled_function_regexp->exec (function_name, 0, NULL, 0)
-             == 0);
+      result
+       = (m_compiled_function_regexp->exec (function_name, 0, NULL, 0) == 0);
     }
   else
-    return strcmp_iw (function_name, m_function.c_str ()) == 0;
+    {
+      if (debug_skip)
+        fprintf_unfiltered (gdb_stdlog,
+                           ("skip: checking if function %s matches non-regex "
+                            "%s..."),
+                           function_name, m_function.c_str ());
+      result = (strcmp_iw (function_name, m_function.c_str ()) == 0);
+    }
+
+  if (debug_skip)
+    fprintf_unfiltered (gdb_stdlog, result ? "yes.\n" : "no.\n");
+
+  return result;
 }
 
 /* See skip.h.  */
@@ -610,13 +651,13 @@ _initialize_step_skip (void)
 Ignore a function while stepping.\n\
 \n\
 Usage: skip [FUNCTION-NAME]\n\
-       skip [<file-spec>] [<function-spec>]\n\
+       skip [FILE-SPEC] [FUNCTION-SPEC]\n\
 If no arguments are given, ignore the current function.\n\
 \n\
-<file-spec> is one of:\n\
+FILE-SPEC is one of:\n\
        -fi|-file FILE-NAME\n\
        -gfi|-gfile GLOB-FILE-PATTERN\n\
-<function-spec> is one of:\n\
+FUNCTION-SPEC is one of:\n\
        -fu|-function FUNCTION-NAME\n\
        -rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
                   &skiplist, "skip ", 1, &cmdlist);
@@ -639,29 +680,39 @@ If no function name is given, skip the current function."),
 Enable skip entries.  You can specify numbers (e.g. \"skip enable 1 3\"), \
 ranges (e.g. \"skip enable 4-8\"), or both (e.g. \"skip enable 1 3 4-8\").\n\n\
 If you don't specify any numbers or ranges, we'll enable all skip entries.\n\n\
-Usage: skip enable [NUMBERS AND/OR RANGES]"),
+Usage: skip enable [NUMBER | RANGE]..."),
           &skiplist);
 
   add_cmd ("disable", class_breakpoint, skip_disable_command, _("\
 Disable skip entries.  You can specify numbers (e.g. \"skip disable 1 3\"), \
 ranges (e.g. \"skip disable 4-8\"), or both (e.g. \"skip disable 1 3 4-8\").\n\n\
 If you don't specify any numbers or ranges, we'll disable all skip entries.\n\n\
-Usage: skip disable [NUMBERS AND/OR RANGES]"),
+Usage: skip disable [NUMBER | RANGE]..."),
           &skiplist);
 
   add_cmd ("delete", class_breakpoint, skip_delete_command, _("\
 Delete skip entries.  You can specify numbers (e.g. \"skip delete 1 3\"), \
 ranges (e.g. \"skip delete 4-8\"), or both (e.g. \"skip delete 1 3 4-8\").\n\n\
 If you don't specify any numbers or ranges, we'll delete all skip entries.\n\n\
-Usage: skip delete [NUMBERS AND/OR RANGES]"),
+Usage: skip delete [NUMBER | RANGES]..."),
            &skiplist);
 
   add_info ("skip", info_skip_command, _("\
 Display the status of skips.  You can specify numbers (e.g. \"skip info 1 3\"), \
 ranges (e.g. \"skip info 4-8\"), or both (e.g. \"skip info 1 3 4-8\").\n\n\
 If you don't specify any numbers or ranges, we'll show all skips.\n\n\
-Usage: skip info [NUMBERS AND/OR RANGES]\n\
+Usage: skip info [NUMBER | RANGES]...\n\
 The \"Type\" column indicates one of:\n\
 \tfile        - ignored file\n\
 \tfunction    - ignored function"));
+
+  add_setshow_boolean_cmd ("skip", class_maintenance,
+                          &debug_skip, _("\
+Set whether to print the debug output about skipping files and functions."),
+                          _("\
+Show whether the debug output about skipping files and functions is printed"),
+                          _("\
+When non-zero, debug output about skipping files and functions is displayed."),
+                          NULL, NULL,
+                          &setdebuglist, &showdebuglist);
 }
This page took 0.030238 seconds and 4 git commands to generate.