* [PATCH] Add debug output for the skip feature @ 2018-09-11 11:04 Simon Marchi 2018-09-11 11:16 ` Pedro Alves 0 siblings, 1 reply; 6+ messages in thread From: Simon Marchi @ 2018-09-11 11:04 UTC (permalink / raw) To: gdb-patches; +Cc: Simon Marchi While trying to create skips for libstdc++, I found myself debugging GDB quite a bit, mostly to find out what the exact function name to match is. I thought it would make sense to have this information as debug output. This patch adds "set debug skip on|off". gdb/ChangeLog: * skip.c (debug_skip): New variable. (skiplist_entry::do_skip_file_p): Add debug output. (skiplist_entry::do_skip_gfile_p): Likewise. (skiplist_entry::skip_function_p): Likewise. (_initialize_step_skip): Create debug command. --- gdb/skip.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 25 deletions(-) diff --git a/gdb/skip.c b/gdb/skip.c index 7a6f2e7..0efa8de 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -37,6 +37,10 @@ #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: @@ -482,59 +486,77 @@ skip_delete_command (const 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. */ @@ -664,4 +705,12 @@ 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 skip files/functions debugging."), _("\ +Show skip files/functions debugging."), _("\ +When non-zero, debugging output for skipping files/functions is displayed."), + NULL, NULL, + &setdebuglist, &showdebuglist); } -- 2.7.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add debug output for the skip feature 2018-09-11 11:04 [PATCH] Add debug output for the skip feature Simon Marchi @ 2018-09-11 11:16 ` Pedro Alves 2018-09-12 13:10 ` Simon Marchi 2018-09-12 13:12 ` [PATCH v2 (doc)] " Simon Marchi 0 siblings, 2 replies; 6+ messages in thread From: Pedro Alves @ 2018-09-11 11:16 UTC (permalink / raw) To: Simon Marchi, gdb-patches On 09/11/2018 12:03 PM, Simon Marchi wrote: > While trying to create skips for libstdc++, I found myself debugging GDB > quite a bit, mostly to find out what the exact function name to match > is. I thought it would make sense to have this information as debug > output. > > This patch adds "set debug skip on|off". Needs manual/NEWS changes. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add debug output for the skip feature 2018-09-11 11:16 ` Pedro Alves @ 2018-09-12 13:10 ` Simon Marchi 2018-09-12 13:12 ` [PATCH v2 (doc)] " Simon Marchi 1 sibling, 0 replies; 6+ messages in thread From: Simon Marchi @ 2018-09-12 13:10 UTC (permalink / raw) To: Pedro Alves; +Cc: Simon Marchi, gdb-patches On 2018-09-11 07:16, Pedro Alves wrote: > On 09/11/2018 12:03 PM, Simon Marchi wrote: >> While trying to create skips for libstdc++, I found myself debugging >> GDB >> quite a bit, mostly to find out what the exact function name to match >> is. I thought it would make sense to have this information as debug >> output. >> >> This patch adds "set debug skip on|off". > > Needs manual/NEWS changes. Damn, I really need a git send-email hook that asks me whether my patch needs a manual or NEWS update. Thanks for reminding me. Simon ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 (doc)] Add debug output for the skip feature 2018-09-11 11:16 ` Pedro Alves 2018-09-12 13:10 ` Simon Marchi @ 2018-09-12 13:12 ` Simon Marchi 2018-09-12 14:25 ` Eli Zaretskii 1 sibling, 1 reply; 6+ messages in thread From: Simon Marchi @ 2018-09-12 13:12 UTC (permalink / raw) To: gdb-patches; +Cc: Simon Marchi While trying to create skips for libstdc++, I found myself debugging GDB quite a bit, mostly to find out what the exact function name to match is. I thought it would make sense to have this information as debug output. This patch adds "set debug skip on|off". gdb/ChangeLog: * skip.c (debug_skip): New variable. (skiplist_entry::do_skip_file_p): Add debug output. (skiplist_entry::do_skip_gfile_p): Likewise. (skiplist_entry::skip_function_p): Likewise. (_initialize_step_skip): Create debug command. * NEWS: Mention set/show debug skip. gdb/doc/ChangeLog: * gdb.texinfo (Skipping Over Functions and Files): Document set/show debug skip. --- gdb/NEWS | 5 +++ gdb/doc/gdb.texinfo | 8 ++++ gdb/skip.c | 100 +++++++++++++++++++++++++++++++++----------- 3 files changed, 88 insertions(+), 25 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 75436b0fc32..4e4f12d8d13 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -29,6 +29,11 @@ show debug compile-cplus-types C++ compile feature. Commands have no effect while compiliong for other languages. +set debug skip +show debug skip + Control whether debug output about files/functions skipping is + displayed. + frame apply [all | COUNT | -COUNT | level LEVEL...] [FLAG]... COMMAND Apply a command to some frames. FLAG arguments allow to control what output to produce and how to handle diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 1d96c68d830..5e039734c41 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5895,6 +5895,14 @@ skips. Disable the specified skip(s). If @var{range} is not specified, disable all skips. +@kindex set debug skip +@item set debug skip @r{[}on|off@r{]} +Set whether to print the debug output about the skip feature. + +@kindex show debug skip +@item show debug skip +Show whether the debug output about the skip feature is shown. + @end table @node Signals diff --git a/gdb/skip.c b/gdb/skip.c index 7a6f2e712b9..361590bf5b2 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -37,6 +37,10 @@ #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: @@ -482,59 +486,77 @@ skip_delete_command (const 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. */ @@ -664,4 +705,13 @@ 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 debug output about skipping files/functions should be displayed."), + _("\ +Show whether debug output about skipping files/functions is displayed."), _("\ +When non-zero, debug output for skipping files/functions is displayed."), + NULL, NULL, + &setdebuglist, &showdebuglist); } -- 2.19.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 (doc)] Add debug output for the skip feature 2018-09-12 13:12 ` [PATCH v2 (doc)] " Simon Marchi @ 2018-09-12 14:25 ` Eli Zaretskii 2018-09-12 16:27 ` Simon Marchi 0 siblings, 1 reply; 6+ messages in thread From: Eli Zaretskii @ 2018-09-12 14:25 UTC (permalink / raw) To: Simon Marchi; +Cc: gdb-patches > From: Simon Marchi <simon.marchi@ericsson.com> > CC: Simon Marchi <simon.marchi@ericsson.com> > Date: Wed, 12 Sep 2018 09:11:10 -0400 > > diff --git a/gdb/NEWS b/gdb/NEWS > index 75436b0fc32..4e4f12d8d13 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -29,6 +29,11 @@ show debug compile-cplus-types > C++ compile feature. Commands have no effect while compiliong > for other languages. > > +set debug skip > +show debug skip > + Control whether debug output about files/functions skipping is > + displayed. > + This is OK. > +@kindex set debug skip > +@item set debug skip @r{[}on|off@r{]} > +Set whether to print the debug output about the skip feature. > + > +@kindex show debug skip > +@item show debug skip > +Show whether the debug output about the skip feature is shown. Here' I'd suggest to say "about skipping files and functions" instead of "skip feature". Otherwise, OK. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 (doc)] Add debug output for the skip feature 2018-09-12 14:25 ` Eli Zaretskii @ 2018-09-12 16:27 ` Simon Marchi 0 siblings, 0 replies; 6+ messages in thread From: Simon Marchi @ 2018-09-12 16:27 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches On 2018-09-12 10:25 AM, Eli Zaretskii wrote: >> From: Simon Marchi <simon.marchi@ericsson.com> >> CC: Simon Marchi <simon.marchi@ericsson.com> >> Date: Wed, 12 Sep 2018 09:11:10 -0400 >> >> diff --git a/gdb/NEWS b/gdb/NEWS >> index 75436b0fc32..4e4f12d8d13 100644 >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -29,6 +29,11 @@ show debug compile-cplus-types >> C++ compile feature. Commands have no effect while compiliong >> for other languages. >> >> +set debug skip >> +show debug skip >> + Control whether debug output about files/functions skipping is >> + displayed. >> + > > This is OK. > >> +@kindex set debug skip >> +@item set debug skip @r{[}on|off@r{]} >> +Set whether to print the debug output about the skip feature. >> + >> +@kindex show debug skip >> +@item show debug skip >> +Show whether the debug output about the skip feature is shown. > > Here' I'd suggest to say "about skipping files and functions" instead > of "skip feature". > > Otherwise, OK. > Thanks. I've done that and pushed the patch below. Simon From 3e68067fb2d59ea93ea95d713a6c27b635332912 Mon Sep 17 00:00:00 2001 From: Simon Marchi <simon.marchi@ericsson.com> Date: Wed, 12 Sep 2018 12:24:41 -0400 Subject: [PATCH] Add debug output about skipping files and functions While trying to create skips for libstdc++, I found myself debugging GDB quite a bit, mostly to find out what the exact function name to match is. I thought it would make sense to have this information as debug output. This patch adds "set debug skip on|off". gdb/ChangeLog: * skip.c (debug_skip): New variable. (skiplist_entry::do_skip_file_p): Add debug output. (skiplist_entry::do_skip_gfile_p): Likewise. (skiplist_entry::skip_function_p): Likewise. (_initialize_step_skip): Create debug command. * NEWS: Mention set/show debug skip. gdb/doc/ChangeLog: * gdb.texinfo (Skipping Over Functions and Files): Document set/show debug skip. --- gdb/ChangeLog | 9 ++++ gdb/NEWS | 5 +++ gdb/doc/ChangeLog | 5 +++ gdb/doc/gdb.texinfo | 8 ++++ gdb/skip.c | 101 +++++++++++++++++++++++++++++++++----------- 5 files changed, 103 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5f8480548e9..d751253b9a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2018-09-12 Simon Marchi <simon.marchi@ericsson.com> + + * skip.c (debug_skip): New variable. + (skiplist_entry::do_skip_file_p): Add debug output. + (skiplist_entry::do_skip_gfile_p): Likewise. + (skiplist_entry::skip_function_p): Likewise. + (_initialize_step_skip): Create debug command. + * NEWS: Mention set/show debug skip. + 2018-09-11 Xavier Roirand <roirand@adacore.com> * darwin-nat.c (should_disable_startup_with_shell): diff --git a/gdb/NEWS b/gdb/NEWS index 75436b0fc32..4e4f12d8d13 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -29,6 +29,11 @@ show debug compile-cplus-types C++ compile feature. Commands have no effect while compiliong for other languages. +set debug skip +show debug skip + Control whether debug output about files/functions skipping is + displayed. + frame apply [all | COUNT | -COUNT | level LEVEL...] [FLAG]... COMMAND Apply a command to some frames. FLAG arguments allow to control what output to produce and how to handle diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 04e8250894b..f04dca42835 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2018-09-12 Simon Marchi <simon.marchi@ericsson.com> + + * gdb.texinfo (Skipping Over Functions and Files): Document + set/show debug skip. + 2018-09-10 Tom Tromey <tom@tromey.com> * python.texi (Frames In Python, Blocks In Python) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 1d96c68d830..efbec3debff 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5895,6 +5895,14 @@ skips. Disable the specified skip(s). If @var{range} is not specified, disable all skips. +@kindex set debug skip +@item set debug skip @r{[}on|off@r{]} +Set whether to print the debug output about skipping files and functions. + +@kindex show debug skip +@item show debug skip +Show whether the debug output about skipping files and functions is printed. + @end table @node Signals diff --git a/gdb/skip.c b/gdb/skip.c index 7a6f2e712b9..13db0f6b43c 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -37,6 +37,10 @@ #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: @@ -482,59 +486,77 @@ skip_delete_command (const 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. */ @@ -664,4 +705,14 @@ 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); } -- 2.19.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-12 16:27 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-09-11 11:04 [PATCH] Add debug output for the skip feature Simon Marchi 2018-09-11 11:16 ` Pedro Alves 2018-09-12 13:10 ` Simon Marchi 2018-09-12 13:12 ` [PATCH v2 (doc)] " Simon Marchi 2018-09-12 14:25 ` Eli Zaretskii 2018-09-12 16:27 ` Simon Marchi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox