start-sanitize-gdbtk
+Fri Apr 5 13:44:40 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * gdbtk.c (running_now): New global variable.
+ (gdb_cmd): Test it before executing any command.
+ (gdbtk_call_command): Set it when inferior is running.
+ * gdbtk.tcl (gdbtk_tcl_busy, gdbtk_tcl_idle): Enable and
+ disable interaction with command window's text appropriately.
+
Fri Apr 5 13:25:42 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* gdbtk.c (SIOCSPGRP, linux): If on Linux, undef SIOCSPGRP, since
if it is actually defined.
(gdb_setpgid): Use HAVE_SETPGID.
* ch-exp.c: Change include of <string.h> to "gdb_string.h".
- * c-exp.y: Ditto.
- * f-exp.y: Ditto.
- * m2-exp.y: Ditto.
- * c-exp.y: Include <ctype.h>.
- * serial.c: Ditto.
+ * c-exp.y, f-exp.y, m2-exp.y: Ditto.
+ * c-exp.y, serial.c: Include <ctype.h>.
* config/m68k/nm-news.h: Add typedef for pid_t which is
apparently missing from <sys/types.h>. Enclose entire
file in NM_NEWS_H ifndef and define when included.
* values.c (unpack_field_as_long, modify_field): Ditto.
* valops.c (value_assign, call_function_by_hand): Ditto.
* infcmd.c (do_registers_info): Ditto.
- * ser-tcp.c (tcp_open): Ditto
+ * ser-tcp.c (tcp_open): Ditto.
* remote.c (putpkt): Ditto.
* dcache.c (dcache_peek): Ditto.
* dcache.c (dcache_poke): Ditto.
out unused macro definition and variables.
* inftarg.c (proc_wait): Move from main.c to here, and make static.
* valprint.c (val_print_string): Change bufsize from int to unsigned.
- * main.c (wait.h): Include
+ * main.c (wait.h): Include.
* top.c (command_line_input): Remove unused variable "c".
* f-typeprint.c (f_type_print_varspec_prefix): Add missing enum
value TYPE_CODE_TYPEDEF to switch statement.
#endif
/* Handle for TCL interpreter */
+
static Tcl_Interp *interp = NULL;
/* Handle for TK main window */
+
static Tk_Window mainWindow = NULL;
static int x_fd; /* X network socket */
-/* This variable determines where memory used for disassembly is read from.
+/* This variable is true when the inferior is running. Although it's
+ possible to disable most input from widgets and thus prevent
+ attempts to do anything while the inferior is running, any commands
+ that get through - even a simple memory read - are Very Bad, and
+ may cause GDB to crash or behave strangely. So, this variable
+ provides an extra layer of defense. */
- If > 0, then disassembly comes from the exec file rather than the target
- (which might be at the other end of a slow serial link). If == 0 then
- disassembly comes from target. If < 0 disassembly is automatically switched
- to the target if it's an inferior process, otherwise the exec file is
- used.
- */
+static int running_now;
+
+/* This variable determines where memory used for disassembly is read from.
+ If > 0, then disassembly comes from the exec file rather than the
+ target (which might be at the other end of a slow serial link). If
+ == 0 then disassembly comes from target. If < 0 disassembly is
+ automatically switched to the target if it's an inferior process,
+ otherwise the exec file is used. */
static int disassemble_from_exec = -1;
const char *ptr;
FILE *stream;
{
+
if (result_ptr)
Tcl_DStringAppend (result_ptr, (char *)ptr, -1);
else
REGISTER_RAW_SIZE (regnum)) == 0)
return;
- /* Found a changed register. Save new value and return it's number. */
+ /* Found a changed register. Save new value and return its number. */
memcpy (&old_regs[REGISTER_BYTE (regnum)], raw_buffer,
REGISTER_RAW_SIZE (regnum));
return map_arg_registers (argc, argv, register_changed_p, NULL);
}
\f
-/* This implements the TCL command `gdb_cmd', which sends it's argument into
+/* This implements the TCL command `gdb_cmd', which sends its argument into
the GDB command scanner. */
static int
if (argc != 2)
error ("wrong # args");
+ if (running_now)
+ return TCL_OK;
+
execute_command (argv[1], 1);
bpstat_do_actions (&stop_bpstat);
gdb_flush (gdb_stdout); /* Sometimes error output comes here as well */
-/* In case of an error, we may need to force the GUI into idle mode because
- gdbtk_call_command may have bombed out while in the command routine. */
+ /* In case of an error, we may need to force the GUI into idle
+ mode because gdbtk_call_command may have bombed out while in
+ the command routine. */
Tcl_Eval (interp, "gdbtk_tcl_idle");
}
correctly.
Else, we're debugging a remote process, and should disassemble from the
- exec file for speed. However, this is no good if the target modifies it's
+ exec file for speed. However, this is no good if the target modifies its
code (for relocation, or whatever).
*/
char *arg;
int from_tty;
{
+ running_now = 0;
if (cmdblk->class == class_run)
{
+ running_now = 1;
Tcl_Eval (interp, "gdbtk_tcl_busy");
(*cmdblk->function.cfunc)(arg, from_tty);
Tcl_Eval (interp, "gdbtk_tcl_idle");
+ running_now = 0;
}
else
(*cmdblk->function.cfunc)(arg, from_tty);
}
proc gdbtk_tcl_busy {} {
+ if {[winfo exists .cmd]} {
+ .cmd.text configure -state disabled
+ }
if {[winfo exists .src]} {
.src.start configure -state disabled
.src.stop configure -state normal
}
proc gdbtk_tcl_idle {} {
+ if {[winfo exists .cmd]} {
+ .cmd.text configure -state normal
+ }
if {[winfo exists .src]} {
.src.start configure -state normal
.src.stop configure -state disabled
.src.down configure -state normal
.src.bottom configure -state normal
}
-
if {[winfo exists .asm]} {
.asm.stepi configure -state normal
.asm.nexti configure -state normal