From patchwork Mon Jun 4 20:24:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27620 Received: (qmail 88171 invoked by alias); 4 Jun 2018 20:24:50 -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 76844 invoked by uid 89); 4 Jun 2018 20:24:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=interactive, happened, slowly, off* X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.101) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Jun 2018 20:24:30 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id AC8D4169EA for ; Mon, 4 Jun 2018 15:24:06 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id Pw1Ofu7TIPvAdPw1Of7KsI; Mon, 04 Jun 2018 15:24:06 -0500 X-Authority-Reason: nr=8 Received: from 75-166-37-59.hlrn.qwest.net ([75.166.37.59]:60124 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fPw1O-00445S-0L; Mon, 04 Jun 2018 15:24:06 -0500 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Remove some text from --version output References: <20180511194008.16382-1-tom@tromey.com> <9ad3f1be-2532-b57f-3423-6a7bd7e8dafe@redhat.com> Date: Mon, 04 Jun 2018 14:24:03 -0600 In-Reply-To: <9ad3f1be-2532-b57f-3423-6a7bd7e8dafe@redhat.com> (Pedro Alves's message of "Wed, 16 May 2018 18:17:16 +0100") Message-ID: <87in6yl2qk.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fPw1O-00445S-0L X-Source-Sender: 75-166-37-59.hlrn.qwest.net (pokyo) [75.166.37.59]:60124 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes >>>>> "Pedro" == Pedro Alves writes: Pedro> I'd even support removing everything after the "NO WARRANTY" line. [...] How about this? Tom commit 791745aebaf8bf547b32c54f774d2495d86b3362 Author: Tom Tromey Date: Fri May 11 12:21:03 2018 -0600 Remove some text from --version output I happened to notice recently that "gdb --version" says: GNU gdb (GDB) 8.0.50.20170911-git Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". This is a bit on the wordy side, but also references interactive commands, which I think doesn't really make sense for --version. This patch removes some text from --version, while leaving it in the "show version" output. It also adds a newline between the URLs and the "For help, ..." text, because I thought that was easier to read. Finally, it indents one of the URLs, since that was simpler to read, but not the other URL, because the current format is specified by the GNU coding standards section on "--version". Now the --version output looks like: GNU gdb (GDB) 8.1.50.20180511-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Tested by the buildbot. 2018-05-11 Tom Tromey * cli/cli-cmds.c (show_version): Update. * top.c (print_gdb_version): Add "interactive" parameter. Update. * main.c (captured_main_1): Update. * top.h (print_gdb_version): Add "interactive" parameter and a comment. gdb/testsuite/ChangeLog 2018-05-11 Tom Tromey * gdb.base/default.exp: Update expected "show version" output. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0c43027d6e..c31de820b8d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2018-05-11 Tom Tromey + + * cli/cli-cmds.c (show_version): Update. + * top.c (print_gdb_version): Add "interactive" parameter. + Update. + * main.c (captured_main_1): Update. + * top.h (print_gdb_version): Add "interactive" parameter and a + comment. + 2018-06-04 Simon Marchi * Makefile.in (config.status): Add configure.nat as a diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 95bd58ce545..5c5d6dc4561 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -315,7 +315,7 @@ is_complete_command (struct cmd_list_element *c) static void show_version (const char *args, int from_tty) { - print_gdb_version (gdb_stdout); + print_gdb_version (gdb_stdout, true); printf_filtered ("\n"); } diff --git a/gdb/main.c b/gdb/main.c index 189266f90e0..9694af24269 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -918,7 +918,7 @@ captured_main_1 (struct captured_main_args *context) if (print_version) { - print_gdb_version (gdb_stdout); + print_gdb_version (gdb_stdout, false); wrap_here (""); printf_filtered ("\n"); exit (0); @@ -947,7 +947,7 @@ captured_main_1 (struct captured_main_args *context) { /* Print all the junk at the top, with trailing "..." if we are about to read a symbol file (possibly slowly). */ - print_gdb_version (gdb_stdout); + print_gdb_version (gdb_stdout, true); if (symarg) printf_filtered (".."); wrap_here (""); @@ -968,7 +968,7 @@ captured_main_1 (struct captured_main_args *context) { /* Print all the junk at the top, with trailing "..." if we are about to read a symbol file (possibly slowly). */ - print_gdb_version (gdb_stdout); + print_gdb_version (gdb_stdout, true); if (symarg) printf_filtered (".."); wrap_here (""); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8cef172a26d..79b0a9e8141 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-05-11 Tom Tromey + + * gdb.base/default.exp: Update expected "show version" output. + 2018-06-01 Joel Brobecker * gdb.ada/bp_fun_addr: New testcase. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 689d3abf932..5c0dc781fd3 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -686,7 +686,7 @@ gdb_test_no_output "show values" "show values" #test show verbose gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose" #test show version -gdb_test "show version" "GNU gdb \[0-9\.\]*(\[^\r\n\]*\[\r\n\])+Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc(\[^\r\n\]*\[\r\n\])+License GPLv3\\+: GNU GPL version 3 or later (\[^\r\n\]*\[\r\n\])+This is free software: you are free to change and redistribute it.(\[^\r\n\]*\[\r\n\])+There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"(\[^\r\n\]*\[\r\n\])+and \"show warranty\" for details..*" "show version" +gdb_test "show version" "GNU gdb \[0-9\.\]*(\[^\r\n\]*\[\r\n\])+Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc(\[^\r\n\]*\[\r\n\])+License GPLv3\\+: GNU GPL version 3 or later (\[^\r\n\]*\[\r\n\])+This is free software: you are free to change and redistribute it.(\[^\r\n\]*\[\r\n\])+There is NO WARRANTY, to the extent permitted by law.(\[^\r\n\]*\[\r\n\])+Type \"show copying\" and \"show warranty\" for details..*" "show version" #test show width gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width" #test show write diff --git a/gdb/top.c b/gdb/top.c index 07b386dacba..8e0a39494e1 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1278,9 +1278,9 @@ command_line_input (const char *prompt_arg, int repeat, return cmd; } -/* Print the GDB banner. */ +/* See top.h. */ void -print_gdb_version (struct ui_file *stream) +print_gdb_version (struct ui_file *stream, bool interactive) { /* From GNU coding standards, first line is meant to be easy for a program to parse, and is just canonical program name and version @@ -1301,8 +1301,13 @@ print_gdb_version (struct ui_file *stream) fprintf_filtered (stream, "\ License GPLv3+: GNU GPL version 3 or later \ \nThis is free software: you are free to change and redistribute it.\n\ -There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n\ -and \"show warranty\" for details.\n"); +There is NO WARRANTY, to the extent permitted by law."); + + if (!interactive) + return; + + fprintf_filtered (stream, ("\nType \"show copying\" and " + "\"show warranty\" for details.\n")); /* After the required info we print the configuration information. */ @@ -1316,18 +1321,21 @@ and \"show warranty\" for details.\n"); { fprintf_filtered (stream, "%s", host_name); } - fprintf_filtered (stream, "\".\n\ -Type \"show configuration\" for configuration details."); + fprintf_filtered (stream, "\".\n"); + + fprintf_filtered (stream, _("Type \"show configuration\" " + "for configuration details.\n")); if (REPORT_BUGS_TO[0]) { fprintf_filtered (stream, - _("\nFor bug reporting instructions, please see:\n")); + _("For bug reporting instructions, please see:\n")); fprintf_filtered (stream, "%s.\n", REPORT_BUGS_TO); } fprintf_filtered (stream, _("Find the GDB manual and other documentation \ -resources online at:\n.\n")); +resources online at:\n .")); + fprintf_filtered (stream, "\n\n"); fprintf_filtered (stream, _("For help, type \"help\".\n")); fprintf_filtered (stream, _("Type \"apropos word\" to search for \ commands related to \"word\".")); diff --git a/gdb/top.h b/gdb/top.h index d54b6f15c46..b34defa1f29 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -222,7 +222,13 @@ extern int confirm; extern int inhibit_gdbinit; extern const char gdbinit[]; -extern void print_gdb_version (struct ui_file *); +/* Print the GDB version banner to STREAM. If INTERACTIVE is false, + then information referring to commands (e.g., "show configuration") + is omitted; this mode is used for the --version command line + option. If INTERACTIVE is true, then interactive commands are + mentioned. */ +extern void print_gdb_version (struct ui_file *stream, bool interactive); + extern void print_gdb_configuration (struct ui_file *); extern void read_command_file (FILE *);