From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [50.116.125.1]) by sourceware.org (Postfix) with ESMTPS id BB8123851C09 for ; Tue, 23 Jun 2020 13:20:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BB8123851C09 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 1A94758D19 for ; Tue, 23 Jun 2020 08:20:09 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id niqOjNURgSxZVniqPjXTDT; Tue, 23 Jun 2020 08:20:09 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CBnqpRPp6J9DVFNARQEauJHO2dsVPrm156T6ahpR1LY=; b=IRdvpeYozYGG3t7YxC/hJWmX+M crkVXvgR3nqAYurk6GsIHe3v8vJXetSnj+fekflLbkbmo85Gs7UdEHmk4K9ddTE6dGAySMte3bcJ4 +v+qRpN0IrQcNcT7EhmBJCFwG; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:45100 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jniqO-002fzZ-Pq; Tue, 23 Jun 2020 07:20:08 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 2/7] Add "help news" Date: Tue, 23 Jun 2020 07:20:01 -0600 Message-Id: <20200623132006.15863-3-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200623132006.15863-1-tom@tromey.com> References: <20200623132006.15863-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jniqO-002fzZ-Pq X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya.Home) [174.16.104.48]:45100 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3037.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 13:20:12 -0000 This adds a "help news" subcommand, which simply dumps the NEWS file. The NEWS file is now installed. gdb/ChangeLog 2020-06-22 Tom Tromey * NEWS: Add entry. * data-directory/Makefile.in (GDB_FILES): New variable. (all): Add gdb-files. (gdb-files, install-gdb-files, uninstall-gdb-files): New targets. (install-only, uninstall): Update. * cli/cli-decode.c (help_news): New file. (help_cmd): Handle "news". (help_list): Mention "help news". gdb/doc/ChangeLog 2020-06-22 Tom Tromey * gdb.texinfo (Help): Mention help news. --- gdb/ChangeLog | 11 +++++++++ gdb/NEWS | 3 +++ gdb/cli/cli-decode.c | 41 ++++++++++++++++++++++++++++++++++ gdb/data-directory/Makefile.in | 28 ++++++++++++++++++++--- gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdb.texinfo | 4 ++++ 6 files changed, 88 insertions(+), 3 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index f7585133c51..0fd39857326 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -65,6 +65,9 @@ * New commands +help news + Show this NEWS file. + set exec-file-mismatch -- Set exec-file-mismatch handling (ask|warn|off). show exec-file-mismatch -- Show exec-file-mismatch handling (ask|warn|off). Set or show the option 'exec-file-mismatch'. When GDB attaches to a diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 85f50aa8e48..c986a1c45fb 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1197,6 +1197,38 @@ apropos_cmd (struct ui_file *stream, } } +/* Implement "help news". */ + +static void +help_news (struct ui_file *stream) +{ + std::string news_name = std::string (gdb_datadir) + SLASH_STRING + "NEWS"; + gdb_file_up news_file = gdb_fopen_cloexec (news_name.c_str (), "r"); + if (news_file == nullptr) + perror_with_name (_("could not open the NEWS file")); + + char buffer[1024]; + size_t offset = 0; + while (true) + { + size_t nbytes = fread (&buffer[offset], 1, sizeof (buffer) - offset, + news_file.get ()); + if (nbytes == 0) + break; + size_t n_valid = offset + nbytes; + size_t newline; + for (newline = n_valid; newline > 0 && buffer[newline] != '\n'; --newline) + ; + if (newline == 0) + error (_("NEWS file is malformed")); + buffer[newline] = '\0'; + fputs_filtered (buffer, stream); + fputs_filtered ("\n", stream); + offset = n_valid - (newline + 1); + memmove (buffer, &buffer[newline + 1], offset); + } +} + /* This command really has to deal with two things: 1) I want documentation on *this string* (usually called by "help commandname"). @@ -1225,6 +1257,12 @@ help_cmd (const char *command, struct ui_file *stream) return; } + if (strcmp (command, "news") == 0) + { + help_news (stream); + return; + } + const char *orig_command = command; c = lookup_cmd (&command, cmdlist, "", NULL, 0, 0); @@ -1330,6 +1368,9 @@ Type \"help%s\" followed by a class name for a list of commands in ", fprintf_filtered (stream, "\n\ Type \"help all\" for the list of all commands."); + + fprintf_filtered (stream, "\n\ +Type \"help news\" to see what is new in GDB."); } fprintf_filtered (stream, "\nType \"help%s\" followed by %scommand name ", diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 3f0c729404b..85a2f41c351 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -139,6 +139,8 @@ SYSTEM_GDBINIT_FILES = \ elinos.py \ wrs-linux.py +GDB_FILES = NEWS + FLAGS_TO_PASS = \ "prefix=$(prefix)" \ "exec_prefix=$(exec_prefix)" \ @@ -172,7 +174,7 @@ FLAGS_TO_PASS = \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" .PHONY: all -all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit +all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit gdb-files %.xml: @MAINTAINER_MODE_TRUE@ %.xml.in apply-defaults.xsl linux-defaults.xml.in $(XSLTPROC) -o $(SYSCALLS_SRCDIR)/$@ $(SYSCALLS_SRCDIR)/apply-defaults.xsl\ @@ -234,6 +236,26 @@ uninstall-syscalls: done \ done +gdb-files: $(addprefix $(srcdir)/../,$(GDB_FILES)) + files='$(GDB_FILES)'; \ + for file in $$files; do \ + cp $(srcdir)/../$$file .; \ + done + +.PHONY: install-gdb-files +install-gdb-files: + files='$(GDB_FILES)'; \ + for file in $$files; do \ + $(INSTALL_DATA) $(srcdir)/../$$file $(DESTDIR)$(GDB_DATADIR); \ + done + +.PHONY: uninstall-gdb-files +uninstall-gdb-files: + files='$(GDB_FILES)'; \ + for file in $$files; do \ + rm -f $(DESTDIR)$(GDB_DATADIR)/$$file; \ + done + stamp-python: Makefile $(PYTHON_FILES) rm -rf ./$(PYTHON_DIR) files='$(PYTHON_FILES)' ; \ @@ -379,11 +401,11 @@ install: all .PHONY: install-only install-only: install-syscalls install-python install-guile \ - install-system-gdbinit + install-system-gdbinit install-news .PHONY: uninstall uninstall: uninstall-syscalls uninstall-python uninstall-guile \ - uninstall-system-gdbinit + uninstall-system-gdbinit uninstall-news .PHONY: clean clean: clean-syscalls clean-python clean-guile clean-system-gdbinit diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7f572c37c5c..37d5fe1e4cd 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2163,6 +2163,10 @@ the command name and all its aliases separated by commas. This first line will be followed by the full definition of all aliases having default arguments. +@item help news +Show the news file. Notable features in each release are documented +in this file. + @kindex apropos @item apropos [-v] @var{regexp} The @code{apropos} command searches through all of the @value{GDBN} -- 2.17.2