aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1996-04-05 21:52:38 +0000
committerStan Shebs <shebs@codesourcery.com>1996-04-05 21:52:38 +0000
commitfda6fadc0dacdf23d85af0da8546e30ae8d79f73 (patch)
tree06042c51b20af6e5514d7646db26f6e8044856ad /gdb
parent6cc7365e2b682389efdaf16431189f7762805bc3 (diff)
downloadgdb-fda6fadc0dacdf23d85af0da8546e30ae8d79f73.zip
gdb-fda6fadc0dacdf23d85af0da8546e30ae8d79f73.tar.gz
gdb-fda6fadc0dacdf23d85af0da8546e30ae8d79f73.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/gdbtk.c41
-rw-r--r--gdb/gdbtk.tcl7
3 files changed, 47 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3527329..fa1942f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,12 @@
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
@@ -14,11 +22,8 @@ Thu Apr 4 20:16:55 1996 Fred Fish <fnf@cygnus.com>
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.
@@ -106,7 +111,7 @@ Fri Mar 29 21:39:56 1996 Fred Fish <fnf@cygnus.com>
* 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.
@@ -116,7 +121,7 @@ Fri Mar 29 21:39:56 1996 Fred Fish <fnf@cygnus.com>
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.
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index 75108ac..3c8cfbb 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -56,21 +56,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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;
@@ -138,6 +147,7 @@ gdbtk_fputs (ptr, stream)
const char *ptr;
FILE *stream;
{
+
if (result_ptr)
Tcl_DStringAppend (result_ptr, (char *)ptr, -1);
else
@@ -610,7 +620,7 @@ register_changed_p (regnum, argp)
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));
@@ -631,7 +641,7 @@ gdb_changed_register_list (clientData, interp, argc, argv)
return map_arg_registers (argc, argv, register_changed_p, NULL);
}
-/* 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
@@ -644,6 +654,9 @@ gdb_cmd (clientData, interp, argc, argv)
if (argc != 2)
error ("wrong # args");
+ if (running_now)
+ return TCL_OK;
+
execute_command (argv[1], 1);
bpstat_do_actions (&stop_bpstat);
@@ -690,8 +703,9 @@ call_wrapper (clientData, interp, argc, argv)
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");
}
@@ -843,7 +857,7 @@ gdb_disassemble (clientData, interp, argc, argv)
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).
*/
@@ -1080,11 +1094,14 @@ gdbtk_call_command (cmdblk, arg, from_tty)
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);
diff --git a/gdb/gdbtk.tcl b/gdb/gdbtk.tcl
index 148517f..60e1628 100644
--- a/gdb/gdbtk.tcl
+++ b/gdb/gdbtk.tcl
@@ -668,6 +668,9 @@ proc delete_breakpoint_tag {win line} {
}
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
@@ -692,6 +695,9 @@ proc gdbtk_tcl_busy {} {
}
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
@@ -703,7 +709,6 @@ proc gdbtk_tcl_idle {} {
.src.down configure -state normal
.src.bottom configure -state normal
}
-
if {[winfo exists .asm]} {
.asm.stepi configure -state normal
.asm.nexti configure -state normal