diff options
Diffstat (limited to 'gdb')
43 files changed, 331 insertions, 127 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 514a8bd..9494dc4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,73 @@ 2019-10-01 Tom Tromey <tom@tromey.com> + * p-lang.c (pascal_printstr): Use metadata style. + * value.c (show_convenience): Use metadata style. + * valprint.c (valprint_check_validity, val_print_optimized_out) + (val_print_not_saved, val_print_unavailable) + (val_print_invalid_address, generic_val_print, val_print) + (value_check_printable, val_print_array_elements): Use metadata + style. + * ui-out.h (class ui_out) <field_fmt>: New overload. + <do_field_fmt>: Add style parameter. + * ui-out.c (ui_out::field_fmt): New overload. + * typeprint.c (type_print_unknown_return_type) + (val_print_not_allocated, val_print_not_associated): Use metadata + style. + * tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style + parameter. + * tui/tui-out.c (tui_ui_out::do_field_fmt): Update. + * tracepoint.c (tvariables_info_1): Use metadata style. + * stack.c (print_frame_arg, print_frame_info, print_frame) + (info_frame_command_core): Use metadata style. + * skip.c (info_skip_command): Use metadata style. + * rust-lang.c (rust_print_enum): Use metadata style. + * python/py-prettyprint.c (print_stack_unless_memory_error): Use + metadata style. + * python/py-framefilter.c (py_print_single_arg): Use metadata + style. + * printcmd.c (do_one_display, print_variable_and_value): Use + metadata style. + * p-valprint.c (pascal_val_print) + (pascal_object_print_value_fields): Use metadata style. + * p-typeprint.c (pascal_type_print_base): Use metadata style. + * mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style + parameter. + * mi/mi-out.c (mi_ui_out::do_field_fmt): Update. + * m2-valprint.c (m2_print_long_set): Use metadata style. + * m2-typeprint.c (m2_print_type): Use metadata style. + * infcmd.c (print_return_value_1): Use metadata style. + * gnu-v3-abi.c (print_one_vtable): Use metadata style. + * f-valprint.c (info_common_command_for_block): Use metadata + style. + * f-typeprint.c (f_type_print_base): Use metadata style. + * expprint.c (print_subexp_standard): Use metadata style. + * cp-valprint.c (cp_print_value_fields): Use metadata style. + * cli/cli-style.h (class cli_style_option): Add constructor. + (metadata_style): Declare. + * cli/cli-style.c (metadata_style): New global. + (_initialize_cli_style): Register metadata style. + * cli-out.h (class cli_ui_out) <do_field_fmt>: Add style + parameter. + * cli-out.c (cli_ui_out::do_field_fmt): Update. + * c-typeprint.c (c_type_print_base_struct_union) + (c_type_print_base_1): Use metadata style. + * breakpoint.c (watchpoint_value_print) + (print_one_breakpoint_location): Use metadata style. + * break-catch-syscall.c (print_one_catch_syscall): Use metadata + style. + * break-catch-sig.c (signal_catchpoint_print_one): Use metadata + style. + * ada-valprint.c (val_print_packed_array_elements, printstr) + (print_field_values, ada_val_print_ref, ada_val_print): Use + metadata style. + * ada-typeprint.c (print_array_type, ada_print_type): Use metadata + style. + * ada-tasks.c (print_ada_task_info, info_task): Use metadata + style. + * ada-lang.c (user_select_syms): Use metadata style. + +2019-10-01 Tom Tromey <tom@tromey.com> + * cli/cli-cmds.c (pwd_command): Style output. 2019-10-01 Pedro Alves <palves@redhat.com> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 063b98b..846c9b4 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -54,6 +54,7 @@ #include "gdbsupport/gdb_vecs.h" #include "typeprint.h" #include "namespace.h" +#include "cli/cli-style.h" #include "psymtab.h" #include "value.h" @@ -3877,8 +3878,8 @@ See set/show multiple-symbol.")); ada_print_symbol_signature (gdb_stdout, syms[i].symbol, &type_print_raw_options); if (sal.symtab == NULL) - printf_filtered (_(" at <no source file available>:%d\n"), - sal.line); + printf_filtered (_(" at %p[<no source file available>%p]:%d\n"), + metadata_style.style ().ptr (), nullptr, sal.line); else printf_filtered (_(" at %s:%d\n"), symtab_to_filename_for_display (sal.symtab), diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 24ceab1..e4a5297 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -25,6 +25,7 @@ #include "gdbthread.h" #include "progspace.h" #include "objfiles.h" +#include "cli/cli-style.h" static int ada_build_task_list (); @@ -1163,9 +1164,14 @@ print_ada_task_info (struct ui_out *uiout, /* Finally, print the task name, without quotes around it, as mi like is not expecting quotes, and in non mi-like no need for quotes as there is a specific column for the name. */ - uiout->field_string ("name", - task_info->name[0] != '\0' ? task_info->name - : _("<no name>")); + uiout->field_fmt ("name", + (task_info->name[0] != '\0' + ? ui_file_style () + : metadata_style.style ()), + "%s", + (task_info->name[0] != '\0' + ? task_info->name + : _("<no name>"))); uiout->text ("\n"); } @@ -1201,7 +1207,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf) if (task_info->name[0] != '\0') printf_filtered (_("Name: %s\n"), task_info->name); else - printf_filtered (_("<no name>\n")); + fprintf_styled (gdb_stdout, metadata_style.style (), _("<no name>\n")); /* Print the TID and LWP. */ printf_filtered (_("Thread: %#lx\n"), task_info->ptid.tid ()); diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 89a69e9..c246166 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -393,7 +393,8 @@ print_array_type (struct type *type, struct ui_file *stream, int show, if (type == NULL) { - fprintf_filtered (stream, _("<undecipherable array type>")); + fprintf_styled (stream, metadata_style.style (), + _("<undecipherable array type>")); return; } @@ -838,7 +839,7 @@ ada_print_type (struct type *type0, const char *varstring, if (is_var_decl) fprintf_filtered (stream, "%.*s: ", ada_name_prefix_len (varstring), varstring); - fprintf_filtered (stream, "<null type?>"); + fprintf_styled (stream, metadata_style.style (), "<null type?>"); return; } @@ -894,8 +895,9 @@ ada_print_type (struct type *type0, const char *varstring, const char *name = ada_type_name (type); if (!ada_is_range_type_name (name)) - fprintf_filtered (stream, _("<%s-byte integer>"), - pulongest (TYPE_LENGTH (type))); + fprintf_styled (stream, metadata_style.style (), + _("<%s-byte integer>"), + pulongest (TYPE_LENGTH (type))); else { fprintf_filtered (stream, "range "); @@ -916,8 +918,9 @@ ada_print_type (struct type *type0, const char *varstring, } break; case TYPE_CODE_FLT: - fprintf_filtered (stream, _("<%s-byte float>"), - pulongest (TYPE_LENGTH (type))); + fprintf_styled (stream, metadata_style.style (), + _("<%s-byte float>"), + pulongest (TYPE_LENGTH (type))); break; case TYPE_CODE_ENUM: if (show < 0) diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 3060eb6..714b625 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -32,6 +32,7 @@ #include "infcall.h" #include "objfiles.h" #include "target-float.h" +#include "cli/cli-style.h" static int print_field_values (struct type *, const gdb_byte *, int, @@ -237,7 +238,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, value_embedded_offset (v0), 0, stream, recurse + 1, v0, &opts, current_language); annotate_elt_rep (i - i0); - fprintf_filtered (stream, _(" <repeats %u times>"), i - i0); + fprintf_filtered (stream, _(" %p[<repeats %u times>%p]"), + metadata_style.style ().ptr (), i - i0, nullptr); annotate_elt_rep_end (); } @@ -527,7 +529,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, ada_emit_char (char_at (string, i, type_len, byte_order), elttype, stream, '\'', type_len); fputs_filtered ("'", stream); - fprintf_filtered (stream, _(" <repeats %u times>"), reps); + fprintf_filtered (stream, _(" %p[<repeats %u times>%p]"), + metadata_style.style ().ptr (), reps, nullptr); i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; @@ -671,7 +674,8 @@ print_field_values (struct type *type, const gdb_byte *valaddr, order problems. */ if (HAVE_CPLUS_STRUCT (type) && TYPE_FIELD_IGNORE (type, i)) { - fputs_filtered (_("<optimized out or zero length>"), stream); + fputs_styled (_("<optimized out or zero length>"), + metadata_style.style (), stream); } else { @@ -1069,7 +1073,8 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr, if (TYPE_CODE (elttype) == TYPE_CODE_UNDEF) { - fputs_filtered ("<ref to undefined type>", stream); + fputs_styled ("<ref to undefined type>", metadata_style.style (), + stream); return; } @@ -1212,8 +1217,9 @@ ada_val_print (struct type *type, } catch (const gdb_exception_error &except) { - fprintf_filtered (stream, _("<error reading variable: %s>"), - except.what ()); + fprintf_styled (stream, metadata_style.style (), + _("<error reading variable: %s>"), + except.what ()); } } diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 53540ee..c475e8a 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -28,6 +28,7 @@ #include "valprint.h" #include "cli/cli-utils.h" #include "completer.h" +#include "cli/cli-style.h" #include <string> @@ -241,7 +242,8 @@ signal_catchpoint_print_one (struct breakpoint *b, } else uiout->field_string ("what", - c->catch_all ? "<any signal>" : "<standard signals>"); + c->catch_all ? "<any signal>" : "<standard signals>", + metadata_style.style ()); uiout->text ("\" "); if (uiout->is_mi_like_p ()) diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index a165be6..dde80b5 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -29,6 +29,7 @@ #include "arch-utils.h" #include "observable.h" #include "xml-syscall.h" +#include "cli/cli-style.h" /* An instance of this type is used to represent a syscall catchpoint. A breakpoint is really of this type iff its ops pointer points to @@ -273,7 +274,7 @@ print_one_catch_syscall (struct breakpoint *b, xfree (text); } else - uiout->field_string ("what", "<any syscall>"); + uiout->field_string ("what", "<any syscall>", metadata_style.style ()); uiout->text ("\" "); if (uiout->is_mi_like_p ()) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2030687..0a70516 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4457,7 +4457,7 @@ static void watchpoint_value_print (struct value *val, struct ui_file *stream) { if (val == NULL) - fprintf_unfiltered (stream, _("<unreadable>")); + fprintf_styled (stream, metadata_style.style (), _("<unreadable>")); else { struct value_print_options opts; @@ -6055,9 +6055,11 @@ print_one_breakpoint_location (struct breakpoint *b, { annotate_field (4); if (header_of_multiple) - uiout->field_string ("addr", "<MULTIPLE>"); + uiout->field_string ("addr", "<MULTIPLE>", + metadata_style.style ()); else if (b->loc == NULL || loc->shlib_disabled) - uiout->field_string ("addr", "<PENDING>"); + uiout->field_string ("addr", "<PENDING>", + metadata_style.style ()); else uiout->field_core_addr ("addr", loc->gdbarch, loc->address); diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 43ad3b3..1a37c4e 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1116,10 +1116,12 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, { if (TYPE_STUB (type)) fprintfi_filtered (level + 4, stream, - _("<incomplete type>\n")); + _("%p[<incomplete type>%p]\n"), + metadata_style.style ().ptr (), nullptr); else fprintfi_filtered (level + 4, stream, - _("<no data fields>\n")); + _("%p[<no data fields>%p]\n"), + metadata_style.style ().ptr (), nullptr); } /* Start off with no specific section type, so we can print @@ -1277,7 +1279,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, { /* Keep GDB from crashing here. */ fprintf_filtered (stream, - _("<undefined type> %s;\n"), + _("%p[<undefined type>%p] %s;\n"), + metadata_style.style ().ptr (), nullptr, TYPE_FN_FIELD_PHYSNAME (f, j)); break; } @@ -1325,9 +1328,9 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, &local_flags); } else - fprintf_filtered (stream, - _("<badly mangled name '%s'>"), - mangled_name); + fprintf_styled (stream, metadata_style.style (), + _("<badly mangled name '%s'>"), + mangled_name); } else { @@ -1465,7 +1468,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, if (type == NULL) { - fputs_filtered (_("<type unknown>"), stream); + fputs_styled (_("<type unknown>"), metadata_style.style (), stream); return; } @@ -1511,7 +1514,8 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */ gdb_assert (TYPE_NAME (type) == NULL); gdb_assert (TYPE_TARGET_TYPE (type) == NULL); - fprintf_filtered (stream, _("<unnamed typedef>")); + fprintf_styled (stream, metadata_style.style (), + _("<unnamed typedef>")); break; case TYPE_CODE_FUNC: @@ -1622,10 +1626,12 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, { if (TYPE_STUB (type)) fprintfi_filtered (level + 4, stream, - _("<incomplete type>\n")); + _("%p[<incomplete type>%p]\n"), + metadata_style.style ().ptr (), nullptr); else fprintfi_filtered (level + 4, stream, - _("<no data fields>\n")); + _("%p[<no data fields>%p]\n"), + metadata_style.style ().ptr (), nullptr); } len = TYPE_NFIELDS (type); for (i = 0; i < len; i++) @@ -1668,7 +1674,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, case TYPE_CODE_RANGE: /* This should not occur. */ - fprintf_filtered (stream, _("<range type>")); + fprintf_styled (stream, metadata_style.style (), _("<range type>")); break; case TYPE_CODE_NAMESPACE: @@ -1690,8 +1696,8 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, { /* At least for dump_symtab, it is important that this not be an error (). */ - fprintf_filtered (stream, _("<invalid type code %d>"), - TYPE_CODE (type)); + fprintf_styled (stream, metadata_style.style (), + _("<invalid type code %d>"), TYPE_CODE (type)); } break; } diff --git a/gdb/cli-out.c b/gdb/cli-out.c index c713607..702e4e4 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -188,16 +188,15 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align, void cli_ui_out::do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, - va_list args) + const char *fldname, const ui_file_style &style, + const char *format, va_list args) { if (m_suppress_output) return; std::string str = string_vprintf (format, args); - do_field_string (fldno, width, align, fldname, str.c_str (), - ui_file_style ()); + do_field_string (fldno, width, align, fldname, str.c_str (), style); } void diff --git a/gdb/cli-out.h b/gdb/cli-out.h index d7bd23b..7d5b4fe 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -59,9 +59,9 @@ protected: const char *string, const ui_file_style &style) override; virtual void do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, - va_list args) - override ATTRIBUTE_PRINTF (6,0); + const char *fldname, const ui_file_style &style, + const char *format, va_list args) + override ATTRIBUTE_PRINTF (7, 0); virtual void do_spaces (int numspaces) override; virtual void do_text (const char *string) override; virtual void do_message (const ui_file_style &style, diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index ea30177..a0c5c0a 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -85,6 +85,10 @@ cli_style_option title_style ("title", ui_file_style::BOLD); /* See cli-style.h. */ +cli_style_option metadata_style ("metadata", ui_file_style::DIM); + +/* See cli-style.h. */ + cli_style_option::cli_style_option (const char *name, ui_file_style::basic_color fg) : m_name (name), @@ -372,4 +376,11 @@ Highlight display styling.\n\ Configure highlight colors and display intensity\n\ Some commands use the highlight style to draw the attention to a part\n\ of their output.")); + + STYLE_ADD_SETSHOW_COMMANDS (metadata_style, + _("\ +Metadata display styling\n\ +Configure metadata colors and display intensity\n\ +The \"metadata\" style is used when GDB displays information about\n\ +your data, for example \"<unavailable>\"")); } diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index 826162f..6716471 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -34,6 +34,9 @@ public: /* Construct a CLI style option with an intensity. */ cli_style_option (const char *name, ui_file_style::intensity i); + /* Construct a CLI style option with an intensity. */ + cli_style_option (ui_file_style::intensity val); + /* Return a ui_file_style corresponding to the settings in this CLI style. */ ui_file_style style () const; @@ -108,6 +111,8 @@ extern cli_style_option highlight_style; /* The title style. */ extern cli_style_option title_style; +/* The metadata style. */ +extern cli_style_option metadata_style; /* True if source styling is enabled. */ extern bool source_styling; diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 530d8c5..e73b0e2 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -37,6 +37,7 @@ #include "typeprint.h" #include "gdbsupport/byte-vector.h" #include "gdbarch.h" +#include "cli/cli-style.h" static struct obstack dont_print_vb_obstack; static struct obstack dont_print_statmem_obstack; @@ -170,7 +171,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, /* If there are no data fields, skip this part */ if (len == n_baseclasses || !len) - fprintf_filtered (stream, "<No data fields>"); + fprintf_styled (stream, metadata_style.style (), "<No data fields>"); else { size_t statmem_obstack_initial_size = 0; @@ -268,7 +269,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, byte order problems. */ if (TYPE_FIELD_IGNORE (type, i)) { - fputs_filtered ("<optimized out or zero length>", stream); + fputs_styled ("<optimized out or zero length>", + metadata_style.style (), stream); } else if (value_bits_synthetic_pointer (val, TYPE_FIELD_BITPOS (type, @@ -276,7 +278,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, TYPE_FIELD_BITSIZE (type, i))) { - fputs_filtered (_("<synthetic pointer>"), stream); + fputs_styled (_("<synthetic pointer>"), + metadata_style.style (), stream); } else { @@ -292,8 +295,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, { if (TYPE_FIELD_IGNORE (type, i)) { - fputs_filtered ("<optimized out or zero length>", - stream); + fputs_styled ("<optimized out or zero length>", + metadata_style.style (), stream); } else if (field_is_static (&TYPE_FIELD (type, i))) { @@ -307,9 +310,9 @@ cp_print_value_fields (struct type *type, struct type *real_type, } catch (const gdb_exception_error &ex) { - fprintf_filtered (stream, - _("<error reading variable: %s>"), - ex.what ()); + fprintf_styled (stream, metadata_style.style (), + _("<error reading variable: %s>"), + ex.what ()); } } else if (i == vptr_fieldno && type == vptr_basetype) diff --git a/gdb/expprint.c b/gdb/expprint.c index d7ad1a7..c98638a 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -29,6 +29,7 @@ #include "block.h" #include "objfiles.h" #include "valprint.h" +#include "cli/cli-style.h" #include <ctype.h> @@ -510,8 +511,9 @@ print_subexp_standard (struct expression *exp, int *pos, if (exp->language_defn->la_name_of_this) fputs_filtered (exp->language_defn->la_name_of_this, stream); else - fprintf_filtered (stream, _("<language %s has no 'this'>"), - exp->language_defn->la_name); + fprintf_styled (stream, metadata_style.style (), + _("<language %s has no 'this'>"), + exp->language_defn->la_name); return; /* Modula-2 ops */ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 92b5093..0093aeb 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -31,6 +31,7 @@ #include "target.h" #include "f-lang.h" #include "typeprint.h" +#include "cli/cli-style.h" #if 0 /* Currently unused. */ static void f_type_print_args (struct type *, struct ui_file *); @@ -325,7 +326,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, wrap_here (" "); if (type == NULL) { - fputs_filtered ("<type unknown>", stream); + fputs_styled ("<type unknown>", metadata_style.style (), stream); return; } diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 264416e..f9d4923 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -33,6 +33,7 @@ #include "command.h" #include "block.h" #include "dictionary.h" +#include "cli/cli-style.h" static void f77_get_dynamic_length_of_aggregate (struct type *); @@ -415,8 +416,9 @@ info_common_command_for_block (const struct block *block, const char *comname, catch (const gdb_exception_error &except) { - printf_filtered ("<error reading variable: %s>", - except.what ()); + fprintf_styled (gdb_stdout, metadata_style.style (), + "<error reading variable: %s>", + except.what ()); } putchar_filtered ('\n'); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 6407c9b..1d4e43a 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -28,6 +28,7 @@ #include "c-lang.h" #include "typeprint.h" #include <algorithm> +#include "cli/cli-style.h" static struct cp_abi_ops gnu_v3_abi_ops; @@ -912,7 +913,8 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value, } catch (const gdb_exception_error &ex) { - printf_filtered (_("<error: %s>"), ex.what ()); + fprintf_styled (gdb_stdout, metadata_style.style (), + _("<error: %s>"), ex.what ()); got_error = 1; } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index dc82ef0..20523fe 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -60,6 +60,7 @@ #include "interps.h" #include "gdbsupport/gdb_optional.h" #include "source.h" +#include "cli/cli-style.h" /* Local functions: */ @@ -1628,7 +1629,8 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv) uiout->field_stream ("return-value", stb); } else - uiout->field_string ("return-value", _("<not displayed>")); + uiout->field_string ("return-value", _("<not displayed>"), + metadata_style.style ()); uiout->text ("\n"); } else diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index dae07d1..3c1a8d2 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -31,6 +31,7 @@ #include "c-lang.h" #include "typeprint.h" #include "cp-abi.h" +#include "cli/cli-style.h" static void m2_print_bounds (struct type *type, struct ui_file *stream, int show, int level, @@ -81,7 +82,7 @@ m2_print_type (struct type *type, const char *varstring, wrap_here (" "); if (type == NULL) { - fputs_filtered (_("<type unknown>"), stream); + fputs_styled (_("<type unknown>"), metadata_style.style (), stream); return; } diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index 74f89ee..4dc0fe1 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -28,6 +28,7 @@ #include "c-lang.h" #include "m2-lang.h" #include "target.h" +#include "cli/cli-style.h" static int print_unpacked_pointer (struct type *type, CORE_ADDR address, CORE_ADDR addr, @@ -92,7 +93,8 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr, } else { - fprintf_filtered (stream, " %s }", _("<unknown bounds of set>")); + fprintf_styled (stream, metadata_style.style (), + " %s }", _("<unknown bounds of set>")); return; } @@ -407,7 +409,8 @@ m2_val_print (struct type *type, int embedded_offset, elttype = check_typedef (elttype); if (TYPE_STUB (elttype)) { - fprintf_filtered (stream, _("<incomplete type>")); + fprintf_styled (stream, metadata_style.style (), + _("<incomplete type>")); break; } else @@ -423,7 +426,8 @@ m2_val_print (struct type *type, int embedded_offset, maybe_bad_bstring: if (i < 0) { - fputs_filtered (_("<error value>"), stream); + fputs_styled (_("<error value>"), metadata_style.style (), + stream); goto done; } diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 71af486..ad4252f 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -141,8 +141,8 @@ mi_ui_out::do_field_string (int fldno, int width, ui_align align, void mi_ui_out::do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, - va_list args) + const char *fldname, const ui_file_style &style, + const char *format, va_list args) { ui_file *stream = m_streams.back (); field_separator (); diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index 9393809..c8b42c2 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -68,8 +68,9 @@ protected: const char *fldname, const char *string, const ui_file_style &style) override; virtual void do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, va_list args) - override ATTRIBUTE_PRINTF (6,0); + const char *fldname, const ui_file_style &style, + const char *format, va_list args) + override ATTRIBUTE_PRINTF (7,0); virtual void do_spaces (int numspaces) override; virtual void do_text (const char *string) override; virtual void do_message (const ui_file_style &style, diff --git a/gdb/p-lang.c b/gdb/p-lang.c index cfe2a88..9591115 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -32,6 +32,7 @@ #include <ctype.h> #include "c-lang.h" #include "gdbarch.h" +#include "cli/cli-style.h" /* All GPC versions until now (2007-09-27) also define a symbol called '_p_initialize'. Check for the presence of this symbol first. */ @@ -292,7 +293,9 @@ pascal_printstr (struct ui_file *stream, struct type *type, in_quotes = 0; } pascal_printchar (current_char, type, stream); - fprintf_filtered (stream, " <repeats %u times>", reps); + fprintf_filtered (stream, " %p[<repeats %u times>%p]", + metadata_style.style ().ptr (), + reps, nullptr); i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index d90b8ce..fadc44e 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -32,6 +32,7 @@ #include "typeprint.h" #include "gdb-demangle.h" #include <ctype.h> +#include "cli/cli-style.h" static void pascal_type_print_varspec_suffix (struct type *, struct ui_file *, int, int, int, @@ -470,7 +471,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, wrap_here (" "); if (type == NULL) { - fputs_filtered ("<type unknown>", stream); + fputs_styled ("<type unknown>", metadata_style.style (), stream); return; } @@ -827,8 +828,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, { /* At least for dump_symtab, it is important that this not be an error (). */ - fprintf_filtered (stream, "<invalid unnamed pascal type code %d>", - TYPE_CODE (type)); + fprintf_styled (stream, metadata_style.style (), + "<invalid unnamed pascal type code %d>", + TYPE_CODE (type)); } break; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index a3738a9..10612f3 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -39,6 +39,7 @@ #include "cp-support.h" #include "objfiles.h" #include "gdbsupport/byte-vector.h" +#include "cli/cli-style.h" /* Decorations for Pascal. */ @@ -347,7 +348,7 @@ pascal_val_print (struct type *type, elttype = check_typedef (elttype); if (TYPE_STUB (elttype)) { - fprintf_filtered (stream, "<incomplete type>"); + fprintf_styled (stream, metadata_style.style (), "<incomplete type>"); break; } else @@ -370,7 +371,7 @@ pascal_val_print (struct type *type, maybe_bad_bstring: if (bound_info < 0) { - fputs_filtered ("<error value>", stream); + fputs_styled ("<error value>", metadata_style.style (), stream); goto done; } @@ -557,7 +558,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, options, dont_print_vb); if (!len && n_baseclasses == 1) - fprintf_filtered (stream, "<No data fields>"); + fprintf_styled (stream, metadata_style.style (), "<No data fields>"); else { struct obstack tmp_obstack = dont_print_statmem_obstack; @@ -622,7 +623,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, order problems. */ if (TYPE_FIELD_IGNORE (type, i)) { - fputs_filtered ("<optimized out or zero length>", stream); + fputs_styled ("<optimized out or zero length>", + metadata_style.style (), stream); } else if (value_bits_synthetic_pointer (val, TYPE_FIELD_BITPOS (type, @@ -630,7 +632,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, TYPE_FIELD_BITSIZE (type, i))) { - fputs_filtered (_("<synthetic pointer>"), stream); + fputs_styled (_("<synthetic pointer>"), + metadata_style.style (), stream); } else { @@ -647,7 +650,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, { if (TYPE_FIELD_IGNORE (type, i)) { - fputs_filtered ("<optimized out or zero length>", stream); + fputs_styled ("<optimized out or zero length>", + metadata_style.style (), stream); } else if (field_is_static (&TYPE_FIELD (type, i))) { diff --git a/gdb/printcmd.c b/gdb/printcmd.c index c17afe2..ea00f08 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2001,8 +2001,9 @@ do_one_display (struct display *d) } catch (const gdb_exception_error &ex) { - fprintf_filtered (gdb_stdout, _("<error: %s>\n"), - ex.what ()); + fprintf_filtered (gdb_stdout, _("%p[<error: %s>%p]\n"), + metadata_style.style ().ptr (), ex.what (), + nullptr); } } else @@ -2035,7 +2036,8 @@ do_one_display (struct display *d) } catch (const gdb_exception_error &ex) { - fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.what ()); + fprintf_styled (gdb_stdout, metadata_style.style (), + _("<error: %s>"), ex.what ()); } printf_filtered ("\n"); @@ -2237,8 +2239,9 @@ print_variable_and_value (const char *name, struct symbol *var, } catch (const gdb_exception_error &except) { - fprintf_filtered (stream, "<error reading variable %s (%s)>", name, - except.what ()); + fprintf_styled (stream, metadata_style.style (), + "<error reading variable %s (%s)>", name, + except.what ()); } fprintf_filtered (stream, "\n"); diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index f82a239..4dd6243 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -397,7 +397,7 @@ py_print_single_arg (struct ui_out *out, if (val == NULL) { gdb_assert (fa != NULL && fa->error != NULL); - out->field_fmt ("value", + out->field_fmt ("value", metadata_style.style (), _("<error reading variable: %s>"), fa->error.get ()); } diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index fdc520d..a4df48f 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -25,6 +25,7 @@ #include "extension-priv.h" #include "python.h" #include "python-internal.h" +#include "cli/cli-style.h" /* Return type of print_string_repr. */ @@ -259,10 +260,11 @@ print_stack_unless_memory_error (struct ui_file *stream) gdb::unique_xmalloc_ptr<char> msg = fetched_error.to_string (); if (msg == NULL || *msg == '\0') - fprintf_filtered (stream, _("<error reading variable>")); + fprintf_styled (stream, metadata_style.style (), + _("<error reading variable>")); else - fprintf_filtered (stream, _("<error reading variable: %s>"), - msg.get ()); + fprintf_styled (stream, metadata_style.style (), + _("<error reading variable: %s>"), msg.get ()); } else gdbpy_print_stack (); diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 79f1331..cef0a9c 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -37,6 +37,7 @@ #include <algorithm> #include <string> #include <vector> +#include "cli/cli-style.h" /* See rust-lang.h. */ @@ -473,7 +474,9 @@ rust_print_enum (struct type *type, int embedded_offset, if (rust_empty_enum_p (type)) { /* Print the enum type name here to be more clear. */ - fprintf_filtered (stream, _("%s {<No data fields>}"), TYPE_NAME (type)); + fprintf_filtered (stream, _("%s {%p[<No data fields>%p]}"), + TYPE_NAME (type), + metadata_style.style ().ptr (), nullptr); return; } @@ -415,7 +415,9 @@ info_skip_command (const char *arg, int from_tty) current_uiout->field_string ("file", e.file ().empty () ? "<none>" : e.file ().c_str (), - file_name_style.style ()); /* 4 */ + e.file ().empty () + ? metadata_style.style () + : file_name_style.style ()); /* 4 */ if (e.function_is_regexp ()) current_uiout->field_string ("regexp", "y"); /* 5 */ else @@ -424,7 +426,9 @@ info_skip_command (const char *arg, int from_tty) current_uiout->field_string ("function", e.function ().empty () ? "<none>" : e.function ().c_str (), - function_name_style.style ()); /* 6 */ + e.function ().empty () + ? metadata_style.style () + : function_name_style.style ()); /* 6 */ current_uiout->text ("\n"); } diff --git a/gdb/stack.c b/gdb/stack.c index 4899d0f..cb07e28 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -386,12 +386,16 @@ print_frame_arg (const frame_print_options &fp_opts, annotate_arg_name_end (); uiout->text ("="); + ui_file_style style; if (!arg->val && !arg->error) uiout->text ("..."); else { if (arg->error) - stb.printf (_("<error reading variable: %s>"), arg->error.get ()); + { + stb.printf (_("<error reading variable: %s>"), arg->error.get ()); + style = metadata_style.style (); + } else { try @@ -428,11 +432,12 @@ print_frame_arg (const frame_print_options &fp_opts, { stb.printf (_("<error reading variable: %s>"), except.what ()); + style = metadata_style.style (); } } } - uiout->field_stream ("value", stb); + uiout->field_stream ("value", stb, style); } /* Read in inferior function local SYM at FRAME into ARGP. Caller is @@ -1006,18 +1011,18 @@ print_frame_info (const frame_print_options &fp_opts, { annotate_function_call (); uiout->field_string ("func", "<function called from gdb>", - function_name_style.style ()); + metadata_style.style ()); } else if (get_frame_type (frame) == SIGTRAMP_FRAME) { annotate_signal_handler_caller (); uiout->field_string ("func", "<signal handler called>", - function_name_style.style ()); + metadata_style.style ()); } else if (get_frame_type (frame) == ARCH_FRAME) { uiout->field_string ("func", "<cross-architecture call>", - function_name_style.style ()); + metadata_style.style ()); } uiout->text ("\n"); annotate_frame_end (); @@ -1311,7 +1316,7 @@ print_frame (const frame_print_options &fp_opts, print_pc (uiout, gdbarch, frame, pc); else uiout->field_string ("addr", "<unavailable>", - address_style.style ()); + metadata_style.style ()); annotate_frame_address_end (); uiout->text (" in "); } @@ -1508,7 +1513,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) if (frame_pc_p) fputs_filtered (paddress (gdbarch, get_frame_pc (fi)), gdb_stdout); else - fputs_filtered ("<unavailable>", gdb_stdout); + fputs_styled ("<unavailable>", metadata_style.style (), gdb_stdout); wrap_here (" "); if (funname) @@ -1545,8 +1550,9 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) val_print_not_saved (gdb_stdout); break; default: - fprintf_filtered (gdb_stdout, _("<error: %s>"), - ex.what ()); + fprintf_styled (gdb_stdout, metadata_style.style (), + _("<error: %s>"), + ex.what ()); break; } } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 88cec5d..784daf2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-10-01 Tom Tromey <tom@tromey.com> + * lib/gdb-utils.exp (style): Handle "metadata" argument. + * gdb.base/style.exp: Add metadata style test. + +2019-10-01 Tom Tromey <tom@tromey.com> + * gdb.base/style.exp: Test "pwd". 2019-10-01 Tom Tromey <tom@tromey.com> diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index fb0dfed..0f812f7 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -133,4 +133,8 @@ save_vars { env(TERM) } { "filename is styled when loading symbol file" gdb_test "pwd" "Working directory [style .*? file].*" + + gdb_test_no_output "set print repeat 3" + gdb_test "print {0,0,0,0,0,0,0,0}" \ + " = \\{0 [style {<repeats.*8.*times>} metadata]\\}" } diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp index 89767dc..95ca348 100644 --- a/gdb/testsuite/lib/gdb-utils.exp +++ b/gdb/testsuite/lib/gdb-utils.exp @@ -54,6 +54,7 @@ proc style {str style} { highlight { set style 31 } variable { set style 36 } address { set style 34 } + metadata { set style 2 } } return "\033\\\[${style}m${str}\033\\\[m" } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2f91e49..843341a 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -436,6 +436,7 @@ tvariables_info_1 (void) uiout->field_string ("name", std::string ("$") + tsv.name); uiout->field_string ("initial", plongest (tsv.initial_value)); + ui_file_style style; if (tsv.value_known) c = plongest (tsv.value); else if (uiout->is_mi_like_p ()) @@ -444,13 +445,19 @@ tvariables_info_1 (void) undefined does not seem important enough to represent. */ c = NULL; else if (current_trace_status ()->running || traceframe_number >= 0) - /* The value is/was defined, but we don't have it. */ - c = "<unknown>"; + { + /* The value is/was defined, but we don't have it. */ + c = "<unknown>"; + style = metadata_style.style (); + } else - /* It is not meaningful to ask about the value. */ - c = "<undefined>"; + { + /* It is not meaningful to ask about the value. */ + c = "<undefined>"; + style = metadata_style.style (); + } if (c) - uiout->field_string ("current", c); + uiout->field_string ("current", c, style); uiout->text ("\n"); } } diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index d415e7b..0d3f3be 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -70,15 +70,15 @@ tui_ui_out::do_field_string (int fldno, int width, ui_align align, void tui_ui_out::do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, - va_list args) + const char *fldname, const ui_file_style &style, + const char *format, va_list args) { if (suppress_output ()) return; m_start_of_line++; - cli_ui_out::do_field_fmt (fldno, width, align, fldname, format, args); + cli_ui_out::do_field_fmt (fldno, width, align, fldname, style, format, args); } void diff --git a/gdb/tui/tui-out.h b/gdb/tui/tui-out.h index 9df9e93..2b856af 100644 --- a/gdb/tui/tui-out.h +++ b/gdb/tui/tui-out.h @@ -37,8 +37,9 @@ protected: void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, const ui_file_style &style) override; void do_field_fmt (int fldno, int width, ui_align align, const char *fldname, - const char *format, va_list args) override - ATTRIBUTE_PRINTF (6,0); + const ui_file_style &style, + const char *format, va_list args) override + ATTRIBUTE_PRINTF (7, 0); void do_text (const char *string) override; private: diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 41d95c2..357b88d 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -36,6 +36,7 @@ #include "cli/cli-utils.h" #include "extension.h" #include "completer.h" +#include "cli/cli-style.h" const struct type_print_options type_print_raw_options = { @@ -415,7 +416,8 @@ type_to_string (struct type *type) void type_print_unknown_return_type (struct ui_file *stream) { - fprintf_filtered (stream, _("<unknown return type>")); + fprintf_styled (stream, metadata_style.style (), + _("<unknown return type>")); } /* See typeprint.h. */ @@ -862,7 +864,7 @@ Show the number of recursive nested type definitions to print."), NULL, void val_print_not_allocated (struct ui_file *stream) { - fprintf_filtered (stream, _("<not allocated>")); + fprintf_styled (stream, metadata_style.style (), _("<not allocated>")); } /* Print <not associated> status to stream STREAM. */ @@ -870,5 +872,5 @@ val_print_not_allocated (struct ui_file *stream) void val_print_not_associated (struct ui_file *stream) { - fprintf_filtered (stream, _("<not associated>")); + fprintf_styled (stream, metadata_style.style (), _("<not associated>")); } diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 8cbaa4e..a64c794 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -545,7 +545,25 @@ ui_out::field_fmt (const char *fldname, const char *format, ...) va_start (args, format); - do_field_fmt (fldno, width, align, fldname, format, args); + do_field_fmt (fldno, width, align, fldname, ui_file_style (), format, args); + + va_end (args); +} + +void +ui_out::field_fmt (const char *fldname, const ui_file_style &style, + const char *format, ...) +{ + va_list args; + int fldno; + int width; + ui_align align; + + verify_field (&fldno, &width, &align); + + va_start (args, format); + + do_field_fmt (fldno, width, align, fldname, style, format, args); va_end (args); } diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 0bba128..5c96a78 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -194,6 +194,9 @@ class ui_out void field_skip (const char *fldname); void field_fmt (const char *fldname, const char *format, ...) ATTRIBUTE_PRINTF (3, 4); + void field_fmt (const char *fldname, const ui_file_style &style, + const char *format, ...) + ATTRIBUTE_PRINTF (4, 5); void spaces (int numspaces); void text (const char *string); @@ -291,9 +294,9 @@ class ui_out const char *fldname, const char *string, const ui_file_style &style) = 0; virtual void do_field_fmt (int fldno, int width, ui_align align, - const char *fldname, const char *format, - va_list args) - ATTRIBUTE_PRINTF (6,0) = 0; + const char *fldname, const ui_file_style &style, + const char *format, va_list args) + ATTRIBUTE_PRINTF (7, 0) = 0; virtual void do_spaces (int numspaces) = 0; virtual void do_text (const char *string) = 0; virtual void do_message (const ui_file_style &style, diff --git a/gdb/valprint.c b/gdb/valprint.c index e5b28f3..919ab93 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -38,6 +38,7 @@ #include "gdbsupport/byte-vector.h" #include "cli/cli-option.h" #include "gdbarch.h" +#include "cli/cli-style.h" /* Maximum number of wchars returned from wchar_iterate. */ #define MAX_WCHARS 4 @@ -347,7 +348,8 @@ valprint_check_validity (struct ui_file *stream, } if (!is_ref || !ref_is_addressable) - fputs_filtered (_("<synthetic pointer>"), stream); + fputs_styled (_("<synthetic pointer>"), metadata_style.style (), + stream); /* C++ references should be valid even if they're synthetic. */ return is_ref; @@ -369,25 +371,25 @@ val_print_optimized_out (const struct value *val, struct ui_file *stream) if (val != NULL && value_lval_const (val) == lval_register) val_print_not_saved (stream); else - fprintf_filtered (stream, _("<optimized out>")); + fprintf_styled (stream, metadata_style.style (), _("<optimized out>")); } void val_print_not_saved (struct ui_file *stream) { - fprintf_filtered (stream, _("<not saved>")); + fprintf_styled (stream, metadata_style.style (), _("<not saved>")); } void val_print_unavailable (struct ui_file *stream) { - fprintf_filtered (stream, _("<unavailable>")); + fprintf_styled (stream, metadata_style.style (), _("<unavailable>")); } void val_print_invalid_address (struct ui_file *stream) { - fprintf_filtered (stream, _("<invalid address>")); + fprintf_styled (stream, metadata_style.style (), _("<invalid address>")); } /* Print a pointer based on the type of its target. @@ -988,7 +990,7 @@ generic_val_print (struct type *type, /* This happens (without TYPE_STUB set) on systems which don't use dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar" and no complete type for struct foo in that file. */ - fprintf_filtered (stream, _("<incomplete type>")); + fprintf_styled (stream, metadata_style.style (), _("<incomplete type>")); break; case TYPE_CODE_COMPLEX: @@ -1047,7 +1049,7 @@ val_print (struct type *type, LONGEST embedded_offset, if (TYPE_STUB (real_type)) { - fprintf_filtered (stream, _("<incomplete type>")); + fprintf_styled (stream, metadata_style.style (), _("<incomplete type>")); return; } @@ -1084,7 +1086,8 @@ val_print (struct type *type, LONGEST embedded_offset, } catch (const gdb_exception_error &except) { - fprintf_filtered (stream, _("<error reading variable>")); + fprintf_styled (stream, metadata_style.style (), + _("<error reading variable>")); } } @@ -1115,7 +1118,8 @@ value_check_printable (struct value *val, struct ui_file *stream, { if (val == 0) { - fprintf_filtered (stream, _("<address of value unknown>")); + fprintf_styled (stream, metadata_style.style (), + _("<address of value unknown>")); return 0; } @@ -1139,8 +1143,9 @@ value_check_printable (struct value *val, struct ui_file *stream, if (TYPE_CODE (value_type (val)) == TYPE_CODE_INTERNAL_FUNCTION) { - fprintf_filtered (stream, _("<internal function %s>"), - value_internal_function_name (val)); + fprintf_styled (stream, metadata_style.style (), + _("<internal function %s>"), + value_internal_function_name (val)); return 0; } @@ -2069,7 +2074,8 @@ val_print_array_elements (struct type *type, address, stream, recurse + 1, val, options, current_language); annotate_elt_rep (reps); - fprintf_filtered (stream, " <repeats %u times>", reps); + fprintf_filtered (stream, " %p[<repeats %u times>%p]", + metadata_style.style ().ptr (), reps, nullptr); annotate_elt_rep_end (); i = rep1 - 1; diff --git a/gdb/value.c b/gdb/value.c index d58a964..67fe2f1 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -43,6 +43,7 @@ #include "completer.h" #include "gdbsupport/selftest.h" #include "gdbsupport/array-view.h" +#include "cli/cli-style.h" /* Definition of a user function. */ struct internal_function @@ -2539,7 +2540,8 @@ show_convenience (const char *ignore, int from_tty) } catch (const gdb_exception_error &ex) { - fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.what ()); + fprintf_styled (gdb_stdout, metadata_style.style (), + _("<error: %s>"), ex.what ()); } printf_filtered (("\n")); |