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.
This commit is contained in:
Tom Tromey 2018-09-06 14:44:17 -06:00
parent af79b68d7f
commit d47032b7ca
4 changed files with 22 additions and 1 deletions

View 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.

View 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.

View 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"
}

View File

@ -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. */