1 /* Tcl/Tk interface routines header file.
2 Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2008
3 Free Software Foundation, Inc.
5 Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
7 This file is part of GDB. It contains the public data that is shared between
8 the gdbtk startup code and the gdbtk commands.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA. */
29 #define GDBTK_PATH_SEP ";"
31 #define GDBTK_PATH_SEP ":"
34 /* Some versions (1.3.79, 1.3.81) of Linux don't support SIOCSPGRP the way
35 gdbtk wants to use it... */
41 * These are the version numbers for GDBTK. There is a package require
42 * statement in main.tcl that checks the version. If you make an incompatible
43 * change to the gdb commands, or add any new commands, be sure to bump the
44 * version number both here and in main.tcl. This will save us the trouble of
45 * having a version of gdb find the wrong versions of the Tcl libraries.
48 #define GDBTK_MAJOR_VERSION "1"
49 #define GDBTK_MINOR_VERSION "0"
50 #define GDBTK_VERSION "1.0"
53 * These are variables that are needed in gdbtk commands.
56 /* This variable determines where memory used for disassembly is read from.
57 If > 0, then disassembly comes from the exec file rather than the
58 target (which might be at the other end of a slow serial link). If
59 == 0 then disassembly comes from target. If < 0 disassembly is
60 automatically switched to the target if it's an inferior process,
61 otherwise the exec file is used. It is defined in gdbtk.c */
64 extern int disassemble_from_exec;
66 /* This variable is true when the inferior is running. Although it's
67 possible to disable most input from widgets and thus prevent
68 attempts to do anything while the inferior is running, any commands
69 that get through - even a simple memory read - are Very Bad, and
70 may cause GDB to crash or behave strangely. So, this variable
71 provides an extra layer of defense. It is defined in gdbtk.c */
73 extern int running_now;
75 /* These two control how the GUI behaves when tracing or loading
76 They are defined in gdbtk-cmds.c */
79 extern int load_in_progress;
81 /* This is the main gdbtk interpreter. It is defined and initialized
84 extern Tcl_Interp *gdbtk_interp;
87 * This structure controls how the gdb output is fed into gdbtk_call_wrapper invoked
88 * commands. See the explanation of gdbtk_fputs in gdbtk_hooks.c for more details.
91 typedef struct gdbtk_result
93 Tcl_Obj *obj_ptr; /* This will eventually be copied over to the
95 int flags; /* Flag vector to control how the result is
103 /* These defines give the allowed values for the gdbtk_result.flags field. */
105 #define GDBTK_TO_RESULT 1 /* This controls whether output from
106 gdbtk_fputs goes to the command result, or
107 to gdbtk_tcl_fputs. */
108 #define GDBTK_MAKES_LIST 2 /* whether gdbtk_fputs adds the
109 element it is outputting as a string, or
110 as a separate list element. */
111 #define GDBTK_IN_TCL_RESULT 4 /* Indicates that the result is already in the
112 Tcl result. You can use this to preserve
113 error messages from functions like
114 Tcl_GetIntFromObj. You can also store the
115 output of a call wrapped command directly in
116 the Tcl result if you want, but beware, it will
117 not then be preserved across recursive
118 gdbtk_call_wrapper invocations. */
119 #define GDBTK_ERROR_STARTED 8 /* This one is just used in gdbtk_fputs. If we
120 see some output on stderr, we need to clear
121 the result we have been accumulating, or the
122 error and the previous successful output
123 will get mixed, which would be confusing. */
124 #define GDBTK_ERROR_ONLY 16 /* Indicates that all incoming I/O is
125 to be treated as if it had arrived for gdb_stderr. This is
126 used to help error_begin in utils.c. */
128 /* This is a pointer to the gdbtk_result struct that
129 we are currently filling. We use the C stack to make a stack of these
130 structures for nested calls to gdbtk commands that are invoked through
131 the gdbtk_call_wrapper mechanism. See that function for more details. */
133 extern gdbtk_result *result_ptr;
135 /* If you want to restore an old value of result_ptr whenever cleanups
136 are run, pass this function to make_cleanup, along with the value
137 of result_ptr you'd like to reinstate. */
138 extern void gdbtk_restore_result_ptr (void *);
140 /* GDB context identifier */
141 extern int gdb_context;
143 /* Internal flag used to tell callers of deprecated_ui_loop_hook
144 whether they should detach from the target. See explanations before
145 x_event and gdb_stop. */
146 extern int gdbtk_force_detach;
149 * These functions are used in all the modules of Gdbtk.
153 extern int Gdbtk_Init (Tcl_Interp * interp);
154 extern void gdbtk_stop_timer (void);
155 extern void gdbtk_start_timer (void);
156 extern void gdbtk_ignorable_warning (const char *, const char *);
157 extern void gdbtk_interactive (void);
158 extern int x_event (int);
159 extern int gdbtk_two_elem_cmd (char *, char *);
160 extern int target_is_native (struct target_ops *t);
161 extern void gdbtk_fputs (const char *, struct ui_file *);
162 extern struct ui_file *gdbtk_fileopen (void);
163 extern struct ui_file *gdbtk_fileopenin (void);
164 extern int gdbtk_disable_fputs;
165 extern ptid_t gdbtk_get_ptid (void);
168 extern void close_bfds ();
172 TclDebug (char level, const char *fmt,...);
174 /* A convenience macro for getting the demangled source names,
175 regardless of the user's mangling style. */
176 #define GDBTK_SYMBOL_SOURCE_NAME(symbol) \
177 (SYMBOL_DEMANGLED_NAME (symbol) != NULL \
178 ? SYMBOL_DEMANGLED_NAME (symbol) \
179 : DEPRECATED_SYMBOL_NAME (symbol))
182 /* gdbtk_add_hooks - add all the hooks to gdb. This will get called
183 by the startup code to fill in the hooks needed by core gdb. */
184 extern void gdbtk_add_hooks (void);
186 /* Initialize Insight */
187 extern void gdbtk_init (void);
189 /* Start Insight. Insight must have already been initialized with a call
191 extern void gdbtk_source_start_file (void);
192 #endif /* !_GDBTK_H */