[2/3] Replace uses of "title" style with "command"
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Currently the "title" style is only used when printing command names.
The "title" name itself is probably a misnomer, but meanwhile this
patch changes the existing uses to instead use the new "command" style
for consistency.
The "title" style is not removed; see the next patch.
---
gdb/cli/cli-decode.c | 14 +++++++-------
gdb/cli/cli-script.c | 2 +-
gdb/testsuite/gdb.base/style.exp | 14 +++++++-------
gdb/testsuite/lib/gdb-utils.exp | 1 +
4 files changed, 16 insertions(+), 15 deletions(-)
Comments
Hi,
One tiny thing:
On 10/4/24 4:31 PM, Tom Tromey wrote:
> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index 09c39ed1d6abccaf656326fbb751f80275804aa3..8030ab105aa1d4ca783630c5da4ab837bdb55dcb 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1538,7 +1538,7 @@ fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
The comment preceding this function still mentions "title style".
> std::string prefixname
> = c.prefix == nullptr ? "" : c.prefix->prefixname ();
>
> - fprintf_styled (stream, title_style.style (), "%s%s",
> + fprintf_styled (stream, command_style.style (), "%s%s",
> prefixname.c_str (), c.name);
> }
Reviewed-By: Keith Seitz <keiths@redhat.com>
Keith
>> @@ -1538,7 +1538,7 @@ fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
Keith> The comment preceding this function still mentions "title style".
I fixed this in v2.
Tom
@@ -1538,7 +1538,7 @@ fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
std::string prefixname
= c.prefix == nullptr ? "" : c.prefix->prefixname ();
- fprintf_styled (stream, title_style.style (), "%s%s",
+ fprintf_styled (stream, command_style.style (), "%s%s",
prefixname.c_str (), c.name);
}
@@ -2506,21 +2506,21 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
if (cmd->cmd_deprecated)
gdb_printf (_("Warning: command '%ps' (%ps) is deprecated.\n"),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
tmp_cmd_str.c_str ()),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
tmp_alias_str.c_str ()));
else
gdb_printf (_("Warning: '%ps', an alias for the command '%ps', "
"is deprecated.\n"),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
tmp_alias_str.c_str ()),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
tmp_cmd_str.c_str ()));
}
else
gdb_printf (_("Warning: command '%ps' is deprecated.\n"),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
tmp_cmd_str.c_str ()));
/* Now display a second line indicating what the user should use instead.
@@ -2533,7 +2533,7 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
replacement = cmd->replacement;
if (replacement != nullptr)
gdb_printf (_("Use '%ps'.\n\n"),
- styled_string (title_style.style (),
+ styled_string (command_style.style (),
replacement));
else
gdb_printf (_("No alternative known.\n\n"));
@@ -1667,7 +1667,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
gdb_printf (stream, "User %scommand \"",
c->is_prefix () ? "prefix" : "");
- fprintf_styled (stream, title_style.style (), "%s%s",
+ fprintf_styled (stream, command_style.style (), "%s%s",
prefix, name);
gdb_printf (stream, "\":\n");
if (cmdlines)
@@ -238,8 +238,8 @@ proc run_style_tests { } {
"The ${address_style_expr} foreground color is: ${color}" \
"style name and style word styled using its own style in show style"
- set aliases_expr [limited_style ".*aliases.*" title]
- set breakpoints_expr [limited_style ".*breakpoints.*" title]
+ set aliases_expr [limited_style ".*aliases.*" command]
+ set breakpoints_expr [limited_style ".*breakpoints.*" command]
gdb_test "help" \
[multi_line \
"List of classes of commands:" \
@@ -248,10 +248,10 @@ proc run_style_tests { } {
"${breakpoints_expr} -- Making program stop at certain points\." \
".*" \
] \
- "help classes of commands styled with title"
+ "help classes of commands styled with command"
- set taas_expr [limited_style ".*taas.*" title]
- set tfaas_expr [limited_style ".*tfaas.*" title]
+ set taas_expr [limited_style ".*taas.*" command]
+ set tfaas_expr [limited_style ".*tfaas.*" command]
set cut_for_thre_expr [limited_style "cut for 'thre" highlight]
gdb_test "apropos -v cut for 'thre" \
[multi_line \
@@ -301,7 +301,7 @@ proc run_style_tests { } {
gdb_test_no_output "maintenance deprecate p \"new_p\"" \
"maintenance deprecate p \"new_p\" /1/"
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]'.*" \
+ "Warning: '[limited_style p command]', an alias for the command '[limited_style print command]', is deprecated.*Use '[limited_style new_p command]'.*" \
"p deprecated warning, with replacement"
# Check that the version string is styled in the output of 'show
@@ -503,7 +503,7 @@ with_test_prefix "all styles enabled" {
# Now, for each style in turn. Disable that style only and run the
# test again. Things in that style should NOT now be styled.
-foreach style { title file function highlight variable \
+foreach style { command title file function highlight variable \
address metadata } {
set currently_disabled_style $style
with_test_prefix "disable style $style" {
@@ -69,6 +69,7 @@ proc string_list_to_regexp { args } {
proc style {str style} {
switch -exact -- $style {
title { set style 1 }
+ command { set style 1 }
file { set style 32 }
function { set style 33 }
highlight { set style 31 }