From patchwork Fri Sep 27 21:25:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34698 Received: (qmail 106425 invoked by alias); 27 Sep 2019 21:25:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106045 invoked by uid 89); 27 Sep 2019 21:25:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=6722 X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Sep 2019 21:25:25 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 57C181AA9AD for ; Fri, 27 Sep 2019 16:25:23 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id DxjviUgRg3Qi0Dxjvi4DRG; Fri, 27 Sep 2019 16:25:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B2dgDrVMLM7GpYE0LQ+WyXW0gG43jugSfFJMs0c/bvA=; b=BCmBmk5qaMwIWdxv/eHD3lSxO7 snccULcEERp8N0nYGIeSW3P/EN0yW+vLWsiL6TSXhfMTrFQyMJuNNmJkOkLBDf2ygmEhGWlT364iK 8gR/7e1hm0WshwZfe/BQTM0QT; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:34758 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iDxjv-002PvY-29; Fri, 27 Sep 2019 16:25:23 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/8] Remove the ui_out_style_kind enum Date: Fri, 27 Sep 2019 15:25:13 -0600 Message-Id: <20190927212520.20073-2-tom@tromey.com> In-Reply-To: <20190927212520.20073-1-tom@tromey.com> References: <20190927212520.20073-1-tom@tromey.com> This removes the ui_out_style_kind enum, in favor of simply using ui_file_style references. This simplifies the code somewhat. gdb/ChangeLog 2019-09-27 Tom Tromey * ui-out.h (enum class ui_out_style_kind): Remove. (class ui_out) : Change type of "style". * ui-out.c (ui_out::field_core_addr, ui_out::field_stream) (ui_out::field_string): Update. * tui/tui-out.h (class tui_ui_out) : Change type of "style". * tui/tui-out.c (tui_ui_out::do_field_string): Update. * tracepoint.c (print_one_static_tracepoint_marker): Update. * stack.c (print_frame_arg, print_frame_info, print_frame): Update. * source.c (print_source_lines_base): Update. * solib.c (info_sharedlibrary_command): Update. * skip.c (info_skip_command): Update. * record-btrace.c (btrace_call_history_src_line) (btrace_call_history): Update. * python/py-framefilter.c (py_print_frame): Update. * mi/mi-out.h (class mi_ui_out) : Change type of "style". * mi/mi-out.c (mi_ui_out::do_table_header) (mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned) (mi_ui_out::do_field_string): Update. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Update. * cli-out.h (class cli_ui_out) : Change type of "style". * cli-out.c (cli_ui_out::do_table_header) (cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned) (cli_ui_out::do_field_skip, cli_ui_out::do_field_string) (cli_ui_out::do_field_fmt): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. --- gdb/ChangeLog | 35 ++++++++++++++++++++++++++++++++++ gdb/breakpoint.c | 8 ++++---- gdb/cli-out.c | 38 +++++++------------------------------ gdb/cli-out.h | 2 +- gdb/disasm.c | 3 ++- gdb/mi/mi-out.c | 10 +++++----- gdb/mi/mi-out.h | 2 +- gdb/python/py-framefilter.c | 5 +++-- gdb/record-btrace.c | 9 +++++---- gdb/skip.c | 5 +++-- gdb/solib.c | 3 ++- gdb/source.c | 3 ++- gdb/stack.c | 16 +++++++++------- gdb/tracepoint.c | 5 +++-- gdb/tui/tui-out.c | 2 +- gdb/tui/tui-out.h | 2 +- gdb/ui-out.c | 8 +++++--- gdb/ui-out.h | 23 ++++------------------ 18 files changed, 93 insertions(+), 86 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 838c9d136fd..dd8fe4c8620 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5823,14 +5823,14 @@ print_breakpoint_location (struct breakpoint *b, { uiout->text ("in "); uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); uiout->text (" "); uiout->wrap_hint (wrap_indent_at_field (uiout, "what")); uiout->text ("at "); } uiout->field_string ("file", symtab_to_filename_for_display (loc->symtab), - ui_out_style_kind::FILE); + file_name_style.style ()); uiout->text (":"); if (uiout->is_mi_like_p ()) @@ -13317,12 +13317,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal) if (sym) { uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); uiout->text (" at "); } uiout->field_string ("file", symtab_to_filename_for_display (sal2.symtab), - ui_out_style_kind::FILE); + file_name_style.style ()); uiout->text (":"); if (uiout->is_mi_like_p ()) diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 549d518d60f..fa72a1d344f 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -73,7 +73,7 @@ cli_ui_out::do_table_header (int width, ui_align alignment, return; do_field_string (0, width, alignment, 0, col_hdr.c_str (), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* Mark beginning of a list */ @@ -100,7 +100,7 @@ cli_ui_out::do_field_signed (int fldno, int width, ui_align alignment, return; do_field_string (fldno, width, alignment, fldname, plongest (value), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* output an unsigned field */ @@ -113,7 +113,7 @@ cli_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment, return; do_field_string (fldno, width, alignment, fldname, pulongest (value), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* used to omit a field */ @@ -126,7 +126,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment, return; do_field_string (fldno, width, alignment, fldname, "", - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* other specific cli_field_* end up here so alignment and field @@ -135,7 +135,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment, void cli_ui_out::do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) + const ui_file_style &style) { int before = 0; int after = 0; @@ -170,31 +170,7 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align, spaces (before); if (string) - { - ui_file_style fstyle; - switch (style) - { - case ui_out_style_kind::DEFAULT: - /* Nothing. */ - break; - case ui_out_style_kind::FILE: - /* Nothing. */ - fstyle = file_name_style.style (); - break; - case ui_out_style_kind::FUNCTION: - fstyle = function_name_style.style (); - break; - case ui_out_style_kind::VARIABLE: - fstyle = variable_name_style.style (); - break; - case ui_out_style_kind::ADDRESS: - fstyle = address_style.style (); - break; - default: - gdb_assert_not_reached ("missing case"); - } - fputs_styled (string, fstyle, m_streams.back ()); - } + fputs_styled (string, style, m_streams.back ()); if (after) spaces (after); @@ -216,7 +192,7 @@ cli_ui_out::do_field_fmt (int fldno, int width, ui_align align, std::string str = string_vprintf (format, args); do_field_string (fldno, width, align, fldname, str.c_str (), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } void diff --git a/gdb/cli-out.h b/gdb/cli-out.h index f38c1cc0571..bc8b781d605 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -57,7 +57,7 @@ protected: virtual void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) override; + 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) diff --git a/gdb/disasm.c b/gdb/disasm.c index 68da682c15e..f483a5e5cd0 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -31,6 +31,7 @@ #include #include "gdbsupport/gdb_optional.h" #include "valprint.h" +#include "cli/cli-style.h" /* Disassemble functions. FIXME: We should get rid of all the duplicate code in gdb that does @@ -245,7 +246,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn m_uiout->text (" <"); if (!omit_fname) m_uiout->field_string ("func-name", name.c_str (), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); /* For negative offsets, avoid displaying them as +-N; the sign of the offset takes the place of the "+" here. */ if (offset >= 0) diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index a6687178259..0b930738f1d 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -70,9 +70,9 @@ mi_ui_out::do_table_header (int width, ui_align alignment, do_field_signed (0, 0, ui_center, "width", width); do_field_signed (0, 0, ui_center, "alignment", alignment); do_field_string (0, 0, ui_center, "col_name", col_name.c_str (), - ui_out_style_kind::DEFAULT); + ui_file_style ()); do_field_string (0, width, alignment, "colhdr", col_hdr.c_str (), - ui_out_style_kind::DEFAULT); + ui_file_style ()); close (ui_out_type_tuple); } @@ -99,7 +99,7 @@ mi_ui_out::do_field_signed (int fldno, int width, ui_align alignment, const char *fldname, LONGEST value) { do_field_string (fldno, width, alignment, fldname, plongest (value), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* Output an unsigned field. */ @@ -109,7 +109,7 @@ mi_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment, const char *fldname, ULONGEST value) { do_field_string (fldno, width, alignment, fldname, pulongest (value), - ui_out_style_kind::DEFAULT); + ui_file_style ()); } /* Used to omit a field. */ @@ -126,7 +126,7 @@ mi_ui_out::do_field_skip (int fldno, int width, ui_align alignment, void mi_ui_out::do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) + const ui_file_style &style) { ui_file *stream = m_streams.back (); field_separator (); diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index fe96658b59b..90528fd4e84 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -66,7 +66,7 @@ protected: const char *fldname) override; virtual void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) override; + 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); diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index ecd633ab695..f82a239c2a8 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -33,6 +33,7 @@ #include "mi/mi-cmds.h" #include "python-internal.h" #include "gdbsupport/gdb_optional.h" +#include "cli/cli-style.h" enum mi_print_types { @@ -947,7 +948,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags, if (function == NULL) out->field_skip ("func"); else - out->field_string ("func", function, ui_out_style_kind::FUNCTION); + out->field_string ("func", function, function_name_style.style ()); } } @@ -987,7 +988,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags, out->text (" at "); annotate_frame_source_file (); out->field_string ("file", filename.get (), - ui_out_style_kind::FILE); + file_name_style.style ()); annotate_frame_source_file_end (); } } diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index b55459e4ad1..c923b365c48 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -42,6 +42,7 @@ #include "inferior.h" #include #include "gdbarch.h" +#include "cli/cli-style.h" static const target_info record_btrace_target_info = { "record-btrace", @@ -1084,7 +1085,7 @@ btrace_call_history_src_line (struct ui_out *uiout, uiout->field_string ("file", symtab_to_filename_for_display (symbol_symtab (sym)), - ui_out_style_kind::FILE); + file_name_style.style ()); btrace_compute_src_line_range (bfun, &begin, &end); if (end < begin) @@ -1176,13 +1177,13 @@ btrace_call_history (struct ui_out *uiout, if (sym != NULL) uiout->field_string ("function", SYMBOL_PRINT_NAME (sym), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); else if (msym != NULL) uiout->field_string ("function", MSYMBOL_PRINT_NAME (msym), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); else if (!uiout->is_mi_like_p ()) uiout->field_string ("function", "??", - ui_out_style_kind::FUNCTION); + function_name_style.style ()); if ((flags & RECORD_PRINT_INSN_RANGE) != 0) { diff --git a/gdb/skip.c b/gdb/skip.c index a549aca897c..fcf41bf79a7 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -36,6 +36,7 @@ #include "gdb_regex.h" #include "gdbsupport/gdb_optional.h" #include +#include "cli/cli-style.h" /* True if we want to print debug printouts related to file/function skipping. */ @@ -414,7 +415,7 @@ info_skip_command (const char *arg, int from_tty) current_uiout->field_string ("file", e.file ().empty () ? "" : e.file ().c_str (), - ui_out_style_kind::FILE); /* 4 */ + file_name_style.style ()); /* 4 */ if (e.function_is_regexp ()) current_uiout->field_string ("regexp", "y"); /* 5 */ else @@ -423,7 +424,7 @@ info_skip_command (const char *arg, int from_tty) current_uiout->field_string ("function", e.function ().empty () ? "" : e.function ().c_str (), - ui_out_style_kind::FUNCTION); /* 6 */ + function_name_style.style ()); /* 6 */ current_uiout->text ("\n"); } diff --git a/gdb/solib.c b/gdb/solib.c index 5b1246929b5..db6a52d2c14 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -47,6 +47,7 @@ #include "gdb_bfd.h" #include "gdbsupport/filestuff.h" #include "source.h" +#include "cli/cli-style.h" /* Architecture-specific operations. */ @@ -1104,7 +1105,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) else uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No"); - uiout->field_string ("name", so->so_name, ui_out_style_kind::FILE); + uiout->field_string ("name", so->so_name, file_name_style.style ()); uiout->text ("\n"); } diff --git a/gdb/source.c b/gdb/source.c index 0171f2748b4..ff218189495 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -46,6 +46,7 @@ #include #include "gdbsupport/pathstuff.h" #include "source-cache.h" +#include "cli/cli-style.h" #define OPEN_MODE (O_RDONLY | O_BINARY) #define FDOPEN_MODE FOPEN_RB @@ -1235,7 +1236,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, not for TUI. */ if (uiout->is_mi_like_p () || uiout->test_flags (ui_source_list)) uiout->field_string ("file", symtab_to_filename_for_display (s), - ui_out_style_kind::FILE); + file_name_style.style ()); if (uiout->is_mi_like_p () || !uiout->test_flags (ui_source_list)) { const char *s_fullname = symtab_to_fullname (s); diff --git a/gdb/stack.c b/gdb/stack.c index 0f7fbf5e6ef..4899d0f4169 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -54,6 +54,7 @@ #include "observable.h" #include "gdbsupport/def-vector.h" #include "cli/cli-option.h" +#include "cli/cli-style.h" /* The possible choices of "set print frame-arguments", and the value of this setting. */ @@ -381,7 +382,7 @@ print_frame_arg (const frame_print_options &fp_opts, if (arg->entry_kind == print_entry_values_only || arg->entry_kind == print_entry_values_compact) stb.puts ("@entry"); - uiout->field_stream ("name", stb, ui_out_style_kind::VARIABLE); + uiout->field_stream ("name", stb, variable_name_style.style ()); annotate_arg_name_end (); uiout->text ("="); @@ -1005,18 +1006,18 @@ print_frame_info (const frame_print_options &fp_opts, { annotate_function_call (); uiout->field_string ("func", "", - ui_out_style_kind::FUNCTION); + function_name_style.style ()); } else if (get_frame_type (frame) == SIGTRAMP_FRAME) { annotate_signal_handler_caller (); uiout->field_string ("func", "", - ui_out_style_kind::FUNCTION); + function_name_style.style ()); } else if (get_frame_type (frame) == ARCH_FRAME) { uiout->field_string ("func", "", - ui_out_style_kind::FUNCTION); + function_name_style.style ()); } uiout->text ("\n"); annotate_frame_end (); @@ -1310,7 +1311,7 @@ print_frame (const frame_print_options &fp_opts, print_pc (uiout, gdbarch, frame, pc); else uiout->field_string ("addr", "", - ui_out_style_kind::ADDRESS); + address_style.style ()); annotate_frame_address_end (); uiout->text (" in "); } @@ -1319,7 +1320,7 @@ print_frame (const frame_print_options &fp_opts, string_file stb; fprintf_symbol_filtered (&stb, funname ? funname.get () : "??", funlang, DMGL_ANSI); - uiout->field_stream ("func", stb, ui_out_style_kind::FUNCTION); + uiout->field_stream ("func", stb, function_name_style.style ()); uiout->wrap_hint (" "); annotate_frame_args (); @@ -1361,7 +1362,8 @@ print_frame (const frame_print_options &fp_opts, uiout->wrap_hint (" "); uiout->text (" at "); annotate_frame_source_file (); - uiout->field_string ("file", filename_display, ui_out_style_kind::FILE); + uiout->field_string ("file", filename_display, + file_name_style.style ()); if (uiout->is_mi_like_p ()) { const char *fullname = symtab_to_fullname (sal.symtab); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c2c5f422462..2f91e49efd3 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -57,6 +57,7 @@ #include "tracefile.h" #include "location.h" #include +#include "cli/cli-style.h" #include @@ -3683,7 +3684,7 @@ print_one_static_tracepoint_marker (int count, { uiout->text ("in "); uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), - ui_out_style_kind::FUNCTION); + function_name_style.style ()); uiout->wrap_hint (wrap_indent); uiout->text (" at "); } @@ -3694,7 +3695,7 @@ print_one_static_tracepoint_marker (int count, { uiout->field_string ("file", symtab_to_filename_for_display (sal.symtab), - ui_out_style_kind::FILE); + file_name_style.style ()); uiout->text (":"); if (uiout->is_mi_like_p ()) diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 50865ba0465..d415e7b64a0 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -52,7 +52,7 @@ tui_ui_out::do_field_signed (int fldno, int width, ui_align alignment, void tui_ui_out::do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) + const ui_file_style &style) { if (suppress_output ()) return; diff --git a/gdb/tui/tui-out.h b/gdb/tui/tui-out.h index 083094ba75e..9df9e93aa9d 100644 --- a/gdb/tui/tui-out.h +++ b/gdb/tui/tui-out.h @@ -35,7 +35,7 @@ protected: void do_field_signed (int fldno, int width, ui_align align, const char *fldname, LONGEST value) override; void do_field_string (int fldno, int width, ui_align align, const char *fldname, - const char *string, ui_out_style_kind style) override; + 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); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 91662fac4a2..e8fe44c8268 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -24,6 +24,8 @@ #include "expression.h" /* For language.h */ #include "language.h" #include "ui-out.h" +#include "gdbsupport/format.h" +#include "cli/cli-style.h" #include #include @@ -483,12 +485,12 @@ ui_out::field_core_addr (const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address) { field_string (fldname, print_core_address (gdbarch, address), - ui_out_style_kind::ADDRESS); + address_style.style ()); } void ui_out::field_stream (const char *fldname, string_file &stream, - ui_out_style_kind style) + const ui_file_style &style) { if (!stream.empty ()) field_string (fldname, stream.c_str (), style); @@ -513,7 +515,7 @@ ui_out::field_skip (const char *fldname) void ui_out::field_string (const char *fldname, const char *string, - ui_out_style_kind style) + const ui_file_style &style) { int fldno; int width; diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 7041d9690e5..6732f046719 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -26,6 +26,7 @@ #include #include "gdbsupport/enum-flags.h" +#include "ui-style.h" class ui_out_level; class ui_out_table; @@ -67,22 +68,6 @@ enum ui_out_type ui_out_type_list }; -/* Possible kinds of styling. */ - -enum class ui_out_style_kind -{ - /* The default (plain) style. */ - DEFAULT, - /* File name. */ - FILE, - /* Function name. */ - FUNCTION, - /* Variable name. */ - VARIABLE, - /* Address. */ - ADDRESS -}; - class ui_out { public: @@ -115,10 +100,10 @@ class ui_out void field_core_addr (const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address); void field_string (const char *fldname, const char *string, - ui_out_style_kind style = ui_out_style_kind::DEFAULT); + const ui_file_style &style = ui_file_style ()); void field_string (const char *fldname, const std::string &string); void field_stream (const char *fldname, string_file &stream, - ui_out_style_kind style = ui_out_style_kind::DEFAULT); + const ui_file_style &style = ui_file_style ()); void field_skip (const char *fldname); void field_fmt (const char *fldname, const char *format, ...) ATTRIBUTE_PRINTF (3, 4); @@ -169,7 +154,7 @@ class ui_out const char *fldname) = 0; virtual void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, - ui_out_style_kind style) = 0; + 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)