diff options
-rw-r--r-- | gdb/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/NEWS | 5 | ||||
-rw-r--r-- | gdb/cli/cli-style.c | 17 | ||||
-rw-r--r-- | gdb/cli/cli-style.h | 6 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 12 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/style.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb-utils.exp | 1 | ||||
-rw-r--r-- | gdb/top.c | 11 |
10 files changed, 74 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1836830..bbb00e4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,19 @@ 2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + PR cli/25956 + * NEWS: Mention new command. + * cli/cli-style.c: Add 'cli/cli-setshow.h' include. + (version_style): Define. + (cli_style_option::cli_style_option): Add intensity parameter, and + use as appropriate. + (_initialize_cli_style): Register version style set/show commands. + * cli/cli-style.h (cli_style_option): Add intensity parameter. + (version_style): Declare. + * top.c (print_gdb_version): Use version_stype, and styled_string + to print the GDB version string. + +2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + * utils.c (emit_style_escape): Only emit an escape sequence if the requested style is different than the current applied style. (fputs_maybe_filtered): Adjust the juggling of the wrap_style, and @@ -75,6 +75,11 @@ maintenance flush-symbol-cache 'maintenance flush register-cache' and 'maintenance flush symbol-cache' respectively. +set style version foreground COLOR +set style version background COLOR +set style version intensity VALUE + Control the styling of GDB's version number text. + *** Changes in GDB 10 * There are new feature names for ARC targets: "org.gnu.gdb.arc.core" diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index cbedd30..8b4b6b2 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -19,6 +19,7 @@ #include "defs.h" #include "cli/cli-cmds.h" +#include "cli/cli-setshow.h" #include "cli/cli-style.h" #include "source-cache.h" #include "observable.h" @@ -98,13 +99,19 @@ cli_style_option metadata_style ("metadata", ui_file_style::DIM); /* See cli-style.h. */ +cli_style_option version_style ("version", ui_file_style::MAGENTA, + ui_file_style::BOLD); + +/* See cli-style.h. */ + cli_style_option::cli_style_option (const char *name, - ui_file_style::basic_color fg) + ui_file_style::basic_color fg, + ui_file_style::intensity intensity) : changed (name), m_name (name), m_foreground (cli_colors[fg - ui_file_style::NONE]), m_background (cli_colors[0]), - m_intensity (cli_intensities[ui_file_style::NORMAL]) + m_intensity (cli_intensities[intensity]) { } @@ -382,4 +389,10 @@ TUI window that does have the focus."), &style_set_list, &style_show_list, true); + + version_style.add_setshow_commands (no_class, _("\ +Version string display styling.\n\ +Configure colors used to display the GDB version string."), + &style_set_list, &style_show_list, + false); } diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index cd51bf4..187e1d0 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -30,7 +30,8 @@ class cli_style_option public: /* Construct a CLI style option with a foreground color. */ - cli_style_option (const char *name, ui_file_style::basic_color fg); + cli_style_option (const char *name, ui_file_style::basic_color fg, + ui_file_style::intensity = ui_file_style::NORMAL); /* Construct a CLI style option with an intensity. */ cli_style_option (const char *name, ui_file_style::intensity i); @@ -124,6 +125,9 @@ extern cli_style_option tui_border_style; /* The border style of a TUI window that does have the focus. */ extern cli_style_option tui_active_border_style; +/* The style to use for the GDB version string. */ +extern cli_style_option version_style; + /* True if source styling is enabled. */ extern bool source_styling; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index be37ac4..8f0ae35 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,5 +1,10 @@ 2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + PR cli/25956 + * gdb.texinfo (Output Styling): Document version style. + +2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + * gdb.texinfo (Auto-loading extensions): Add additional cross references and move @menu to the end of the node. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f18b1c1..3e3c38d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -25788,6 +25788,18 @@ Control the styling of addresses. These are managed with the @code{set style address} family of commands. By default, this style's foreground color is blue. +@item version +Control the styling of @value{GDBN}'s version number text. By +default, this style's foreground color is magenta and it has bold +intensity. The version number is displayed in two places, the output +of @command{show version}, and when @value{GDBN} starts up. + +Currently the version string displayed at startup is printed before +@value{GDBN} has parsed any command line options, or parsed any +command files, so there is currently no way to control the styling of +this string. However, @value{GDBN}'s @code{--quiet} command line option +can be used to disable printing of the version string on startup. + @item title Control the styling of titles. These are managed with the @code{set style title} family of commands. By default, this style's diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6537bba..d6fa740 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + PR cli/25956 + * gdb.base/style.exp (run_style_tests): Add version string test. + (test_startup_version_string): Use version style name. + * lib/gdb-utils.exp (style): Handle version style name. + +2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com> + * gdb.base/style.exp (limited_style): New proc. (clean_restart_and_disable): New proc. (run_style_tests): New proc. Most of the old tests from this file diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 08cd635..0754c9d 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -270,6 +270,12 @@ proc run_style_tests { } { gdb_test "p 5" \ "Warning: '[limited_style p title]', an alias for the command '[limited_style print title]', is deprecated.*Use '[limited_style new_p title]'.*" \ "p deprecated warning, with replacement" + + # Check that the version string is styled in the output of 'show + # version', and that this styling can be disabled. + set vers [style "GNU gdb.*" version] + gdb_test "show version" "${vers}.*" \ + "version is styled in 'show version'" } } @@ -282,7 +288,7 @@ proc test_startup_version_string { } { # Deliberate use of base STYLE proc here as the style of the # startup version string can't (currently) be controlled. - set vers [style "GNU gdb.*" "35;1"] + set vers [style "GNU gdb.*" version] gdb_test "" "${vers}.*" "version is styled at startup" } diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp index 000e380..ad7d288 100644 --- a/gdb/testsuite/lib/gdb-utils.exp +++ b/gdb/testsuite/lib/gdb-utils.exp @@ -55,6 +55,7 @@ proc style {str style} { variable { set style 36 } address { set style 34 } metadata { set style 2 } + version { set style "35;1" } } return "\033\\\[${style}m${str}\033\\\[m" } @@ -1391,14 +1391,9 @@ 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. */ - 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); + std::string v_str = string_printf ("GNU gdb %s%s", PKGVERSION, version); + fprintf_filtered (stream, "%ps\n", + styled_string (version_style.style (), v_str.c_str ())); /* Second line is a copyright notice. */ |