diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/cli-out.c | 3 | ||||
-rw-r--r-- | gdb/cli/cli-style.c | 11 | ||||
-rw-r--r-- | gdb/cli/cli-style.h | 3 | ||||
-rw-r--r-- | gdb/printcmd.c | 6 | ||||
-rw-r--r-- | gdb/stack.c | 2 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/style.exp | 3 | ||||
-rw-r--r-- | gdb/ui-out.h | 4 |
9 files changed, 42 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cb126ff..6a6a535 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 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. * utils.c (can_emit_style_escape): New function. (set_output_style): Use it. diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 4b5fc17..e1005e1 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -173,6 +173,9 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align, 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"); } 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; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 79c3d2d..dd16264 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -46,6 +46,7 @@ #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" @@ -2156,7 +2157,10 @@ print_variable_and_value (const char *name, struct symbol *var, 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; diff --git a/gdb/stack.c b/gdb/stack.c index b32bf8f..103b8c9 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -256,7 +256,7 @@ print_frame_arg (const struct frame_arg *arg) 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 ("="); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6b3ca5a..d27272d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 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. * gdb.base/style.c: New file. diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 20b7b8c..df66e99 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -34,8 +34,9 @@ save_vars { env(TERM) } { 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.*" } diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 8604105..93be9a9 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -75,7 +75,9 @@ enum class ui_out_style_kind /* File name. */ FILE, /* Function name. */ - FUNCTION + FUNCTION, + /* Variable name. */ + VARIABLE }; class ui_out |