aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtk.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-08-08 20:07:14 +0000
committerIan Lance Taylor <ian@airs.com>1997-08-08 20:07:14 +0000
commit9a2f9219c8c33e40dcc07051e79cde2c87aecd2d (patch)
tree88eed15b60a688935cd049181dd54a9cfbb6b804 /gdb/gdbtk.c
parentf1f6dd9c3992f0a8286432b242e1597c8b121064 (diff)
downloadgdb-9a2f9219c8c33e40dcc07051e79cde2c87aecd2d.zip
gdb-9a2f9219c8c33e40dcc07051e79cde2c87aecd2d.tar.gz
gdb-9a2f9219c8c33e40dcc07051e79cde2c87aecd2d.tar.bz2
* gdbtk.c (gdbtk_cleanup): New static function.
(gdbtk_init): Add gdbtk_cleanup as a final cleanup. Uncomment call to ide_initialize_paths. If we can't initialize the event system, set GDBTK_IDE to 0 in the Tcl interpreter. Create the ide_window_register and the ide_window commands. Initialize tk, itcl, and tix after initializing the IDE.
Diffstat (limited to 'gdb/gdbtk.c')
-rw-r--r--gdb/gdbtk.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index 0a8e460..2e0d543 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -1303,6 +1303,17 @@ tk_command_loop ()
Tk_MainLoop ();
}
+/* gdbtk_init installs this function as a final cleanup. */
+
+static void
+gdbtk_cleanup (dummy)
+ PTR dummy;
+{
+ Tcl_Finalize ();
+}
+
+/* Initialize gdbtk. */
+
static void
gdbtk_init ( argv0 )
char *argv0;
@@ -1339,20 +1350,13 @@ gdbtk_init ( argv0 )
if (Tcl_Init(interp) != TCL_OK)
error ("Tcl_Init failed: %s", interp->result);
- if (Tk_Init(interp) != TCL_OK)
- error ("Tk_Init failed: %s", interp->result);
-
- if (Itcl_Init(interp) == TCL_ERROR)
- error ("Itcl_Init failed: %s", interp->result);
-
- if (Tix_Init(interp) != TCL_OK)
- error ("Tix_Init failed: %s", interp->result);
+ make_final_cleanup (gdbtk_cleanup, NULL);
#ifdef IDE
- /* Initialize the Paths variable.
+ /* Initialize the Paths variable. */
if (ide_initialize_paths (interp, "gdb") != TCL_OK)
- return (TCL_ERROR);
- */
+ error ("ide_initialize_paths failed: %s", interp->result);
+
/* Find the directory where we expect to find idemanager. We ignore
errors since it doesn't really matter if this fails. */
libexecdir = Tcl_GetVar2 (interp, "Paths", "libexecdir", TCL_GLOBAL_ONLY);
@@ -1365,6 +1369,8 @@ gdbtk_init ( argv0 )
Tcl_AppendResult (interp, "can't initialize event system: ", errmsg,
(char *) NULL);
fprintf(stderr, "WARNING: ide_event_init_client failed: %s\n", interp->result);
+
+ Tcl_SetVar (interp, "GDBTK_IDE", "0", 0);
}
else
{
@@ -1376,16 +1382,37 @@ gdbtk_init ( argv0 )
if (ide_create_property_command (interp, h) != TCL_OK)
error ("ide_create_property_command failed: %s", interp->result);
+ if (ide_create_window_register_command (interp, h) != TCL_OK)
+ error ("ide_create_window_register_command failed: %s",
+ interp->result);
+
+ if (ide_create_window_command (interp, h) != TCL_OK)
+ error ("ide_create_window_command failed: %s", interp->result);
+
/*
if (ide_initialize (interp, "gdb") != TCL_OK)
error ("ide_initialize failed: %s", interp->result);
*/
+
+ Tcl_SetVar (interp, "GDBTK_IDE", "1", 0);
}
- Tcl_SetVar (interp, "GDBTK_IDE", "1", 0);
#else
Tcl_SetVar (interp, "GDBTK_IDE", "0", 0);
#endif /* IDE */
+ /* We don't want to open the X connection until we've done all the
+ IDE initialization. Otherwise, goofy looking unfinished windows
+ pop up when ILU drops into the TCL event loop. */
+
+ if (Tk_Init(interp) != TCL_OK)
+ error ("Tk_Init failed: %s", interp->result);
+
+ if (Itcl_Init(interp) == TCL_ERROR)
+ error ("Itcl_Init failed: %s", interp->result);
+
+ if (Tix_Init(interp) != TCL_OK)
+ error ("Tix_Init failed: %s", interp->result);
+
Tcl_CreateCommand (interp, "gdb_cmd", call_wrapper, gdb_cmd, NULL);
Tcl_CreateCommand (interp, "gdb_loc", call_wrapper, gdb_loc, NULL);
Tcl_CreateCommand (interp, "gdb_path_conv", call_wrapper, gdb_path_conv, NULL);