Remove some text from --version output
authorTom Tromey <tom@tromey.com>
Fri, 11 May 2018 18:21:03 +0000 (12:21 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 5 Jun 2018 17:47:50 +0000 (11:47 -0600)
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 <http://gnu.org/licenses/gpl.html>
    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:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    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 <http://gnu.org/licenses/gpl.html>
    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.

gdb/ChangeLog
2018-06-05  Tom Tromey  <tom@tromey.com>

* 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-06-05  Tom Tromey  <tom@tromey.com>

* gdb.base/default.exp: Update expected "show version" output.

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/main.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/default.exp
gdb/top.c
gdb/top.h

index 54205a6ea8503492713b86d0c2e0773d1073c628..682433f83571c10b9960c03d7211499871d49650 100644 (file)
@@ -1,3 +1,12 @@
+2018-06-05  Tom Tromey  <tom@tromey.com>
+
+       * 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-05  David Malcolm  <dmalcolm@redhat.com>
 
        * common/enum-flags.h: Add trailing semicolon to example in
index 95bd58ce545493dcbdc611cef0a6506c51f0b327..5c5d6dc4561446244f83234e6cff4f20098d83be 100644 (file)
@@ -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");
 }
 
index 189266f90e0e520073c68035c09b0851afd3f32e..9694af2426995769fff8aedcde26ecbf5edaa7b0 100644 (file)
@@ -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 ("");
index 951c8dbfa20edb1fbd8c27d06483735e19e62c1c..eea782f05ead41a42cd3873d4f090287cfa60fd6 100644 (file)
@@ -1,3 +1,7 @@
+2018-06-05  Tom Tromey  <tom@tromey.com>
+
+       * gdb.base/default.exp: Update expected "show version" output.
+
 2018-06-05  Tom Tromey <tom@tromey.com>
 
        PR cli/12326:
index 689d3abf932208e3445b4591499c0de7e5f47995..5c0dc781fd3fe3b22b9c78bdc1d8c7ae10bba60e 100644 (file)
@@ -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 <http://gnu.org/licenses/gpl.html>(\[^\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 <http://gnu.org/licenses/gpl.html>(\[^\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
index 07b386dacbab2e37644c7ffec648d16d9396111a..8e0a39494e1cc2226c1ee76b42e7a960e71012f6 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1278,9 +1278,9 @@ command_line_input (const char *prompt_arg, int repeat,
   return cmd;
 }
 \f
-/* 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 <http://gnu.org/licenses/gpl.html>\
 \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<http://www.gnu.org/software/gdb/documentation/>.\n"));
+resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."));
+  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\"."));
index d54b6f15c46282b51d2f275594aefefdff34ac78..b34defa1f2935433175dae6559cfc82c72dadac8 100644 (file)
--- 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 *);
This page took 0.039928 seconds and 4 git commands to generate.