]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Style the gdb welcome message
authorTom Tromey <tom@tromey.com>
Thu, 6 Sep 2018 20:44:17 +0000 (14:44 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 28 Dec 2018 19:49:51 +0000 (12:49 -0700)
This changes gdb to style the welcome message that is shown by
default.  The styling is only done interactively.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* top.c (print_gdb_version): Style gdb version number.

gdb/testsuite/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* gdb.base/style.exp: Add test for version number styling.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/style.exp
gdb/top.c

index aa98a94fb4b0ab1746cff4e3f48e2e653899145c..dd19b80f4f42538c804fc6345a8e314ef2bd97a3 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
+       * top.c (print_gdb_version): Style gdb version number.
+
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
        * printcmd.c (print_address_symbolic): Style function name.
index 78c8da4e45dc9eca837a24b82b932670f68f3cca..3d262d331f70bb5da02e122f2a8b6f927d73ba2a 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
+       * gdb.base/style.exp: Add test for version number styling.
+
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
        * gdb.base/style.exp: Add test for print_address_symbolic.
index 2978d82c053f5c6422b40139424055ad86ef76b3..b72c2ab1fa040f9b1324cfc448abe21510eac86e 100644 (file)
@@ -44,4 +44,10 @@ save_vars { env(TERM) } {
     gdb_test "break main" "file $base_file_expr.*"
 
     gdb_test "print &main" " = .* <$main_expr>"
+
+    gdb_exit
+    gdb_spawn
+
+    gdb_test "" "\033\\\[35;1mGNU gdb.*\033\\\[m.*" \
+       "version is styled"
 }
index 4884888bec4b2b7837dec20cf9c8ed8204bef569..4bcb4e28fbc7e48092be6644708575763013ba68 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1281,7 +1281,14 @@ print_gdb_version (struct ui_file *stream, bool interactive)
      program to parse, and is just canonical program name and version
      number, which starts after last space.  */
 
-  fprintf_filtered (stream, "GNU gdb %s%s\n", PKGVERSION, version);
+  ui_file_style style;
+  if (interactive)
+    {
+      ui_file_style nstyle = { ui_file_style::MAGENTA, ui_file_style::NONE,
+                              ui_file_style::BOLD };
+      style = nstyle;
+    }
+  fprintf_styled (stream, style, "GNU gdb %s%s\n", PKGVERSION, version);
 
   /* Second line is a copyright notice.  */