GDB (xrefs)
Loading...
Searching...
No Matches
mi-out.h
Go to the documentation of this file.
1/* MI Command Set - MI output generating routines for GDB.
2 Copyright (C) 2000-2023 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions (a Red Hat company).
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef MI_MI_OUT_H
21#define MI_MI_OUT_H
22
23#include <vector>
24
25struct ui_out;
26struct ui_file;
27
28
29class mi_ui_out : public ui_out
30{
31public:
32
33 explicit mi_ui_out (int mi_version);
34 virtual ~mi_ui_out ();
35
36 /* MI-specific */
37 void rewind ();
38 void put (struct ui_file *stream);
39
40 /* Return the version number of the current MI. */
41 int version ();
42
43 bool can_emit_style_escape () const override
44 {
45 return false;
46 }
47
48protected:
49
50 virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
51 override;
52 virtual void do_table_body () override;
53 virtual void do_table_header (int width, ui_align align,
54 const std::string &col_name,
55 const std::string &col_hdr) override;
56 virtual void do_table_end () override;
57
58 virtual void do_begin (ui_out_type type, const char *id) override;
59 virtual void do_end (ui_out_type type) override;
60 virtual void do_field_signed (int fldno, int width, ui_align align,
61 const char *fldname, LONGEST value) override;
62 virtual void do_field_unsigned (int fldno, int width, ui_align align,
63 const char *fldname, ULONGEST value)
64 override;
65 virtual void do_field_skip (int fldno, int width, ui_align align,
66 const char *fldname) override;
67 virtual void do_field_string (int fldno, int width, ui_align align,
68 const char *fldname, const char *string,
69 const ui_file_style &style) override;
70 virtual void do_field_fmt (int fldno, int width, ui_align align,
71 const char *fldname, const ui_file_style &style,
72 const char *format, va_list args)
73 override ATTRIBUTE_PRINTF (7,0);
74 virtual void do_spaces (int numspaces) override;
75 virtual void do_text (const char *string) override;
76 virtual void do_message (const ui_file_style &style,
77 const char *format, va_list args) override
78 ATTRIBUTE_PRINTF (3,0);
79 virtual void do_wrap_hint (int indent) override;
80 virtual void do_flush () override;
81 virtual void do_redirect (struct ui_file *outstream) override;
82
83 virtual bool do_is_mi_like_p () const override
84 { return true; }
85
86 virtual void do_progress_start () override;
87 virtual void do_progress_notify (const std::string &, const char *,
88 double, double) override;
89
90 virtual void do_progress_end () override;
91
92private:
93
94 void field_separator ();
95 void open (const char *name, ui_out_type type);
96 void close (ui_out_type type);
97
98 /* The state of a recent progress_update. */
100 {
101 /* The current state. */
102 progress_update::state state;
103
105 : state (progress_update::START)
106 {}
107 };
108
109 /* Stack of progress info. */
110 std::vector<mi_progress_info> m_progress_info;
111
112 /* Convenience method that returns the MI out's string stream cast
113 to its appropriate type. Assumes/asserts that output was not
114 redirected. */
116
117 /* Helper for the constructor, deduce ui_out_flags for the given
118 MI_VERSION. */
119 static ui_out_flags make_flags (int mi_version)
120 {
121 ui_out_flags flags = 0;
122
123 /* In MI version 2 and below, multi-location breakpoints had a wrong
124 syntax. It is fixed in version 3. */
125 if (mi_version >= 3)
127
128 /* In MI version 3 and below, the "script" field in breakpoint output
129 had a wrong syntax. It is fixed in version 4. */
130 if (mi_version >= 4)
132
133 return flags;
134 }
135
139 std::vector<ui_file *> m_streams;
140};
141
142/* Create an MI ui-out object with MI version MI_VERSION, which should be equal
143 to one of the INTERP_MI* constants (see interps.h).
144
145 Return nullptr if an invalid version is provided. */
146std::unique_ptr<mi_ui_out> mi_out_new (const char *mi_version);
147
148void mi_out_put (ui_out *uiout, struct ui_file *stream);
149void mi_out_rewind (ui_out *uiout);
150
151#endif /* MI_MI_OUT_H */
const char *const name
bool m_suppress_field_separator
Definition mi-out.h:136
virtual void do_table_header(int width, ui_align align, const std::string &col_name, const std::string &col_hdr) override
Definition mi-out.c:66
virtual void do_table_begin(int nbrofcols, int nr_rows, const char *tblid) override
Definition mi-out.c:35
virtual void do_field_fmt(int fldno, int width, ui_align align, const char *fldname, const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF(7
Definition mi-out.c:144
virtual void do_field_signed(int fldno, int width, ui_align align, const char *fldname, LONGEST value) override
Definition mi-out.c:99
virtual void do_field_skip(int fldno, int width, ui_align align, const char *fldname) override
Definition mi-out.c:119
virtual void do_begin(ui_out_type type, const char *id) override
Definition mi-out.c:83
virtual void do_progress_notify(const std::string &, const char *, double, double) override
Definition mi-out.c:274
void field_separator()
Definition mi-out.c:198
void put(struct ui_file *stream)
Definition mi-out.c:305
virtual void do_flush() override
Definition mi-out.c:182
virtual void do_field_string(int fldno, int width, ui_align align, const char *fldname, const char *string, const ui_file_style &style) override
Definition mi-out.c:128
void rewind()
Definition mi-out.c:297
virtual void virtual void do_spaces(int numspaces) override
Definition mi-out.c:160
std::vector< mi_progress_info > m_progress_info
Definition mi-out.h:110
virtual bool do_is_mi_like_p() const override
Definition mi-out.h:83
virtual void do_table_end() override
Definition mi-out.c:57
virtual void do_progress_end() override
Definition mi-out.c:289
virtual void do_redirect(struct ui_file *outstream) override
Definition mi-out.c:189
virtual void do_progress_start() override
Definition mi-out.c:266
bool can_emit_style_escape() const override
Definition mi-out.h:43
virtual void do_message(const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF(3
Definition mi-out.c:170
virtual void do_table_body() override
Definition mi-out.c:47
bool m_suppress_output
Definition mi-out.h:137
std::vector< ui_file * > m_streams
Definition mi-out.h:139
virtual void do_end(ui_out_type type) override
Definition mi-out.c:91
string_file * main_stream()
Definition mi-out.c:255
static ui_out_flags make_flags(int mi_version)
Definition mi-out.h:119
int version()
Definition mi-out.c:316
virtual ~mi_ui_out()
Definition mi-out.c:333
int m_mi_version
Definition mi-out.h:138
void close(ui_out_type type)
Definition mi-out.c:233
virtual void do_text(const char *string) override
Definition mi-out.c:165
mi_ui_out(int mi_version)
Definition mi-out.c:323
void open(const char *name, ui_out_type type)
Definition mi-out.c:207
virtual void virtual void do_wrap_hint(int indent) override
Definition mi-out.c:176
virtual void do_field_unsigned(int fldno, int width, ui_align align, const char *fldname, ULONGEST value) override
Definition mi-out.c:109
static void ATTRIBUTE_PRINTF(1, 0)
Definition gdb_bfd.c:1154
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
void mi_out_rewind(ui_out *uiout)
Definition mi-out.c:370
void mi_out_put(ui_out *uiout, struct ui_file *stream)
Definition mi-out.c:364
std::unique_ptr< mi_ui_out > mi_out_new(const char *mi_version)
Definition mi-out.c:340
progress_update::state state
Definition mi-out.h:102
Definition value.h:130
ui_out_type
Definition ui-out.h:70
ui_align
Definition ui-out.h:44
@ fix_multi_location_breakpoint_output
Definition ui-out.h:55
@ fix_breakpoint_script_output
Definition ui-out.h:59