GDB (API)
/home/stan/gdb/src/gdb/gdbtk/generic/gdbtk.h
Go to the documentation of this file.
00001 /* Tcl/Tk interface routines header file.
00002    Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2008
00003    Free Software Foundation, Inc.
00004 
00005    Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
00006 
00007    This file is part of GDB.  It contains the public data that is shared between
00008    the gdbtk startup code and the gdbtk commands.
00009 
00010    This program is free software; you can redistribute it and/or modify
00011    it under the terms of the GNU General Public License as published by
00012    the Free Software Foundation; either version 2 of the License, or
00013    (at your option) any later version.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00023    Boston, MA 02110-1301, USA.  */
00024 
00025 #ifndef _GDBTK_H
00026 #define _GDBTK_H
00027 
00028 #ifdef _WIN32
00029 #define GDBTK_PATH_SEP ";"
00030 #else
00031 #define GDBTK_PATH_SEP ":"
00032 #endif
00033 
00034 /* Some versions (1.3.79, 1.3.81) of Linux don't support SIOCSPGRP the way
00035    gdbtk wants to use it... */
00036 #ifdef __linux__
00037 #undef SIOCSPGRP
00038 #endif
00039 
00040 /*
00041  *  These are the version numbers for GDBTK.  There is a package require
00042  *  statement in main.tcl that checks the version.  If you make an incompatible
00043  *  change to the gdb commands, or add any new commands, be sure to bump the
00044  *  version number both here and in main.tcl.  This will save us the trouble of
00045  *  having a version of gdb find the wrong versions of the Tcl libraries.
00046  */
00047 
00048 #define GDBTK_MAJOR_VERSION "1"
00049 #define GDBTK_MINOR_VERSION "0"
00050 #define GDBTK_VERSION       "1.0"
00051 
00052 /*
00053  * These are variables that are needed in gdbtk commands. 
00054  */
00055 
00056 /* This variable determines where memory used for disassembly is read from.
00057    If > 0, then disassembly comes from the exec file rather than the
00058    target (which might be at the other end of a slow serial link).  If
00059    == 0 then disassembly comes from target.  If < 0 disassembly is
00060    automatically switched to the target if it's an inferior process,
00061    otherwise the exec file is used.  It is defined in gdbtk.c */
00062 
00063 
00064 extern int disassemble_from_exec;
00065 
00066 /* This variable is true when the inferior is running.  Although it's
00067    possible to disable most input from widgets and thus prevent
00068    attempts to do anything while the inferior is running, any commands
00069    that get through - even a simple memory read - are Very Bad, and
00070    may cause GDB to crash or behave strangely.  So, this variable
00071    provides an extra layer of defense.  It is defined in gdbtk.c */
00072 
00073 extern int running_now;
00074 
00075 /* These two control how the GUI behaves when tracing or loading
00076    They are defined in gdbtk-cmds.c */
00077 
00078 extern int No_Update;
00079 extern int load_in_progress;
00080 
00081 /* This is the main gdbtk interpreter.  It is defined and initialized
00082    in gdbtk.c */
00083 
00084 extern Tcl_Interp *gdbtk_interp;
00085 
00086 /*
00087  * This structure controls how the gdb output is fed into gdbtk_call_wrapper invoked
00088  * commands.  See the explanation of gdbtk_fputs in gdbtk_hooks.c for more details.
00089  */
00090 
00091 typedef struct gdbtk_result
00092   {
00093     Tcl_Obj *obj_ptr;           /* This will eventually be copied over to the 
00094                                    Tcl result */
00095     int flags;                  /* Flag vector to control how the result is
00096                                    used. */
00097   }
00098 gdbtk_result;
00099 
00100 struct target_ops;
00101 struct ptid_t;
00102 
00103 /* These defines give the allowed values for the gdbtk_result.flags field. */
00104 
00105 #define GDBTK_TO_RESULT     1   /* This controls whether output from
00106                                    gdbtk_fputs goes to the command result, or 
00107                                    to gdbtk_tcl_fputs. */
00108 #define GDBTK_MAKES_LIST    2   /* whether gdbtk_fputs adds the 
00109                                    element it is outputting as a string, or
00110                                    as a separate list element. */
00111 #define GDBTK_IN_TCL_RESULT 4   /* Indicates that the result is already in the
00112                                    Tcl result.  You can use this to preserve
00113                                    error messages from functions like
00114                                    Tcl_GetIntFromObj.  You can also store the
00115                                    output of a call wrapped command directly in 
00116                                    the Tcl result if you want, but beware, it will
00117                                    not then be preserved across recursive
00118                                    gdbtk_call_wrapper invocations. */
00119 #define GDBTK_ERROR_STARTED 8   /* This one is just used in gdbtk_fputs.  If we 
00120                                    see some output on stderr, we need to clear
00121                                    the result we have been accumulating, or the 
00122                                    error and the previous successful output
00123                                    will get mixed, which would be confusing. */
00124 #define GDBTK_ERROR_ONLY    16  /* Indicates that all incoming I/O is
00125                                    to be treated as if it had arrived for gdb_stderr. This is
00126                                    used to help error_begin in utils.c. */
00127 
00128 /* This is a pointer to the gdbtk_result struct that
00129    we are currently filling.  We use the C stack to make a stack of these
00130    structures for nested calls to gdbtk commands that are invoked through
00131    the gdbtk_call_wrapper mechanism.  See that function for more details. */
00132 
00133 extern gdbtk_result *result_ptr;
00134 
00135 /* If you want to restore an old value of result_ptr whenever cleanups
00136    are run, pass this function to make_cleanup, along with the value
00137    of result_ptr you'd like to reinstate.  */
00138 extern void gdbtk_restore_result_ptr (void *);
00139 
00140 /* GDB context identifier */
00141 extern int gdb_context;
00142 
00143 /* Internal flag used to tell callers of deprecated_ui_loop_hook
00144    whether they should detach from the target. See explanations before
00145    x_event and gdb_stop. */
00146 extern int gdbtk_force_detach;
00147 
00148 /*
00149  * These functions are used in all the modules of Gdbtk.
00150  * 
00151  */
00152 
00153 extern int Gdbtk_Init (Tcl_Interp * interp);
00154 extern void gdbtk_stop_timer (void);
00155 extern void gdbtk_start_timer (void);
00156 extern void gdbtk_ignorable_warning (const char *, const char *);
00157 extern void gdbtk_interactive (void);
00158 extern int x_event (int);
00159 extern int gdbtk_two_elem_cmd (char *, char *);
00160 extern int target_is_native (struct target_ops *t);
00161 extern void gdbtk_fputs (const char *, struct ui_file *);
00162 extern struct ui_file *gdbtk_fileopen (void);
00163 extern struct ui_file *gdbtk_fileopenin (void);
00164 extern int gdbtk_disable_fputs;
00165 extern ptid_t gdbtk_get_ptid (void);
00166 
00167 #ifdef _WIN32
00168 extern void close_bfds (void);
00169 #endif /* _WIN32 */
00170 
00171 extern void
00172   TclDebug (char level, const char *fmt,...);
00173 
00174 /* A convenience macro for getting the demangled source names,
00175    regardless of the user's mangling style. */
00176 #define GDBTK_SYMBOL_SOURCE_NAME(symbol) \
00177       (SYMBOL_DEMANGLED_NAME (symbol) != NULL \
00178        ? SYMBOL_DEMANGLED_NAME (symbol)       \
00179        : SYMBOL_PRINT_NAME (symbol))
00180 
00181 
00182 /* gdbtk_add_hooks - add all the hooks to gdb.  This will get called
00183    by the startup code to fill in the hooks needed by core gdb. */
00184 extern void gdbtk_add_hooks (void);
00185 
00186 /* Initialize Insight */
00187 extern void gdbtk_init (void);
00188 
00189 /* Start Insight. Insight must have already been initialized with a call
00190    to gdbtk_init. */
00191 extern void gdbtk_source_start_file (void);
00192 #endif /* !_GDBTK_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines