+2019-10-01 Tom Tromey <tom@tromey.com>
+
+ * ui-out.h (enum class ui_out_style_kind): Remove.
+ (class ui_out) <field_string, field_stsream, do_field_string>:
+ 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) <do_field_string>: 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) <do_field_string>: 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) <do_field_string>: 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.
+
2019-10-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* main.c (relocate_gdbinit_path_maybe_in_datadir): Remove std::string
{
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 ())
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 ())
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 */
return;
do_field_string (fldno, width, alignment, fldname, plongest (value),
- ui_out_style_kind::DEFAULT);
+ ui_file_style ());
}
/* output an unsigned field */
return;
do_field_string (fldno, width, alignment, fldname, pulongest (value),
- ui_out_style_kind::DEFAULT);
+ ui_file_style ());
}
/* used to omit a field */
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
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;
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);
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
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)
#include <algorithm>
#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
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)
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);
}
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. */
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. */
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 ();
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);
#include "mi/mi-cmds.h"
#include "python-internal.h"
#include "gdbsupport/gdb_optional.h"
+#include "cli/cli-style.h"
enum mi_print_types
{
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 ());
}
}
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 ();
}
}
#include "inferior.h"
#include <algorithm>
#include "gdbarch.h"
+#include "cli/cli-style.h"
static const target_info record_btrace_target_info = {
"record-btrace",
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)
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)
{
#include "gdb_regex.h"
#include "gdbsupport/gdb_optional.h"
#include <list>
+#include "cli/cli-style.h"
/* True if we want to print debug printouts related to file/function
skipping. */
current_uiout->field_string ("file",
e.file ().empty () ? "<none>"
: 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
current_uiout->field_string ("function",
e.function ().empty () ? "<none>"
: e.function ().c_str (),
- ui_out_style_kind::FUNCTION); /* 6 */
+ function_name_style.style ()); /* 6 */
current_uiout->text ("\n");
}
#include "gdb_bfd.h"
#include "gdbsupport/filestuff.h"
#include "source.h"
+#include "cli/cli-style.h"
/* Architecture-specific operations. */
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");
}
#include <algorithm>
#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
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);
#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. */
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 ("=");
{
annotate_function_call ();
uiout->field_string ("func", "<function called from gdb>",
- 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", "<signal handler called>",
- ui_out_style_kind::FUNCTION);
+ function_name_style.style ());
}
else if (get_frame_type (frame) == ARCH_FRAME)
{
uiout->field_string ("func", "<cross-architecture call>",
- ui_out_style_kind::FUNCTION);
+ function_name_style.style ());
}
uiout->text ("\n");
annotate_frame_end ();
print_pc (uiout, gdbarch, frame, pc);
else
uiout->field_string ("addr", "<unavailable>",
- ui_out_style_kind::ADDRESS);
+ address_style.style ());
annotate_frame_address_end ();
uiout->text (" in ");
}
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 ();
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);
#include "tracefile.h"
#include "location.h"
#include <algorithm>
+#include "cli/cli-style.h"
#include <unistd.h>
{
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 ");
}
{
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 ())
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;
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);
#include "expression.h" /* For language.h */
#include "language.h"
#include "ui-out.h"
+#include "gdbsupport/format.h"
+#include "cli/cli-style.h"
#include <vector>
#include <memory>
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);
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;
#include <vector>
#include "gdbsupport/enum-flags.h"
+#include "ui-style.h"
class ui_out_level;
class ui_out_table;
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:
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);
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)