1 /* Interface for common GDB/MI data
2 Copyright (C) 2005-2019 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef MI_MI_COMMON_H
20 #define MI_MI_COMMON_H
24 struct mi_console_file;
26 /* Represents the reason why GDB is sending an asynchronous command to
27 the front end. NOTE: When modifing this, don't forget to update
29 enum async_reply_reason
31 EXEC_ASYNC_BREAKPOINT_HIT = 0,
32 EXEC_ASYNC_WATCHPOINT_TRIGGER,
33 EXEC_ASYNC_READ_WATCHPOINT_TRIGGER,
34 EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER,
35 EXEC_ASYNC_FUNCTION_FINISHED,
36 EXEC_ASYNC_LOCATION_REACHED,
37 EXEC_ASYNC_WATCHPOINT_SCOPE,
38 EXEC_ASYNC_END_STEPPING_RANGE,
39 EXEC_ASYNC_EXITED_SIGNALLED,
41 EXEC_ASYNC_EXITED_NORMALLY,
42 EXEC_ASYNC_SIGNAL_RECEIVED,
43 EXEC_ASYNC_SOLIB_EVENT,
46 EXEC_ASYNC_SYSCALL_ENTRY,
47 EXEC_ASYNC_SYSCALL_RETURN,
49 /* This is here only to represent the number of enums. */
53 const char *async_reason_lookup (enum async_reply_reason reason);
55 /* An MI interpreter. */
57 class mi_interp final : public interp
60 mi_interp (const char *name)
64 void init (bool top_level) override;
65 void resume () override;
66 void suspend () override;
67 gdb_exception exec (const char *command_str) override;
68 ui_out *interp_ui_out () override;
69 void set_logging (ui_file_up logfile, bool logging_redirect) override;
70 void pre_command_loop () override;
72 /* MI's output channels */
76 mi_console_file *targ;
77 mi_console_file *event_channel;
79 /* Raw console output. */
80 struct ui_file *raw_stdout;
82 /* Save the original value of raw_stdout here when logging, so we
83 can restore correctly when done. */
84 struct ui_file *saved_raw_stdout;
87 struct ui_out *mi_uiout;
89 /* MI's CLI builder (wraps OUT). */
90 struct ui_out *cli_uiout;
93 #endif /* MI_MI_COMMON_H */