From patchwork Sun Jun 16 20:38:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 33157 Received: (qmail 21667 invoked by alias); 16 Jun 2019 20:38:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 21605 invoked by uid 89); 16 Jun 2019 20:38:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:3883 X-HELO: mailsec115.isp.belgacom.be Received: from mailsec115.isp.belgacom.be (HELO mailsec115.isp.belgacom.be) (195.238.20.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Jun 2019 20:38:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1560717498; x=1592253498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JaEm9UXHzCnFb7+h9kUmj+f4VrahCqhkQM8yOxayr6o=; b=lj1N1qndRuU55mBPW3k0v1n9mt60/Hosmid2N4d3Qq6Iq87i1lOYT6Uq 7nBuywDztTfgGFKIUP5CkcqafFJukw==; Received: from 161.32-242-81.adsl-dyn.isp.belgacom.be (HELO md.home) ([81.242.32.161]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 16 Jun 2019 22:38:11 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 3/3] NEWS and documentation for info sources [-dirname | -basename] [--] [REGEXP]. Date: Sun, 16 Jun 2019 22:38:04 +0200 Message-Id: <20190616203804.26938-4-philippe.waroquiers@skynet.be> In-Reply-To: <20190616203804.26938-1-philippe.waroquiers@skynet.be> References: <20190616203804.26938-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/ChangeLog 2019-06-16 Philippe Waroquiers * NEWS: Mention changes to "info sources" command. gdb/doc/ChangeLog 2019-06-16 Philippe Waroquiers * 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(-) 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 -