diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 35 | ||||
-rw-r--r-- | gdb/breakpoint.c | 8 | ||||
-rw-r--r-- | gdb/cli-out.c | 38 | ||||
-rw-r--r-- | gdb/cli-out.h | 2 | ||||
-rw-r--r-- | gdb/disasm.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-out.c | 10 | ||||
-rw-r--r-- | gdb/mi/mi-out.h | 2 | ||||
-rw-r--r-- | gdb/python/py-framefilter.c | 5 | ||||
-rw-r--r-- | gdb/record-btrace.c | 9 | ||||
-rw-r--r-- | gdb/skip.c | 5 | ||||
-rw-r--r-- | gdb/solib.c | 3 | ||||
-rw-r--r-- | gdb/source.c | 3 | ||||
-rw-r--r-- | gdb/stack.c | 16 | ||||
-rw-r--r-- | gdb/tracepoint.c | 5 | ||||
-rw-r--r-- | gdb/tui/tui-out.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-out.h | 2 | ||||
-rw-r--r-- | gdb/ui-out.c | 8 | ||||
-rw-r--r-- | gdb/ui-out.h | 23 |
18 files changed, 93 insertions, 86 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7285515..dd196d7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,38 @@ +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 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 838c9d1..dd8fe4c 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 549d518..fa72a1d 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 f38c1cc..bc8b781 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 68da682..f483a5e 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -31,6 +31,7 @@ #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 @@ -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 a668717..0b93073 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 fe96658..90528fd 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 ecd633a..f82a239 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 b55459e..c923b36 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -42,6 +42,7 @@ #include "inferior.h" #include <algorithm> #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) { @@ -36,6 +36,7 @@ #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. */ @@ -414,7 +415,7 @@ info_skip_command (const char *arg, int from_tty) 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 @@ -423,7 +424,7 @@ info_skip_command (const char *arg, int from_tty) 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"); } diff --git a/gdb/solib.c b/gdb/solib.c index 5b12469..db6a52d 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 0171f27..ff21818 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -46,6 +46,7 @@ #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 @@ -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 0f7fbf5..4899d0f 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", "<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 (); @@ -1310,7 +1311,7 @@ print_frame (const frame_print_options &fp_opts, 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 "); } @@ -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 c2c5f42..2f91e49 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -57,6 +57,7 @@ #include "tracefile.h" #include "location.h" #include <algorithm> +#include "cli/cli-style.h" #include <unistd.h> @@ -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 50865ba..d415e7b 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 083094b..9df9e93 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 91662fa..e8fe44c 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 <vector> #include <memory> @@ -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 7041d96..6732f04 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -26,6 +26,7 @@ #include <vector> #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) |