GDB (API)
/home/stan/gdb/src/gdb/interps.h
Go to the documentation of this file.
00001 /* Manages interpreters for GDB, the GNU debugger.
00002 
00003    Copyright (C) 2000-2013 Free Software Foundation, Inc.
00004 
00005    Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
00006 
00007    This file is part of GDB.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 3 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00021 
00022 #ifndef INTERPS_H
00023 #define INTERPS_H
00024 
00025 #include "exceptions.h"
00026 
00027 struct ui_out;
00028 struct interp;
00029 
00030 extern int interp_resume (struct interp *interp);
00031 extern int interp_suspend (struct interp *interp);
00032 extern int interp_prompt_p (struct interp *interp);
00033 extern int interp_exec_p (struct interp *interp);
00034 extern struct gdb_exception interp_exec (struct interp *interp,
00035                                          const char *command);
00036 extern int interp_quiet_p (struct interp *interp);
00037 
00038 typedef void *(interp_init_ftype) (struct interp *self, int top_level);
00039 typedef int (interp_resume_ftype) (void *data);
00040 typedef int (interp_suspend_ftype) (void *data);
00041 typedef int (interp_prompt_p_ftype) (void *data);
00042 typedef struct gdb_exception (interp_exec_ftype) (void *data,
00043                                                   const char *command);
00044 typedef void (interp_command_loop_ftype) (void *data);
00045 typedef struct ui_out *(interp_ui_out_ftype) (struct interp *self);
00046 
00047 typedef int (interp_set_logging_ftype) (struct interp *self, int start_log,
00048                                         struct ui_file *out,
00049                                         struct ui_file *logfile);
00050 
00051 struct interp_procs
00052 {
00053   interp_init_ftype *init_proc;
00054   interp_resume_ftype *resume_proc;
00055   interp_suspend_ftype *suspend_proc;
00056   interp_exec_ftype *exec_proc;
00057   interp_prompt_p_ftype *prompt_proc_p;
00058 
00059   /* Returns the ui_out currently used to collect results for this
00060      interpreter.  It can be a formatter for stdout, as is the case
00061      for the console & mi outputs, or it might be a result
00062      formatter.  */
00063   interp_ui_out_ftype *ui_out_proc;
00064 
00065   /* Provides a hook for interpreters to do any additional
00066      setup/cleanup that they might need when logging is enabled or
00067      disabled.  */
00068   interp_set_logging_ftype *set_logging_proc;
00069 
00070   interp_command_loop_ftype *command_loop_proc;
00071 };
00072 
00073 extern struct interp *interp_new (const char *name, const struct interp_procs *procs);
00074 extern void interp_add (struct interp *interp);
00075 extern int interp_set (struct interp *interp, int top_level);
00076 extern struct interp *interp_lookup (const char *name);
00077 extern struct ui_out *interp_ui_out (struct interp *interp);
00078 extern void *interp_data (struct interp *interp);
00079 extern const char *interp_name (struct interp *interp);
00080 extern struct interp *interp_set_temp (const char *name);
00081 
00082 extern int current_interp_named_p (const char *name);
00083 extern int current_interp_display_prompt_p (void);
00084 extern void current_interp_command_loop (void);
00085 
00086 /* Call this function to give the current interpreter an opportunity
00087    to do any special handling of streams when logging is enabled or
00088    disabled.  START_LOG is 1 when logging is starting, 0 when it ends,
00089    and OUT is the stream for the log file; it will be NULL when
00090    logging is ending.  LOGFILE is non-NULL if the output streams
00091    are to be tees, with the log file as one of the outputs.  */
00092 
00093 extern int current_interp_set_logging (int start_log, struct ui_file *out,
00094                                        struct ui_file *logfile);
00095 
00096 /* Returns opaque data associated with the top-level interpreter.  */
00097 extern void *top_level_interpreter_data (void);
00098 extern struct interp *top_level_interpreter (void);
00099 
00100 /* True if the current interpreter is in async mode, false if in sync
00101    mode.  If in sync mode, running a synchronous execution command
00102    (with execute_command, e.g, "next") will not return until the
00103    command is finished.  If in async mode, then running a synchronous
00104    command returns right after resuming the target.  Waiting for the
00105    command's completion is later done on the top event loop (using
00106    continuations).  */
00107 extern int interpreter_async;
00108 
00109 extern void clear_interpreter_hooks (void);
00110 
00111 /* well-known interpreters */
00112 #define INTERP_CONSOLE          "console"
00113 #define INTERP_MI1             "mi1"
00114 #define INTERP_MI2             "mi2"
00115 #define INTERP_MI3             "mi3"
00116 #define INTERP_MI               "mi"
00117 #define INTERP_TUI              "tui"
00118 #define INTERP_INSIGHT          "insight"
00119 
00120 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines