This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Style the gdb welcome message
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 28 Dec 2018 21:00:08 -0000
- Subject: [binutils-gdb] Style the gdb welcome message
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d47032b7ca85852acb1d2bc645f477ffee4373fc
commit d47032b7ca85852acb1d2bc645f477ffee4373fc
Author: Tom Tromey <tom@tromey.com>
Date: Thu Sep 6 14:44:17 2018 -0600
Style the gdb welcome message
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.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.base/style.exp | 6 ++++++
gdb/top.c | 9 ++++++++-
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aa98a94..dd19b80 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
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.
2018-12-28 Tom Tromey <tom@tromey.com>
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 78c8da4..3d262d3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
2018-12-28 Tom Tromey <tom@tromey.com>
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 2978d82..b72c2ab 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -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"
}
diff --git a/gdb/top.c b/gdb/top.c
index 4884888..4bcb4e2 100644
--- 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. */