+2018-12-28 Tom Tromey <tom@tromey.com>
+
+ * ui-out.h (enum class ui_out_style_kind) <VARIABLE>: New global.
+ * stack.c (print_frame_arg): Style name.
+ * printcmd.c (print_variable_and_value): Style variable name.
+ * cli/cli-style.h (variable_name_style): Declare.
+ * cli/cli-style.c (variable_name_style): New global.
+ (_initialize_cli_style): Update.
+ * cli-out.c (cli_ui_out::do_field_string): Update.
+
2018-12-28 Tom Tromey <tom@tromey.com>
* utils.h (reset_terminal_style): Declare.
case ui_out_style_kind::FUNCTION:
fstyle = function_name_style.style ();
break;
+ case ui_out_style_kind::VARIABLE:
+ fstyle = variable_name_style.style ();
+ break;
default:
gdb_assert_not_reached ("missing case");
}
/* See cli-style.h. */
+cli_style_option variable_name_style (ui_file_style::CYAN);
+
+/* See cli-style.h. */
+
cli_style_option::cli_style_option (ui_file_style::basic_color fg)
: m_foreground (cli_colors[fg - ui_file_style::NONE]),
m_background (cli_colors[0]),
"style function",
&style_set_list,
&style_show_list);
+ variable_name_style.add_setshow_commands ("variable", no_class,
+ "style variable",
+ _("\
+Variable name display styling\n\
+Configure variable name colors and display intensity"),
+ &style_set_list,
+ &style_show_list);
}
/* The function name style. */
extern cli_style_option function_name_style;
+/* The variable name style. */
+extern cli_style_option variable_name_style;
+
/* True if styling is enabled. */
extern int cli_styling;
#include "arch-utils.h"
#include "cli/cli-utils.h"
#include "cli/cli-script.h"
+#include "cli/cli-style.h"
#include "format.h"
#include "source.h"
#include "common/byte-vector.h"
if (!name)
name = SYMBOL_PRINT_NAME (var);
- fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
+ fputs_filtered (n_spaces (2 * indent), stream);
+ fputs_styled (name, variable_name_style.style (), stream);
+ fputs_filtered (" = ", stream);
+
TRY
{
struct value *val;
if (arg->entry_kind == print_entry_values_only
|| arg->entry_kind == print_entry_values_compact)
stb.puts ("@entry");
- uiout->field_stream ("name", stb);
+ uiout->field_stream ("name", stb, ui_out_style_kind::VARIABLE);
annotate_arg_name_end ();
uiout->text ("=");
+2018-12-28 Tom Tromey <tom@tromey.com>
+
+ * gdb.base/style.exp: Add test for variable names.
+
2018-12-28 Tom Tromey <tom@tromey.com>
* gdb.base/style.exp: New file.
set main_expr "\033\\\[33mmain\033\\\[m"
set file_expr "\033\\\[32m.*style\\.c\033\\\[m:\[0-9\]"
+ set arg_expr "\033\\\[36marg.\033\\\[m"
gdb_test "frame" \
- "$main_expr.*$file_expr.*"
+ "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
gdb_test "info breakpoints" "$main_expr at $file_expr.*"
}
/* File name. */
FILE,
/* Function name. */
- FUNCTION
+ FUNCTION,
+ /* Variable name. */
+ VARIABLE
};
class ui_out