GNU Binutils with patches for OS216
Revisión | ad89c4348a82c78beb4b590c50fdb8bf48919c24 (tree) |
---|---|
Tiempo | 2019-06-07 01:35:18 |
Autor | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
Remove the ui_out_style_kind enum
This also converts a few more spots to use %ps, just to try it out.
@@ -5836,14 +5836,14 @@ print_breakpoint_location (struct breakpoint *b, | ||
5836 | 5836 | { |
5837 | 5837 | uiout->text ("in "); |
5838 | 5838 | uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), |
5839 | - ui_out_style_kind::FUNCTION); | |
5839 | + function_name_style.style ()); | |
5840 | 5840 | uiout->text (" "); |
5841 | 5841 | uiout->wrap_hint (wrap_indent_at_field (uiout, "what")); |
5842 | 5842 | uiout->text ("at "); |
5843 | 5843 | } |
5844 | 5844 | uiout->field_string ("file", |
5845 | 5845 | symtab_to_filename_for_display (loc->symtab), |
5846 | - ui_out_style_kind::FILE); | |
5846 | + file_name_style.style ()); | |
5847 | 5847 | uiout->text (":"); |
5848 | 5848 | |
5849 | 5849 | if (uiout->is_mi_like_p ()) |
@@ -6693,9 +6693,9 @@ describe_other_breakpoints (struct gdbarch *gdbarch, | ||
6693 | 6693 | (others > 1) ? "," |
6694 | 6694 | : ((others == 1) ? " and" : "")); |
6695 | 6695 | } |
6696 | - current_uiout->message (_("also set at pc %pS%s%pN.\n"), | |
6697 | - ptr (ui_out_style_kind::ADDRESS), | |
6698 | - paddress (gdbarch, pc), nullptr); | |
6696 | + current_uiout->message (_("also set at pc %ps.\n"), | |
6697 | + styled_string (address_style.style (), | |
6698 | + paddress (gdbarch, pc)).ptr ()); | |
6699 | 6699 | } |
6700 | 6700 | } |
6701 | 6701 |
@@ -13355,12 +13355,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal) | ||
13355 | 13355 | if (sym) |
13356 | 13356 | { |
13357 | 13357 | uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), |
13358 | - ui_out_style_kind::FUNCTION); | |
13358 | + function_name_style.style ()); | |
13359 | 13359 | uiout->text (" at "); |
13360 | 13360 | } |
13361 | 13361 | uiout->field_string ("file", |
13362 | 13362 | symtab_to_filename_for_display (sal2.symtab), |
13363 | - ui_out_style_kind::FILE); | |
13363 | + file_name_style.style ()); | |
13364 | 13364 | uiout->text (":"); |
13365 | 13365 | |
13366 | 13366 | if (uiout->is_mi_like_p ()) |
@@ -73,7 +73,7 @@ cli_ui_out::do_table_header (int width, ui_align alignment, | ||
73 | 73 | return; |
74 | 74 | |
75 | 75 | do_field_string (0, width, alignment, 0, col_hdr.c_str (), |
76 | - ui_out_style_kind::DEFAULT); | |
76 | + ui_file_style ()); | |
77 | 77 | } |
78 | 78 | |
79 | 79 | /* Mark beginning of a list */ |
@@ -102,7 +102,7 @@ cli_ui_out::do_field_int (int fldno, int width, ui_align alignment, | ||
102 | 102 | std::string str = string_printf ("%d", value); |
103 | 103 | |
104 | 104 | do_field_string (fldno, width, alignment, fldname, str.c_str (), |
105 | - ui_out_style_kind::DEFAULT); | |
105 | + ui_file_style ()); | |
106 | 106 | } |
107 | 107 | |
108 | 108 | /* used to omit a field */ |
@@ -115,28 +115,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment, | ||
115 | 115 | return; |
116 | 116 | |
117 | 117 | do_field_string (fldno, width, alignment, fldname, "", |
118 | - ui_out_style_kind::DEFAULT); | |
119 | -} | |
120 | - | |
121 | -static ui_file_style | |
122 | -style_from_style_kind (ui_out_style_kind kind) | |
123 | -{ | |
124 | - switch (kind) | |
125 | - { | |
126 | - case ui_out_style_kind::DEFAULT: | |
127 | - /* Nothing. */ | |
128 | - return {}; | |
129 | - case ui_out_style_kind::FILE: | |
130 | - return file_name_style.style (); | |
131 | - case ui_out_style_kind::FUNCTION: | |
132 | - return function_name_style.style (); | |
133 | - case ui_out_style_kind::VARIABLE: | |
134 | - return variable_name_style.style (); | |
135 | - case ui_out_style_kind::ADDRESS: | |
136 | - return address_style.style (); | |
137 | - default: | |
138 | - gdb_assert_not_reached ("missing case"); | |
139 | - } | |
118 | + ui_file_style ()); | |
140 | 119 | } |
141 | 120 | |
142 | 121 | /* other specific cli_field_* end up here so alignment and field |
@@ -145,7 +124,7 @@ style_from_style_kind (ui_out_style_kind kind) | ||
145 | 124 | void |
146 | 125 | cli_ui_out::do_field_string (int fldno, int width, ui_align align, |
147 | 126 | const char *fldname, const char *string, |
148 | - ui_out_style_kind style) | |
127 | + const ui_file_style &style) | |
149 | 128 | { |
150 | 129 | int before = 0; |
151 | 130 | int after = 0; |
@@ -180,10 +159,7 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align, | ||
180 | 159 | spaces (before); |
181 | 160 | |
182 | 161 | if (string) |
183 | - { | |
184 | - ui_file_style fstyle = style_from_style_kind (style); | |
185 | - fputs_styled (string, fstyle, m_streams.back ()); | |
186 | - } | |
162 | + fputs_styled (string, style, m_streams.back ()); | |
187 | 163 | |
188 | 164 | if (after) |
189 | 165 | spaces (after); |
@@ -205,7 +181,7 @@ cli_ui_out::do_field_fmt (int fldno, int width, ui_align align, | ||
205 | 181 | std::string str = string_vprintf (format, args); |
206 | 182 | |
207 | 183 | do_field_string (fldno, width, align, fldname, str.c_str (), |
208 | - ui_out_style_kind::DEFAULT); | |
184 | + ui_file_style ()); | |
209 | 185 | } |
210 | 186 | |
211 | 187 | void |
@@ -227,14 +203,13 @@ cli_ui_out::do_text (const char *string) | ||
227 | 203 | } |
228 | 204 | |
229 | 205 | void |
230 | -cli_ui_out::do_message (ui_out_style_kind style, | |
206 | +cli_ui_out::do_message (const ui_file_style &style, | |
231 | 207 | const char *format, va_list args) |
232 | 208 | { |
233 | 209 | if (m_suppress_output) |
234 | 210 | return; |
235 | 211 | |
236 | - ui_file_style fstyle = style_from_style_kind (style); | |
237 | - vfprintf_styled (m_streams.back (), fstyle, format, args); | |
212 | + vfprintf_styled (m_streams.back (), style, format, args); | |
238 | 213 | } |
239 | 214 | |
240 | 215 | void |
@@ -52,14 +52,14 @@ protected: | ||
52 | 52 | virtual void do_field_string (int fldno, int width, ui_align align, |
53 | 53 | const char *fldname, |
54 | 54 | const char *string, |
55 | - ui_out_style_kind style) override; | |
55 | + const ui_file_style &style) override; | |
56 | 56 | virtual void do_field_fmt (int fldno, int width, ui_align align, |
57 | 57 | const char *fldname, const char *format, |
58 | 58 | va_list args) |
59 | 59 | override ATTRIBUTE_PRINTF (6,0); |
60 | 60 | virtual void do_spaces (int numspaces) override; |
61 | 61 | virtual void do_text (const char *string) override; |
62 | - virtual void do_message (ui_out_style_kind style, | |
62 | + virtual void do_message (const ui_file_style &style, | |
63 | 63 | const char *format, va_list args) override |
64 | 64 | ATTRIBUTE_PRINTF (3,0); |
65 | 65 | virtual void do_wrap_hint (const char *identstring) override; |
@@ -31,6 +31,7 @@ | ||
31 | 31 | #include <algorithm> |
32 | 32 | #include "common/gdb_optional.h" |
33 | 33 | #include "valprint.h" |
34 | +#include "cli/cli-style.h" | |
34 | 35 | |
35 | 36 | /* Disassemble functions. |
36 | 37 | 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 (struct ui_out *uiout, | ||
245 | 246 | uiout->text (" <"); |
246 | 247 | if ((flags & DISASSEMBLY_OMIT_FNAME) == 0) |
247 | 248 | uiout->field_string ("func-name", name.c_str (), |
248 | - ui_out_style_kind::FUNCTION); | |
249 | + function_name_style.style ()); | |
249 | 250 | uiout->text ("+"); |
250 | 251 | uiout->field_int ("offset", offset); |
251 | 252 | uiout->text (">:\t"); |
@@ -70,9 +70,9 @@ mi_ui_out::do_table_header (int width, ui_align alignment, | ||
70 | 70 | do_field_int (0, 0, ui_center, "width", width); |
71 | 71 | do_field_int (0, 0, ui_center, "alignment", alignment); |
72 | 72 | do_field_string (0, 0, ui_center, "col_name", col_name.c_str (), |
73 | - ui_out_style_kind::DEFAULT); | |
73 | + ui_file_style ()); | |
74 | 74 | do_field_string (0, width, alignment, "colhdr", col_hdr.c_str (), |
75 | - ui_out_style_kind::DEFAULT); | |
75 | + ui_file_style ()); | |
76 | 76 | close (ui_out_type_tuple); |
77 | 77 | } |
78 | 78 |
@@ -102,7 +102,7 @@ mi_ui_out::do_field_int (int fldno, int width, ui_align alignment, | ||
102 | 102 | |
103 | 103 | xsnprintf (buffer, sizeof (buffer), "%d", value); |
104 | 104 | do_field_string (fldno, width, alignment, fldname, buffer, |
105 | - ui_out_style_kind::DEFAULT); | |
105 | + ui_file_style ()); | |
106 | 106 | } |
107 | 107 | |
108 | 108 | /* Used to omit a field. */ |
@@ -119,7 +119,7 @@ mi_ui_out::do_field_skip (int fldno, int width, ui_align alignment, | ||
119 | 119 | void |
120 | 120 | mi_ui_out::do_field_string (int fldno, int width, ui_align align, |
121 | 121 | const char *fldname, const char *string, |
122 | - ui_out_style_kind style) | |
122 | + const ui_file_style &style) | |
123 | 123 | { |
124 | 124 | ui_file *stream = m_streams.back (); |
125 | 125 | field_separator (); |
@@ -159,7 +159,7 @@ mi_ui_out::do_text (const char *string) | ||
159 | 159 | } |
160 | 160 | |
161 | 161 | void |
162 | -mi_ui_out::do_message (ui_out_style_kind style, | |
162 | +mi_ui_out::do_message (const ui_file_style &style, | |
163 | 163 | const char *format, va_list args) |
164 | 164 | { |
165 | 165 | } |
@@ -58,13 +58,13 @@ protected: | ||
58 | 58 | const char *fldname) override; |
59 | 59 | virtual void do_field_string (int fldno, int width, ui_align align, |
60 | 60 | const char *fldname, const char *string, |
61 | - ui_out_style_kind style) override; | |
61 | + const ui_file_style &style) override; | |
62 | 62 | virtual void do_field_fmt (int fldno, int width, ui_align align, |
63 | 63 | const char *fldname, const char *format, va_list args) |
64 | 64 | override ATTRIBUTE_PRINTF (6,0); |
65 | 65 | virtual void do_spaces (int numspaces) override; |
66 | 66 | virtual void do_text (const char *string) override; |
67 | - virtual void do_message (ui_out_style_kind style, | |
67 | + virtual void do_message (const ui_file_style &style, | |
68 | 68 | const char *format, va_list args) override |
69 | 69 | ATTRIBUTE_PRINTF (3,0); |
70 | 70 | virtual void do_wrap_hint (const char *identstring) override; |
@@ -31,6 +31,7 @@ | ||
31 | 31 | #include "mi/mi-cmds.h" |
32 | 32 | #include "python-internal.h" |
33 | 33 | #include "common/gdb_optional.h" |
34 | +#include "cli/cli-style.h" | |
34 | 35 | |
35 | 36 | enum mi_print_types |
36 | 37 | { |
@@ -898,7 +899,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags, | ||
898 | 899 | if (function == NULL) |
899 | 900 | out->field_skip ("func"); |
900 | 901 | else |
901 | - out->field_string ("func", function, ui_out_style_kind::FUNCTION); | |
902 | + out->field_string ("func", function, function_name_style.style ()); | |
902 | 903 | } |
903 | 904 | } |
904 | 905 |
@@ -935,7 +936,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags, | ||
935 | 936 | out->text (" at "); |
936 | 937 | annotate_frame_source_file (); |
937 | 938 | out->field_string ("file", filename.get (), |
938 | - ui_out_style_kind::FILE); | |
939 | + file_name_style.style ()); | |
939 | 940 | annotate_frame_source_file_end (); |
940 | 941 | } |
941 | 942 | } |
@@ -41,6 +41,7 @@ | ||
41 | 41 | #include "common/vec.h" |
42 | 42 | #include "inferior.h" |
43 | 43 | #include <algorithm> |
44 | +#include "cli/cli-style.h" | |
44 | 45 | |
45 | 46 | static const target_info record_btrace_target_info = { |
46 | 47 | "record-btrace", |
@@ -1091,7 +1092,7 @@ btrace_call_history_src_line (struct ui_out *uiout, | ||
1091 | 1092 | |
1092 | 1093 | uiout->field_string ("file", |
1093 | 1094 | symtab_to_filename_for_display (symbol_symtab (sym)), |
1094 | - ui_out_style_kind::FILE); | |
1095 | + file_name_style.style ()); | |
1095 | 1096 | |
1096 | 1097 | btrace_compute_src_line_range (bfun, &begin, &end); |
1097 | 1098 | if (end < begin) |
@@ -1183,13 +1184,13 @@ btrace_call_history (struct ui_out *uiout, | ||
1183 | 1184 | |
1184 | 1185 | if (sym != NULL) |
1185 | 1186 | uiout->field_string ("function", SYMBOL_PRINT_NAME (sym), |
1186 | - ui_out_style_kind::FUNCTION); | |
1187 | + function_name_style.style ()); | |
1187 | 1188 | else if (msym != NULL) |
1188 | 1189 | uiout->field_string ("function", MSYMBOL_PRINT_NAME (msym), |
1189 | - ui_out_style_kind::FUNCTION); | |
1190 | + function_name_style.style ()); | |
1190 | 1191 | else if (!uiout->is_mi_like_p ()) |
1191 | 1192 | uiout->field_string ("function", "??", |
1192 | - ui_out_style_kind::FUNCTION); | |
1193 | + function_name_style.style ()); | |
1193 | 1194 | |
1194 | 1195 | if ((flags & RECORD_PRINT_INSN_RANGE) != 0) |
1195 | 1196 | { |
@@ -36,6 +36,7 @@ | ||
36 | 36 | #include "gdb_regex.h" |
37 | 37 | #include "common/gdb_optional.h" |
38 | 38 | #include <list> |
39 | +#include "cli/cli-style.h" | |
39 | 40 | |
40 | 41 | /* True if we want to print debug printouts related to file/function |
41 | 42 | skipping. */ |
@@ -414,7 +415,7 @@ info_skip_command (const char *arg, int from_tty) | ||
414 | 415 | current_uiout->field_string ("file", |
415 | 416 | e.file ().empty () ? "<none>" |
416 | 417 | : e.file ().c_str (), |
417 | - ui_out_style_kind::FILE); /* 4 */ | |
418 | + file_name_style.style ()); /* 4 */ | |
418 | 419 | if (e.function_is_regexp ()) |
419 | 420 | current_uiout->field_string ("regexp", "y"); /* 5 */ |
420 | 421 | else |
@@ -423,7 +424,7 @@ info_skip_command (const char *arg, int from_tty) | ||
423 | 424 | current_uiout->field_string ("function", |
424 | 425 | e.function ().empty () ? "<none>" |
425 | 426 | : e.function ().c_str (), |
426 | - ui_out_style_kind::FUNCTION); /* 6 */ | |
427 | + function_name_style.style ()); /* 6 */ | |
427 | 428 | |
428 | 429 | current_uiout->text ("\n"); |
429 | 430 | } |
@@ -47,6 +47,7 @@ | ||
47 | 47 | #include "gdb_bfd.h" |
48 | 48 | #include "common/filestuff.h" |
49 | 49 | #include "source.h" |
50 | +#include "cli/cli-style.h" | |
50 | 51 | |
51 | 52 | /* Architecture-specific operations. */ |
52 | 53 |
@@ -1104,7 +1105,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) | ||
1104 | 1105 | else |
1105 | 1106 | uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No"); |
1106 | 1107 | |
1107 | - uiout->field_string ("name", so->so_name, ui_out_style_kind::FILE); | |
1108 | + uiout->field_string ("name", so->so_name, file_name_style.style ()); | |
1108 | 1109 | |
1109 | 1110 | uiout->text ("\n"); |
1110 | 1111 | } |
@@ -46,6 +46,7 @@ | ||
46 | 46 | #include <algorithm> |
47 | 47 | #include "common/pathstuff.h" |
48 | 48 | #include "source-cache.h" |
49 | +#include "cli/cli-style.h" | |
49 | 50 | |
50 | 51 | #define OPEN_MODE (O_RDONLY | O_BINARY) |
51 | 52 | #define FDOPEN_MODE FOPEN_RB |
@@ -1306,7 +1307,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, | ||
1306 | 1307 | not for TUI. */ |
1307 | 1308 | if (uiout->is_mi_like_p () || uiout->test_flags (ui_source_list)) |
1308 | 1309 | uiout->field_string ("file", symtab_to_filename_for_display (s), |
1309 | - ui_out_style_kind::FILE); | |
1310 | + file_name_style.style ()); | |
1310 | 1311 | if (uiout->is_mi_like_p () || !uiout->test_flags (ui_source_list)) |
1311 | 1312 | { |
1312 | 1313 | const char *s_fullname = symtab_to_fullname (s); |
@@ -53,6 +53,7 @@ | ||
53 | 53 | #include "observable.h" |
54 | 54 | #include "common/def-vector.h" |
55 | 55 | #include "cli/cli-option.h" |
56 | +#include "cli/cli-style.h" | |
56 | 57 | |
57 | 58 | /* The possible choices of "set print frame-arguments", and the value |
58 | 59 | of this setting. */ |
@@ -341,7 +342,7 @@ print_frame_arg (const frame_print_options &fp_opts, | ||
341 | 342 | if (arg->entry_kind == print_entry_values_only |
342 | 343 | || arg->entry_kind == print_entry_values_compact) |
343 | 344 | stb.puts ("@entry"); |
344 | - uiout->field_stream ("name", stb, ui_out_style_kind::VARIABLE); | |
345 | + uiout->field_stream ("name", stb, variable_name_style.style ()); | |
345 | 346 | annotate_arg_name_end (); |
346 | 347 | uiout->text ("="); |
347 | 348 |
@@ -909,18 +910,18 @@ print_frame_info (const frame_print_options &fp_opts, | ||
909 | 910 | { |
910 | 911 | annotate_function_call (); |
911 | 912 | uiout->field_string ("func", "<function called from gdb>", |
912 | - ui_out_style_kind::FUNCTION); | |
913 | + function_name_style.style ()); | |
913 | 914 | } |
914 | 915 | else if (get_frame_type (frame) == SIGTRAMP_FRAME) |
915 | 916 | { |
916 | 917 | annotate_signal_handler_caller (); |
917 | 918 | uiout->field_string ("func", "<signal handler called>", |
918 | - ui_out_style_kind::FUNCTION); | |
919 | + function_name_style.style ()); | |
919 | 920 | } |
920 | 921 | else if (get_frame_type (frame) == ARCH_FRAME) |
921 | 922 | { |
922 | 923 | uiout->field_string ("func", "<cross-architecture call>", |
923 | - ui_out_style_kind::FUNCTION); | |
924 | + function_name_style.style ()); | |
924 | 925 | } |
925 | 926 | uiout->text ("\n"); |
926 | 927 | annotate_frame_end (); |
@@ -1262,7 +1263,7 @@ print_frame (const frame_print_options &fp_opts, | ||
1262 | 1263 | uiout->field_core_addr ("addr", gdbarch, pc); |
1263 | 1264 | else |
1264 | 1265 | uiout->field_string ("addr", "<unavailable>", |
1265 | - ui_out_style_kind::ADDRESS); | |
1266 | + address_style.style ()); | |
1266 | 1267 | annotate_frame_address_end (); |
1267 | 1268 | uiout->text (" in "); |
1268 | 1269 | } |
@@ -1271,7 +1272,7 @@ print_frame (const frame_print_options &fp_opts, | ||
1271 | 1272 | string_file stb; |
1272 | 1273 | fprintf_symbol_filtered (&stb, funname ? funname.get () : "??", |
1273 | 1274 | funlang, DMGL_ANSI); |
1274 | - uiout->field_stream ("func", stb, ui_out_style_kind::FUNCTION); | |
1275 | + uiout->field_stream ("func", stb, function_name_style.style ()); | |
1275 | 1276 | uiout->wrap_hint (" "); |
1276 | 1277 | annotate_frame_args (); |
1277 | 1278 |
@@ -1313,7 +1314,8 @@ print_frame (const frame_print_options &fp_opts, | ||
1313 | 1314 | uiout->wrap_hint (" "); |
1314 | 1315 | uiout->text (" at "); |
1315 | 1316 | annotate_frame_source_file (); |
1316 | - uiout->field_string ("file", filename_display, ui_out_style_kind::FILE); | |
1317 | + uiout->field_string ("file", filename_display, | |
1318 | + file_name_style.style ()); | |
1317 | 1319 | if (uiout->is_mi_like_p ()) |
1318 | 1320 | { |
1319 | 1321 | const char *fullname = symtab_to_fullname (sal.symtab); |
@@ -1115,11 +1115,9 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, | ||
1115 | 1115 | if (deprecated_pre_add_symbol_hook) |
1116 | 1116 | deprecated_pre_add_symbol_hook (name); |
1117 | 1117 | else |
1118 | - { | |
1119 | - puts_filtered (_("Reading symbols from ")); | |
1120 | - fputs_styled (name, file_name_style.style (), gdb_stdout); | |
1121 | - puts_filtered ("...\n"); | |
1122 | - } | |
1118 | + current_uiout->message (_("Reading symbols from %ps...\n"), | |
1119 | + styled_string (file_name_style.style (), | |
1120 | + name).ptr ()); | |
1123 | 1121 | } |
1124 | 1122 | syms_from_objfile (objfile, addrs, add_flags); |
1125 | 1123 |
@@ -1131,7 +1129,9 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, | ||
1131 | 1129 | if ((flags & OBJF_READNOW)) |
1132 | 1130 | { |
1133 | 1131 | if (should_print) |
1134 | - printf_filtered (_("Expanding full symbols from %s...\n"), name); | |
1132 | + current_uiout->message (_("Expanding full symbols from %ps...\n"), | |
1133 | + styled_string (file_name_style.style (), | |
1134 | + name).ptr ()); | |
1135 | 1135 | |
1136 | 1136 | if (objfile->sf) |
1137 | 1137 | objfile->sf->qf->expand_all_symtabs (objfile); |
@@ -1143,7 +1143,9 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, | ||
1143 | 1143 | file, and so printing it twice is just redundant. */ |
1144 | 1144 | if (should_print && !objfile_has_symbols (objfile) |
1145 | 1145 | && objfile->separate_debug_objfile == nullptr) |
1146 | - printf_filtered (_("(No debugging symbols found in %s)\n"), name); | |
1146 | + current_uiout->message (_("(No debugging symbols found in %ps)\n"), | |
1147 | + styled_string (file_name_style.style (), | |
1148 | + name).ptr ()); | |
1147 | 1149 | |
1148 | 1150 | if (should_print) |
1149 | 1151 | { |
@@ -4605,7 +4605,7 @@ print_symbol_info (enum search_domain kind, | ||
4605 | 4605 | { |
4606 | 4606 | current_uiout->message |
4607 | 4607 | (_("\nFile %ps:\n"), |
4608 | - styled_string (ui_out_style_kind::FILE, s_filename).ptr ()); | |
4608 | + styled_string (file_name_style.style (), s_filename).ptr ()); | |
4609 | 4609 | } |
4610 | 4610 | |
4611 | 4611 | if (SYMBOL_LINE (sym) != 0) |
@@ -4652,13 +4652,13 @@ print_msymbol_info (struct bound_minimal_symbol msymbol) | ||
4652 | 4652 | tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol), |
4653 | 4653 | 16); |
4654 | 4654 | |
4655 | - ui_out_style_kind sym_style = (msymbol.minsym->text_p () | |
4656 | - ? ui_out_style_kind::FUNCTION | |
4657 | - : ui_out_style_kind::DEFAULT); | |
4655 | + ui_file_style sym_style = (msymbol.minsym->text_p () | |
4656 | + ? function_name_style.style () | |
4657 | + : ui_file_style ()); | |
4658 | 4658 | |
4659 | 4659 | current_uiout->message |
4660 | 4660 | (_("%ps %ps\n"), |
4661 | - styled_string (ui_out_style_kind::ADDRESS, tmp).ptr (), | |
4661 | + styled_string (address_style.style (), tmp).ptr (), | |
4662 | 4662 | styled_string (sym_style, MSYMBOL_PRINT_NAME (msymbol.minsym)).ptr ()); |
4663 | 4663 | } |
4664 | 4664 |
@@ -57,6 +57,7 @@ | ||
57 | 57 | #include "tracefile.h" |
58 | 58 | #include "location.h" |
59 | 59 | #include <algorithm> |
60 | +#include "cli/cli-style.h" | |
60 | 61 | |
61 | 62 | /* readline include files */ |
62 | 63 | #include "readline/readline.h" |
@@ -3690,7 +3691,7 @@ print_one_static_tracepoint_marker (int count, | ||
3690 | 3691 | { |
3691 | 3692 | uiout->text ("in "); |
3692 | 3693 | uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), |
3693 | - ui_out_style_kind::FUNCTION); | |
3694 | + function_name_style.style ()); | |
3694 | 3695 | uiout->wrap_hint (wrap_indent); |
3695 | 3696 | uiout->text (" at "); |
3696 | 3697 | } |
@@ -3701,7 +3702,7 @@ print_one_static_tracepoint_marker (int count, | ||
3701 | 3702 | { |
3702 | 3703 | uiout->field_string ("file", |
3703 | 3704 | symtab_to_filename_for_display (sal.symtab), |
3704 | - ui_out_style_kind::FILE); | |
3705 | + file_name_style.style ()); | |
3705 | 3706 | uiout->text (":"); |
3706 | 3707 | |
3707 | 3708 | if (uiout->is_mi_like_p ()) |
@@ -52,7 +52,7 @@ tui_ui_out::do_field_int (int fldno, int width, ui_align alignment, | ||
52 | 52 | void |
53 | 53 | tui_ui_out::do_field_string (int fldno, int width, ui_align align, |
54 | 54 | const char *fldname, const char *string, |
55 | - ui_out_style_kind style) | |
55 | + const ui_file_style &style) | |
56 | 56 | { |
57 | 57 | if (suppress_output ()) |
58 | 58 | return; |
@@ -35,7 +35,7 @@ protected: | ||
35 | 35 | void do_field_int (int fldno, int width, ui_align align, const char *fldname, |
36 | 36 | int value) override; |
37 | 37 | void do_field_string (int fldno, int width, ui_align align, const char *fldname, |
38 | - const char *string, ui_out_style_kind style) override; | |
38 | + const char *string, const ui_file_style &style) override; | |
39 | 39 | void do_field_fmt (int fldno, int width, ui_align align, const char *fldname, |
40 | 40 | const char *format, va_list args) override |
41 | 41 | ATTRIBUTE_PRINTF (6,0); |
@@ -25,6 +25,7 @@ | ||
25 | 25 | #include "language.h" |
26 | 26 | #include "ui-out.h" |
27 | 27 | #include "common/format.h" |
28 | +#include "cli/cli-style.h" | |
28 | 29 | |
29 | 30 | #include <vector> |
30 | 31 | #include <memory> |
@@ -470,12 +471,12 @@ ui_out::field_core_addr (const char *fldname, struct gdbarch *gdbarch, | ||
470 | 471 | CORE_ADDR address) |
471 | 472 | { |
472 | 473 | field_string (fldname, print_core_address (gdbarch, address), |
473 | - ui_out_style_kind::ADDRESS); | |
474 | + address_style.style ()); | |
474 | 475 | } |
475 | 476 | |
476 | 477 | void |
477 | 478 | ui_out::field_stream (const char *fldname, string_file &stream, |
478 | - ui_out_style_kind style) | |
479 | + const ui_file_style &style) | |
479 | 480 | { |
480 | 481 | if (!stream.empty ()) |
481 | 482 | field_string (fldname, stream.c_str (), style); |
@@ -500,7 +501,7 @@ ui_out::field_skip (const char *fldname) | ||
500 | 501 | |
501 | 502 | void |
502 | 503 | ui_out::field_string (const char *fldname, const char *string, |
503 | - ui_out_style_kind style) | |
504 | + const ui_file_style &style) | |
504 | 505 | { |
505 | 506 | int fldno; |
506 | 507 | int width; |
@@ -548,7 +549,8 @@ ui_out::text (const char *string) | ||
548 | 549 | } |
549 | 550 | |
550 | 551 | void |
551 | -ui_out::call_do_message (ui_out_style_kind style, const char *format, ...) | |
552 | +ui_out::call_do_message (const ui_file_style &style, const char *format, | |
553 | + ...) | |
552 | 554 | { |
553 | 555 | va_list args; |
554 | 556 |
@@ -562,7 +564,7 @@ ui_out::message (const char *format, ...) | ||
562 | 564 | { |
563 | 565 | format_pieces fpieces (&format, true); |
564 | 566 | |
565 | - ui_out_style_kind style = ui_out_style_kind::DEFAULT; | |
567 | + ui_file_style style; | |
566 | 568 | |
567 | 569 | va_list args; |
568 | 570 | va_start (args, format); |
@@ -618,13 +620,13 @@ ui_out::message (const char *format, ...) | ||
618 | 620 | call_do_message (ss->style (), "%s", ss->str ()); |
619 | 621 | } |
620 | 622 | break; |
621 | - case 'S': | |
622 | - style = *va_arg (args, ui_out_style_kind *); | |
623 | - break; | |
624 | - case 'N': | |
625 | - va_arg (args, void *); | |
626 | - style = ui_out_style_kind::DEFAULT; | |
627 | - break; | |
623 | + /* case 'S': */ | |
624 | + /* style = *va_arg (args, const ui_file_style *); */ | |
625 | + /* break; */ | |
626 | + /* case 'N': */ | |
627 | + /* va_arg (args, void *); */ | |
628 | + /* style = nullptr; */ | |
629 | + /* break; */ | |
628 | 630 | default: |
629 | 631 | call_do_message (style, current_substring, va_arg (args, void *)); |
630 | 632 | break; |
@@ -26,6 +26,7 @@ | ||
26 | 26 | #include <vector> |
27 | 27 | |
28 | 28 | #include "common/enum-flags.h" |
29 | +#include "ui-style.h" | |
29 | 30 | |
30 | 31 | class ui_out_level; |
31 | 32 | class ui_out_table; |
@@ -67,22 +68,6 @@ enum ui_out_type | ||
67 | 68 | ui_out_type_list |
68 | 69 | }; |
69 | 70 | |
70 | -/* Possible kinds of styling. */ | |
71 | - | |
72 | -enum class ui_out_style_kind | |
73 | -{ | |
74 | - /* The default (plain) style. */ | |
75 | - DEFAULT, | |
76 | - /* File name. */ | |
77 | - FILE, | |
78 | - /* Function name. */ | |
79 | - FUNCTION, | |
80 | - /* Variable name. */ | |
81 | - VARIABLE, | |
82 | - /* Address. */ | |
83 | - ADDRESS | |
84 | -}; | |
85 | - | |
86 | 71 | struct int_field |
87 | 72 | { |
88 | 73 | int_field (const char *name, int val) |
@@ -105,7 +90,7 @@ private: | ||
105 | 90 | |
106 | 91 | struct styled_string |
107 | 92 | { |
108 | - styled_string (ui_out_style_kind style, const char *str) | |
93 | + styled_string (const ui_file_style &style, const char *str) | |
109 | 94 | : m_style (style), |
110 | 95 | m_str (str) |
111 | 96 | { |
@@ -115,32 +100,14 @@ struct styled_string | ||
115 | 100 | va_args. */ |
116 | 101 | const styled_string *ptr () const { return this; } |
117 | 102 | |
118 | - ui_out_style_kind style () const {return m_style; } | |
103 | + const ui_file_style &style () const { return m_style; } | |
119 | 104 | const char *str () const {return m_str; } |
120 | 105 | |
121 | 106 | private: |
122 | - ui_out_style_kind m_style; | |
107 | + ui_file_style m_style; | |
123 | 108 | const char *m_str; |
124 | 109 | }; |
125 | 110 | |
126 | -/* Wrap a ui_out_style_kind in a pointer to a temporary. */ | |
127 | - | |
128 | -/* XXX: Make a template? */ | |
129 | -struct ptrS | |
130 | -{ | |
131 | - ptrS (ui_out_style_kind t) : m_t (t) {} | |
132 | - | |
133 | - const ui_out_style_kind *ptr () const { return &m_t; } | |
134 | - | |
135 | - ui_out_style_kind m_t; | |
136 | -}; | |
137 | - | |
138 | -static inline const ui_out_style_kind * | |
139 | -ptr (ptrS &&t) | |
140 | -{ | |
141 | - return t.ptr (); | |
142 | -} | |
143 | - | |
144 | 111 | class ui_out |
145 | 112 | { |
146 | 113 | public: |
@@ -171,10 +138,10 @@ class ui_out | ||
171 | 138 | void field_core_addr (const char *fldname, struct gdbarch *gdbarch, |
172 | 139 | CORE_ADDR address); |
173 | 140 | void field_string (const char *fldname, const char *string, |
174 | - ui_out_style_kind style = ui_out_style_kind::DEFAULT); | |
141 | + const ui_file_style &style = ui_file_style ()); | |
175 | 142 | void field_string (const char *fldname, const std::string &string); |
176 | 143 | void field_stream (const char *fldname, string_file &stream, |
177 | - ui_out_style_kind style = ui_out_style_kind::DEFAULT); | |
144 | + const ui_file_style &style = ui_file_style ()); | |
178 | 145 | void field_skip (const char *fldname); |
179 | 146 | void field_fmt (const char *fldname, const char *format, ...) |
180 | 147 | ATTRIBUTE_PRINTF (3, 4); |
@@ -219,14 +186,14 @@ class ui_out | ||
219 | 186 | const char *fldname) = 0; |
220 | 187 | virtual void do_field_string (int fldno, int width, ui_align align, |
221 | 188 | const char *fldname, const char *string, |
222 | - ui_out_style_kind style) = 0; | |
189 | + const ui_file_style &style) = 0; | |
223 | 190 | virtual void do_field_fmt (int fldno, int width, ui_align align, |
224 | 191 | const char *fldname, const char *format, |
225 | 192 | va_list args) |
226 | 193 | ATTRIBUTE_PRINTF (6,0) = 0; |
227 | 194 | virtual void do_spaces (int numspaces) = 0; |
228 | 195 | virtual void do_text (const char *string) = 0; |
229 | - virtual void do_message (ui_out_style_kind style, | |
196 | + virtual void do_message (const ui_file_style &style, | |
230 | 197 | const char *format, va_list args) |
231 | 198 | ATTRIBUTE_PRINTF (3,0) = 0; |
232 | 199 | virtual void do_wrap_hint (const char *identstring) = 0; |
@@ -240,7 +207,8 @@ class ui_out | ||
240 | 207 | { return false; } |
241 | 208 | |
242 | 209 | private: |
243 | - void call_do_message (ui_out_style_kind style, const char *format, ...); | |
210 | + void call_do_message (const ui_file_style &style, const char *format, | |
211 | + ...); | |
244 | 212 | |
245 | 213 | ui_out_flags m_flags; |
246 | 214 |