1 1.1 christos /* MI Interpreter Definitions and Commands for GDB, the GNU debugger. 2 1.1 christos 3 1.1.1.5 christos Copyright (C) 2017-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This file is part of GDB. 6 1.1 christos 7 1.1 christos This program is free software; you can redistribute it and/or modify 8 1.1 christos it under the terms of the GNU General Public License as published by 9 1.1 christos the Free Software Foundation; either version 3 of the License, or 10 1.1 christos (at your option) any later version. 11 1.1 christos 12 1.1 christos This program is distributed in the hope that it will be useful, 13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 christos GNU General Public License for more details. 16 1.1 christos 17 1.1 christos You should have received a copy of the GNU General Public License 18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 1.1 christos 20 1.1.1.6 christos #ifndef GDB_MI_MI_INTERP_H 21 1.1.1.6 christos #define GDB_MI_MI_INTERP_H 22 1.1 christos 23 1.1.1.4 christos #include "interps.h" 24 1.1.1.4 christos 25 1.1.1.4 christos struct mi_console_file; 26 1.1.1.4 christos 27 1.1.1.4 christos /* An MI interpreter. */ 28 1.1.1.4 christos 29 1.1.1.4 christos class mi_interp final : public interp 30 1.1.1.4 christos { 31 1.1.1.4 christos public: 32 1.1.1.4 christos mi_interp (const char *name) 33 1.1.1.4 christos : interp (name) 34 1.1.1.4 christos {} 35 1.1.1.4 christos 36 1.1.1.4 christos void init (bool top_level) override; 37 1.1.1.4 christos void resume () override; 38 1.1.1.4 christos void suspend () override; 39 1.1.1.5 christos void exec (const char *command_str) override; 40 1.1.1.4 christos ui_out *interp_ui_out () override; 41 1.1.1.4 christos void set_logging (ui_file_up logfile, bool logging_redirect, 42 1.1.1.4 christos bool debug_redirect) override; 43 1.1.1.4 christos void pre_command_loop () override; 44 1.1.1.4 christos 45 1.1.1.5 christos void on_signal_received (gdb_signal sig) override; 46 1.1.1.5 christos void on_signal_exited (gdb_signal sig) override; 47 1.1.1.5 christos void on_normal_stop (struct bpstat *bs, int print_frame) override; 48 1.1.1.5 christos void on_exited (int status) override; 49 1.1.1.5 christos void on_no_history () override; 50 1.1.1.5 christos void on_sync_execution_done () override; 51 1.1.1.5 christos void on_command_error () override; 52 1.1.1.5 christos void on_user_selected_context_changed (user_selected_what selection) override; 53 1.1.1.5 christos void on_new_thread (thread_info *t) override; 54 1.1.1.5 christos void on_thread_exited (thread_info *t, std::optional<ULONGEST> exit_code, 55 1.1.1.5 christos int silent) override; 56 1.1.1.5 christos void on_inferior_added (inferior *inf) override; 57 1.1.1.5 christos void on_inferior_appeared (inferior *inf) override; 58 1.1.1.5 christos void on_inferior_disappeared (inferior *inf) override; 59 1.1.1.5 christos void on_inferior_removed (inferior *inf) override; 60 1.1.1.5 christos void on_record_changed (inferior *inf, int started, const char *method, 61 1.1.1.5 christos const char *format) override; 62 1.1.1.5 christos void on_target_resumed (ptid_t ptid) override; 63 1.1.1.5 christos void on_solib_loaded (const solib &so) override; 64 1.1.1.5 christos void on_solib_unloaded (const solib &so) override; 65 1.1.1.5 christos void on_about_to_proceed () override; 66 1.1.1.5 christos void on_traceframe_changed (int tfnum, int tpnum) override; 67 1.1.1.5 christos void on_tsv_created (const trace_state_variable *tsv) override; 68 1.1.1.5 christos void on_tsv_deleted (const trace_state_variable *tsv) override; 69 1.1.1.5 christos void on_tsv_modified (const trace_state_variable *tsv) override; 70 1.1.1.5 christos void on_breakpoint_created (breakpoint *b) override; 71 1.1.1.5 christos void on_breakpoint_deleted (breakpoint *b) override; 72 1.1.1.5 christos void on_breakpoint_modified (breakpoint *b) override; 73 1.1.1.5 christos void on_param_changed (const char *param, const char *value) override; 74 1.1.1.5 christos void on_memory_changed (inferior *inf, CORE_ADDR addr, ssize_t len, 75 1.1.1.5 christos const bfd_byte *data) override; 76 1.1.1.5 christos 77 1.1.1.4 christos /* MI's output channels */ 78 1.1.1.4 christos mi_console_file *out; 79 1.1.1.4 christos mi_console_file *err; 80 1.1.1.4 christos mi_console_file *log; 81 1.1.1.4 christos mi_console_file *targ; 82 1.1.1.4 christos mi_console_file *event_channel; 83 1.1.1.4 christos 84 1.1.1.4 christos /* Raw console output. */ 85 1.1.1.4 christos struct ui_file *raw_stdout; 86 1.1.1.4 christos 87 1.1.1.4 christos /* Save the original value of raw_stdout here when logging, and the 88 1.1.1.4 christos file which we need to delete, so we can restore correctly when 89 1.1.1.4 christos done. */ 90 1.1.1.4 christos struct ui_file *saved_raw_stdout; 91 1.1.1.4 christos ui_file_up logfile_holder; 92 1.1.1.4 christos ui_file_up stdout_holder; 93 1.1.1.4 christos 94 1.1.1.4 christos /* MI's builder. */ 95 1.1.1.4 christos struct ui_out *mi_uiout; 96 1.1.1.4 christos 97 1.1.1.4 christos /* MI's CLI builder (wraps OUT). */ 98 1.1.1.4 christos struct ui_out *cli_uiout; 99 1.1.1.5 christos 100 1.1.1.5 christos int running_result_record_printed = 1; 101 1.1.1.5 christos 102 1.1.1.5 christos /* Flag indicating that the target has proceeded since the last 103 1.1.1.5 christos command was issued. */ 104 1.1.1.5 christos int mi_proceeded; 105 1.1.1.5 christos 106 1.1.1.5 christos const char *current_token; 107 1.1.1.4 christos }; 108 1.1.1.4 christos 109 1.1 christos /* Output the shared object attributes to UIOUT. */ 110 1.1 christos 111 1.1.1.5 christos void mi_output_solib_attribs (ui_out *uiout, const solib &solib); 112 1.1.1.5 christos 113 1.1.1.5 christos /* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and 114 1.1.1.5 christos returns NULL otherwise. */ 115 1.1.1.5 christos 116 1.1.1.5 christos static inline struct mi_interp * 117 1.1.1.5 christos as_mi_interp (struct interp *interp) 118 1.1.1.5 christos { 119 1.1.1.5 christos return dynamic_cast<mi_interp *> (interp); 120 1.1.1.5 christos } 121 1.1 christos 122 1.1.1.6 christos #endif /* GDB_MI_MI_INTERP_H */ 123