gdb/interps.h - gdb

Data types defined

Macros defined

Source code

  1. /* Manages interpreters for GDB, the GNU debugger.

  2.    Copyright (C) 2000-2015 Free Software Foundation, Inc.

  3.    Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #ifndef INTERPS_H
  16. #define INTERPS_H

  17. struct ui_out;
  18. struct interp;

  19. extern int interp_resume (struct interp *interp);
  20. extern int interp_suspend (struct interp *interp);
  21. extern struct gdb_exception interp_exec (struct interp *interp,
  22.                                          const char *command);
  23. extern int interp_quiet_p (struct interp *interp);

  24. typedef void *(interp_init_ftype) (struct interp *self, int top_level);
  25. typedef int (interp_resume_ftype) (void *data);
  26. typedef int (interp_suspend_ftype) (void *data);
  27. typedef struct gdb_exception (interp_exec_ftype) (void *data,
  28.                                                   const char *command);
  29. typedef void (interp_command_loop_ftype) (void *data);
  30. typedef struct ui_out *(interp_ui_out_ftype) (struct interp *self);

  31. typedef int (interp_set_logging_ftype) (struct interp *self, int start_log,
  32.                                         struct ui_file *out,
  33.                                         struct ui_file *logfile);

  34. struct interp_procs
  35. {
  36.   interp_init_ftype *init_proc;
  37.   interp_resume_ftype *resume_proc;
  38.   interp_suspend_ftype *suspend_proc;
  39.   interp_exec_ftype *exec_proc;

  40.   /* Returns the ui_out currently used to collect results for this
  41.      interpreter.  It can be a formatter for stdout, as is the case
  42.      for the console & mi outputs, or it might be a result
  43.      formatter.  */
  44.   interp_ui_out_ftype *ui_out_proc;

  45.   /* Provides a hook for interpreters to do any additional
  46.      setup/cleanup that they might need when logging is enabled or
  47.      disabled.  */
  48.   interp_set_logging_ftype *set_logging_proc;

  49.   interp_command_loop_ftype *command_loop_proc;
  50. };

  51. extern struct interp *interp_new (const char *name, const struct interp_procs *procs);
  52. extern void interp_add (struct interp *interp);
  53. extern int interp_set (struct interp *interp, int top_level);
  54. extern struct interp *interp_lookup (const char *name);
  55. extern struct ui_out *interp_ui_out (struct interp *interp);
  56. extern void *interp_data (struct interp *interp);
  57. extern const char *interp_name (struct interp *interp);
  58. extern struct interp *interp_set_temp (const char *name);

  59. extern int current_interp_named_p (const char *name);

  60. extern void current_interp_command_loop (void);

  61. /* Call this function to give the current interpreter an opportunity
  62.    to do any special handling of streams when logging is enabled or
  63.    disabled.  START_LOG is 1 when logging is starting, 0 when it ends,
  64.    and OUT is the stream for the log file; it will be NULL when
  65.    logging is ending.  LOGFILE is non-NULL if the output streams
  66.    are to be tees, with the log file as one of the outputs.  */

  67. extern int current_interp_set_logging (int start_log, struct ui_file *out,
  68.                                        struct ui_file *logfile);

  69. /* Returns opaque data associated with the top-level interpreter.  */
  70. extern void *top_level_interpreter_data (void);
  71. extern struct interp *top_level_interpreter (void);

  72. extern struct interp *command_interp (void);

  73. /* True if the current interpreter is in async mode, false if in sync
  74.    mode.  If in sync mode, running a synchronous execution command
  75.    (with execute_command, e.g, "next") will not return until the
  76.    command is finished.  If in async mode, then running a synchronous
  77.    command returns right after resuming the target.  Waiting for the
  78.    command's completion is later done on the top event loop (using
  79.    continuations).  */
  80. extern int interpreter_async;

  81. extern void clear_interpreter_hooks (void);

  82. /* well-known interpreters */
  83. #define INTERP_CONSOLE                "console"
  84. #define INTERP_MI1             "mi1"
  85. #define INTERP_MI2             "mi2"
  86. #define INTERP_MI3             "mi3"
  87. #define INTERP_MI                "mi"
  88. #define INTERP_TUI                "tui"
  89. #define INTERP_INSIGHT                "insight"

  90. #endif