aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>1998-11-13 00:31:39 +0000
committerJim Ingham <jingham@apple.com>1998-11-13 00:31:39 +0000
commit2aae63977c4c7e40e634cea18c83157a2a0aae7d (patch)
treedf2024ae51cd07b9cd9251b77d1ad139404b99b3
parente9928289d385ad46df6f97d5a997489041493e42 (diff)
downloadgdb-2aae63977c4c7e40e634cea18c83157a2a0aae7d.zip
gdb-2aae63977c4c7e40e634cea18c83157a2a0aae7d.tar.gz
gdb-2aae63977c4c7e40e634cea18c83157a2a0aae7d.tar.bz2
Thu Nov 12 15:20:15 1998 Jim Ingham <jingham@cygnus.com>
* console.tcl (complete): I added the ability to pass from_tty from gdb_cmd to the underlying commands. Pass 1 when the command is invoked from the console. * interface.tcl (gdbtk_tcl_tstart, gdbtk_tcl_tstop): Run the src window's do_tstop method rather than manipulating the widgets by hand. * src.tcl (build_win): Redo the packing so that the function combobox doesn't push all the other combo-boxes off the screen if it has a very long function name in it. * srcbar.tcl (do_tstop): Added a mode that just changes the GUI, which can be called from console hooks. * srctextwin.tcl: Fixed some bugs I introduced in setting breakpoints in the assembly & mixed mode windows. Dropped the notion of joint breakpoint images for lines that have breakpoints of two separate types. Too fragile. Also added the "dont_change_appearance" flag, used in the continue_to_here method to tell the GUI not to reflect the temporary disabling of all the breakpoints. * toolbar.tcl (insert_buttons): Added a little more error-checking. Thu Nov 12 15:20:15 1998 Jim Ingham <jingham@cygnus.com> * gdbtk-cmds.c (gdb_cmd): Added an optional second argument to the gdb_cmd, which is from_tty. This is passed to the gdb command parser. It is 0 by default, and the console window passes 1. * gdbtk-cmds.c: moved disassemble_from_exec from gdbtk.c to gdbtk-cmds.c with all the other link-var'ed variables * gdbtk-hooks.c (gdbtk_trace_find): Only run the hook functions if we are called from_tty. * gdbtk-hooks.c (gdbtk_trace_start_stop): Set the trace buttons from a trace_start_command callback rather than doing it as a special case in gdb_cmd. * tracepoint.c (tstart_command, tstop_command): Add call to trace_start_stop_hook here.
-rw-r--r--gdb/ChangeLog-gdbtk19
-rw-r--r--gdb/gdbtk-cmds.c23
-rw-r--r--gdb/gdbtk-hooks.c87
-rw-r--r--gdb/gdbtk.c8
-rw-r--r--gdb/tracepoint.c5
-rw-r--r--gdb/tracepoint.h1
6 files changed, 97 insertions, 46 deletions
diff --git a/gdb/ChangeLog-gdbtk b/gdb/ChangeLog-gdbtk
index fede2f3..b152676 100644
--- a/gdb/ChangeLog-gdbtk
+++ b/gdb/ChangeLog-gdbtk
@@ -1,3 +1,22 @@
+Thu Nov 12 15:20:15 1998 Jim Ingham <jingham@cygnus.com>
+
+ * gdbtk-cmds.c (gdb_cmd): Added an optional second argument to the
+ gdb_cmd, which is from_tty. This is passed to the gdb command
+ parser. It is 0 by default, and the console window passes 1.
+
+ * gdbtk-cmds.c: moved disassemble_from_exec from gdbtk.c to gdbtk-cmds.c
+ with all the other link-var'ed variables
+
+ * gdbtk-hooks.c (gdbtk_trace_find): Only run the hook functions if
+ we are called from_tty.
+
+ * gdbtk-hooks.c (gdbtk_trace_start_stop): Set the trace buttons
+ from a trace_start_command callback rather than doing it as a
+ special case in gdb_cmd.
+
+ * tracepoint.c (tstart_command, tstop_command): Add call to
+ trace_start_stop_hook here.
+
Wed Nov 4 12:41:42 1998 Jim Ingham <jingham@cygnus.com>
* gdbtk-cmds.c (gdb_set_bp_addr): Pass the type, enable & thread
diff --git a/gdb/gdbtk-cmds.c b/gdb/gdbtk-cmds.c
index 4197426..8fb81ef 100644
--- a/gdb/gdbtk-cmds.c
+++ b/gdb/gdbtk-cmds.c
@@ -152,6 +152,11 @@ extern struct breakpoint *set_raw_breakpoint (struct symtab_and_line sal);
extern void set_breakpoint_count (int);
extern int breakpoint_count;
+/* This variable determines where memory used for disassembly is read from.
+ * See note in gdbtk.h for details.
+ */
+int disassemble_from_exec = -1;
+
/*
* Declarations for routines exported from this file
@@ -330,6 +335,10 @@ Gdbtk_Init (interp)
Tcl_LinkVar (interp, "gdb_context_id",
(char *) &gdb_context,
TCL_LINK_INT | TCL_LINK_READ_ONLY);
+
+ /* Determine where to disassemble from */
+ Tcl_LinkVar (gdbtk_interp, "disassemble-from-exec", (char *) &disassemble_from_exec,
+ TCL_LINK_INT);
Tcl_PkgProvide(interp, "Gdbtk", GDBTK_VERSION);
return TCL_OK;
@@ -666,13 +675,23 @@ gdb_cmd (clientData, interp, objc, objv)
int objc;
Tcl_Obj *CONST objv[];
{
-
+ int from_tty = 0;
+
if (objc < 2)
{
Tcl_SetStringObj (result_ptr->obj_ptr, "wrong # args", -1);
return TCL_ERROR;
}
+ if (objc == 3)
+ {
+ if (Tcl_GetBooleanFromObj (NULL, objv[2], &from_tty) != TCL_OK) {
+ Tcl_SetStringObj (result_ptr->obj_ptr, "from_tty must be a boolean.",
+ -1);
+ return TCL_ERROR;
+ }
+ }
+
if (running_now || load_in_progress)
return TCL_OK;
@@ -688,7 +707,7 @@ gdb_cmd (clientData, interp, objc, objv)
load_in_progress = 1;
}
- execute_command (Tcl_GetStringFromObj (objv[1], NULL), 1);
+ execute_command (Tcl_GetStringFromObj (objv[1], NULL), from_tty);
if (load_in_progress)
{
diff --git a/gdb/gdbtk-hooks.c b/gdb/gdbtk-hooks.c
index 09f9ca0..833edef 100644
--- a/gdb/gdbtk-hooks.c
+++ b/gdb/gdbtk-hooks.c
@@ -85,6 +85,7 @@ static void gdbtk_create_tracepoint PARAMS ((struct tracepoint *));
static void gdbtk_delete_tracepoint PARAMS ((struct tracepoint *));
static void gdbtk_modify_tracepoint PARAMS ((struct tracepoint *));
static void gdbtk_trace_find PARAMS ((char *arg, int from_tty));
+static void gdbtk_trace_start_stop PARAMS ((int, int));
static void gdbtk_create_breakpoint PARAMS ((struct breakpoint *));
static void gdbtk_delete_breakpoint PARAMS ((struct breakpoint *));
static void gdbtk_modify_breakpoint PARAMS ((struct breakpoint *));
@@ -162,7 +163,7 @@ gdbtk_add_hooks(void)
delete_tracepoint_hook = gdbtk_delete_tracepoint;
modify_tracepoint_hook = gdbtk_modify_tracepoint;
trace_find_hook = gdbtk_trace_find;
-
+ trace_start_stop_hook = gdbtk_trace_start_stop;
pc_changed_hook = pc_changed;
selected_frame_level_changed_hook = gdbtk_selected_frame_changed;
context_hook = gdbtk_context_change;
@@ -464,34 +465,13 @@ gdbtk_call_command (cmdblk, arg, from_tty)
if (cmdblk->class == class_run || cmdblk->class == class_trace)
{
- /* HACK! HACK! This is to get the gui to update the tstart/tstop
- button only incase of tstart/tstop commands issued from the console
- We don't want to update the src window, so we need to have specific
- procedures to do tstart and tstop
- Unfortunately this will not display errors from tstart or tstop in the
- console window itself, but as dialogs.*/
-
- if (!strcmp(cmdblk->name, "tstart") && !No_Update)
- {
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstart");
- (*cmdblk->function.cfunc)(arg, from_tty);
- }
- else if (!strcmp(cmdblk->name, "tstop") && !No_Update)
- {
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstop");
- (*cmdblk->function.cfunc)(arg, from_tty);
- }
- /* end of hack */
- else
- {
- running_now = 1;
- if (!No_Update)
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_busy");
- (*cmdblk->function.cfunc)(arg, from_tty);
- running_now = 0;
- if (!No_Update)
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_idle");
- }
+ running_now = 1;
+ if (!No_Update)
+ Tcl_Eval (gdbtk_interp, "gdbtk_tcl_busy");
+ (*cmdblk->function.cfunc)(arg, from_tty);
+ running_now = 0;
+ if (!No_Update)
+ Tcl_Eval (gdbtk_interp, "gdbtk_tcl_idle");
}
else
(*cmdblk->function.cfunc)(arg, from_tty);
@@ -712,14 +692,49 @@ gdbtk_trace_find (arg, from_tty)
{
Tcl_Obj *cmdObj;
- Tcl_GlobalEval (gdbtk_interp, "debug {***In gdbtk_trace_find...}");
- cmdObj = Tcl_NewListObj (0, NULL);
- Tcl_ListObjAppendElement (gdbtk_interp, cmdObj,
- Tcl_NewStringObj ("gdbtk_tcl_trace_find_hook", -1));
- Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewStringObj (arg, -1));
- Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewIntObj(from_tty));
- Tcl_GlobalEvalObj (gdbtk_interp, cmdObj);
+ if (from_tty) {
+ Tcl_GlobalEval (gdbtk_interp, "debug {*** In gdbtk_trace_find, from_tty is true}");
+ cmdObj = Tcl_NewListObj (0, NULL);
+ Tcl_ListObjAppendElement (gdbtk_interp, cmdObj,
+ Tcl_NewStringObj ("gdbtk_tcl_trace_find_hook", -1));
+ Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewStringObj (arg, -1));
+ Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewIntObj(from_tty));
+ Tcl_GlobalEvalObj (gdbtk_interp, cmdObj);
+ } else {
+ Tcl_GlobalEval (gdbtk_interp, "debug {*** In gdbtk_trace_find, from_tty is false}");
+ }
+}
+
+/*
+ * gdbtk_trace_start_stop
+ *
+ * This is run by the trace_start_command and trace_stop_command.
+ * The START variable determines which, 1 meaning trace_start was run,
+ * 0 meaning trace_stop was run.
+ *
+ */
+
+static void
+gdbtk_trace_start_stop (start, from_tty)
+ int start;
+ int from_tty;
+{
+ Tcl_Obj *cmdObj;
+ if (from_tty) {
+ Tcl_GlobalEval (gdbtk_interp, "debug {*** In gdbtk_trace_start, from_tty is true}");
+ cmdObj = Tcl_NewListObj (0, NULL);
+ if (start)
+ Tcl_ListObjAppendElement (gdbtk_interp, cmdObj,
+ Tcl_NewStringObj ("gdbtk_tcl_tstart", -1));
+ else
+ Tcl_ListObjAppendElement (gdbtk_interp, cmdObj,
+ Tcl_NewStringObj ("gdbtk_tcl_tstop", -1));
+ Tcl_GlobalEvalObj (gdbtk_interp, cmdObj);
+ } else {
+ Tcl_GlobalEval (gdbtk_interp, "debug {*** In gdbtk_trace_startd, from_tty is false}");
+ }
+
}
static void
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index d1760a6..d051cac 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -110,11 +110,6 @@ int gdb_context = 0;
*/
int running_now;
-/* This variable determines where memory used for disassembly is read from.
- * See note in gdbtk.h for details.
- */
-int disassemble_from_exec = -1;
-
/* This variable holds the name of a Tcl file which should be sourced by the
interpreter when it goes idle at startup. Used with the testsuite. */
static char *gdbtk_source_filename = NULL;
@@ -491,9 +486,6 @@ gdbtk_init ( argv0 )
add_com ("tk", class_obscure, tk_command,
"Send a command directly into tk.");
- Tcl_LinkVar (gdbtk_interp, "disassemble-from-exec", (char *) &disassemble_from_exec,
- TCL_LINK_INT);
-
/* find the gdb tcl library and source main.tcl */
gdbtk_lib = getenv ("GDBTK_LIBRARY");
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index b0b2d33..d6ebdb4 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1748,6 +1748,9 @@ trace_start_command (args, from_tty)
set_tracepoint_num (-1);
set_traceframe_context(-1);
trace_running_p = 1;
+ if (trace_start_stop_hook)
+ trace_start_stop_hook(1, from_tty);
+
}
else
error ("Trace can only be run on remote targets.");
@@ -1766,6 +1769,8 @@ trace_stop_command (args, from_tty)
if (strcmp (target_buf, "OK"))
error ("Bogus reply from target: %s", target_buf);
trace_running_p = 0;
+ if (trace_start_stop_hook)
+ trace_start_stop_hook(0, from_tty);
}
else
error ("Trace can only be run on remote targets.");
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 2dc13bd..fc3e9a5 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -115,6 +115,7 @@ void (*create_tracepoint_hook) PARAMS ((struct tracepoint *));
void (*delete_tracepoint_hook) PARAMS ((struct tracepoint *));
void (*modify_tracepoint_hook) PARAMS ((struct tracepoint *));
void (*trace_find_hook) PARAMS ((char *arg, int from_tty));
+void (*trace_start_stop_hook) PARAMS ((int start, int from_tty));
struct tracepoint *get_tracepoint_by_number PARAMS ((char **));
int get_traceframe_number PARAMS ((void));