[RFAv2,3/3] NEWS and documentation for info sources [-dirname | -basename] [--] [REGEXP].

Message ID 20190616203804.26938-4-philippe.waroquiers@skynet.be
State New, archived
Headers

Commit Message

Philippe Waroquiers June 16, 2019, 8:38 p.m. UTC
  gdb/ChangeLog
2019-06-16  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention changes to "info sources" command.

gdb/doc/ChangeLog
2019-06-16  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Symbols): Document new args -dirname and -basename
	of "info sources" command.
---
 gdb/NEWS                                |  9 +++++++++
 gdb/doc/gdb.texinfo                     |  9 +++++++++
 gdb/testsuite/gdb.base/info_sources.exp | 13 ++++++++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
  

Comments

Eli Zaretskii June 17, 2019, 2:32 a.m. UTC | #1
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Sun, 16 Jun 2019 22:38:04 +0200
> 
> +@item info sources [-dirname | -basename] [--] [@var{regexp}]
> +Like @samp{info sources}, but only print the names of the files
> +matching the provided @var{regexp}.
> +By default, the @var{regexp} is used to match anywhere in the filename.
> +If -dirname, only files having a dirname matching @var{regexp} are shown.
> +If -basename, only files having a basename matching @var{regexp} are shown.

"-dirname" and "-basename" should be in @code.

Otherwise the documentation is OK, thanks.
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index 2cc82e8656..b890b50ccd 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -102,6 +102,12 @@  apropos [-v] REGEXP
   of matching commands and to use the highlight style to mark
   the documentation parts matching REGEXP.
 
+info sources [-dirname | -basename] [--] [REGEXP]
+  This command has now optional arguments to only print the files
+  whose names match REGEXP.  The arguments -dirname and -basename
+  allow to restrict matching respectively to the dirname and basename
+  parts of the files.
+
 show style
   The "show style" and its subcommands are now styling
   a style name in their output using its own style, to help
@@ -177,6 +183,9 @@  maint show test-options-completion-result
       -past-main [on|off]
       -past-entry [on|off]
 
+  ** The new "info sources" options -dirname and -basename options
+     are using the standard '-OPT' infrastructure.
+
    All options above can also be abbreviated.  The argument of boolean
    (on/off) options can be 0/1 too, and also the argument is assumed
    "on" if omitted.  This allows writing compact command invocations,
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9a0320e5d8..6ec0a2c916 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18428,6 +18428,15 @@  Print the names of all source files in your program for which there is
 debugging information, organized into two lists: files whose symbols
 have already been read, and files whose symbols will be read when needed.
 
+@item info sources [-dirname | -basename] [--] [@var{regexp}]
+Like @samp{info sources}, but only print the names of the files
+matching the provided @var{regexp}.
+By default, the @var{regexp} is used to match anywhere in the filename.
+If -dirname, only files having a dirname matching @var{regexp} are shown.
+If -basename, only files having a basename matching @var{regexp} are shown.
+The matching is case-sensitive, except on operating systems that
+have case-insensitive filesystem (e.g., MS-Windows).
+
 @kindex info functions
 @item info functions [-q]
 Print the names and data types of all defined functions.
diff --git a/gdb/testsuite/gdb.base/info_sources.exp b/gdb/testsuite/gdb.base/info_sources.exp
index 76d9b7373b..0fe5fb68f1 100644
--- a/gdb/testsuite/gdb.base/info_sources.exp
+++ b/gdb/testsuite/gdb.base/info_sources.exp
@@ -73,17 +73,24 @@  test_info_sources "--" 1 1
 test_info_sources "info_sources" 1 1
 test_info_sources "gdb.base" 1 1
 
-# List both files with regexp matching the filename basenames:
+# List both files with regexp matching the filename basenames,
+# using various parts of the -basename option:
 test_info_sources "-b info_sources" 1 1
 test_info_sources "-b -- info_sources" 1 1
+test_info_sources "-ba info_sources" 1 1
+test_info_sources "-base -- info_sources" 1 1
+test_info_sources "-basena info_sources" 1 1
+test_info_sources "-basename -- info_sources" 1 1
 
 # List only the file with basename matching regexp:
 test_info_sources "-b base" 0 1
 
-# List the files with dirname matching regexp:
+# List the files with dirname matching regexp,
+# using various part of the -dirname option:
 test_info_sources "-d base" 1 1
+test_info_sources "-dir base" 1 1
+test_info_sources "-dirname base" 1 1
 
 # Test non matching regexp, with option terminator:
 test_info_sources "-b -- -d" 0 0
 test_info_sources "-d -- -d" 0 0
-