aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-05 12:12:19 -0600
committerTom Tromey <tom@tromey.com>2018-12-28 12:49:50 -0700
commit80ae204359b707f2914132ed353d3cecbdb58b23 (patch)
tree2a4f186210a4bf37fb70da090546abc2401cb34f /gdb/cli
parentef1dfa3644f02efffa11d718fe5788c05177587b (diff)
downloadbinutils-80ae204359b707f2914132ed353d3cecbdb58b23.zip
binutils-80ae204359b707f2914132ed353d3cecbdb58b23.tar.gz
binutils-80ae204359b707f2914132ed353d3cecbdb58b23.tar.bz2
Style variable names
This adds style support for variable names. For the time being, this is only done in backtraces, not in ptype or print; those places do not use ui-out and so would need ad hoc changes. This also adds styling to the names printed for local variables in "backtrace full". This code does not use ui-out, so the styling is done using the low-level API. gdb/ChangeLog 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. gdb/testsuite/ChangeLog 2018-12-28 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Add test for variable names.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-style.c11
-rw-r--r--gdb/cli/cli-style.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index 9f16824..929f18f 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -62,6 +62,10 @@ cli_style_option function_name_style (ui_file_style::YELLOW);
/* 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]),
@@ -254,4 +258,11 @@ Configure function name colors and display intensity"),
"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);
}
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index 7d5370c..80ba7bf 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -83,6 +83,9 @@ extern cli_style_option file_name_style;
/* 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;