From: Ian Lance Taylor Date: Fri, 8 Aug 1997 20:07:14 +0000 (+0000) Subject: * gdbtk.c (gdbtk_cleanup): New static function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a2f9219c8c33e40dcc07051e79cde2c87aecd2d;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3de0cbe7ed6..4c02291ce0e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ start-sanitize-gdbtk -Fri Aug 8 15:19:14 1997 Ian Lance Taylor +Fri Aug 8 15:59:24 1997 Ian Lance Taylor + + * 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. * configure.in (tixdir): Update for cygwin32 case for Tcl 8.0. * configure: Rebuild. diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index 0a8e460c868..2e0d543c6d4 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);