mi-common.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* Interface for common GDB/MI data
  2. Copyright (C) 2005-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef MI_MI_COMMON_H
  15. #define MI_MI_COMMON_H
  16. #include "interps.h"
  17. struct mi_console_file;
  18. /* Represents the reason why GDB is sending an asynchronous command to
  19. the front end. NOTE: When modifing this, don't forget to update
  20. gdb.texinfo! */
  21. enum async_reply_reason
  22. {
  23. EXEC_ASYNC_BREAKPOINT_HIT = 0,
  24. EXEC_ASYNC_WATCHPOINT_TRIGGER,
  25. EXEC_ASYNC_READ_WATCHPOINT_TRIGGER,
  26. EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER,
  27. EXEC_ASYNC_FUNCTION_FINISHED,
  28. EXEC_ASYNC_LOCATION_REACHED,
  29. EXEC_ASYNC_WATCHPOINT_SCOPE,
  30. EXEC_ASYNC_END_STEPPING_RANGE,
  31. EXEC_ASYNC_EXITED_SIGNALLED,
  32. EXEC_ASYNC_EXITED,
  33. EXEC_ASYNC_EXITED_NORMALLY,
  34. EXEC_ASYNC_SIGNAL_RECEIVED,
  35. EXEC_ASYNC_SOLIB_EVENT,
  36. EXEC_ASYNC_FORK,
  37. EXEC_ASYNC_VFORK,
  38. EXEC_ASYNC_SYSCALL_ENTRY,
  39. EXEC_ASYNC_SYSCALL_RETURN,
  40. EXEC_ASYNC_EXEC,
  41. /* This is here only to represent the number of enums. */
  42. EXEC_ASYNC_LAST
  43. };
  44. const char *async_reason_lookup (enum async_reply_reason reason);
  45. /* An MI interpreter. */
  46. class mi_interp final : public interp
  47. {
  48. public:
  49. mi_interp (const char *name)
  50. : interp (name)
  51. {}
  52. void init (bool top_level) override;
  53. void resume () override;
  54. void suspend () override;
  55. gdb_exception exec (const char *command_str) override;
  56. ui_out *interp_ui_out () override;
  57. void set_logging (ui_file_up logfile, bool logging_redirect,
  58. bool debug_redirect) override;
  59. void pre_command_loop () override;
  60. /* MI's output channels */
  61. mi_console_file *out;
  62. mi_console_file *err;
  63. mi_console_file *log;
  64. mi_console_file *targ;
  65. mi_console_file *event_channel;
  66. /* Raw console output. */
  67. struct ui_file *raw_stdout;
  68. /* Raw logfile output. */
  69. struct ui_file *raw_stdlog;
  70. /* Save the original value of raw_stdout and raw_stdlog here when logging, and
  71. the file which we need to delete, so we can restore correctly when
  72. done. */
  73. struct ui_file *saved_raw_stdout;
  74. struct ui_file *saved_raw_stdlog;
  75. struct ui_file *saved_raw_file_to_delete;
  76. /* MI's builder. */
  77. struct ui_out *mi_uiout;
  78. /* MI's CLI builder (wraps OUT). */
  79. struct ui_out *cli_uiout;
  80. };
  81. #endif /* MI_MI_COMMON_H */