diff options
author | Ian Lance Taylor <ian@airs.com> | 1997-08-09 00:19:16 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1997-08-09 00:19:16 +0000 |
commit | 740895462f700e34f3a5959802f4631e11817c86 (patch) | |
tree | 746a545f9bc5a0f6dc335752fc2f6dd96836142b /gdb/gdbtk.c | |
parent | 414f5cf3b21f743f07a2666120c59e4d9e5378d7 (diff) | |
download | gdb-740895462f700e34f3a5959802f4631e11817c86.zip gdb-740895462f700e34f3a5959802f4631e11817c86.tar.gz gdb-740895462f700e34f3a5959802f4631e11817c86.tar.bz2 |
* gdbtk.c (gdbtk_init): Change gdbtk_lib_tmp and gdbtk_file to be
dynamically allocated, rather than fixed size. Pass "gdbtcl" to
ide_initialize_paths to match installed directory name. If IDE,
use auto_path to search for main.tcl.
* Makefile.in (install-only): If ENABLE_IDE, install from gdbtcl2
rather than gdbtcl.
Diffstat (limited to 'gdb/gdbtk.c')
-rw-r--r-- | gdb/gdbtk.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index 2e0d543..ae47ece 100644 --- a/gdb/gdbtk.c +++ b/gdb/gdbtk.c @@ -1319,7 +1319,7 @@ gdbtk_init ( argv0 ) char *argv0; { struct cleanup *old_chain; - char *lib, *gdbtk_lib, gdbtk_lib_tmp[1024],gdbtk_file[128]; + char *lib, *gdbtk_lib, *gdbtk_lib_tmp, *gdbtk_file; int i, found_main; struct sigaction action; static sigset_t nullsigmask = {0}; @@ -1354,7 +1354,7 @@ gdbtk_init ( argv0 ) #ifdef IDE /* Initialize the Paths variable. */ - if (ide_initialize_paths (interp, "gdb") != TCL_OK) + if (ide_initialize_paths (interp, "gdbtcl") != TCL_OK) error ("ide_initialize_paths failed: %s", interp->result); /* Find the directory where we expect to find idemanager. We ignore @@ -1502,7 +1502,8 @@ gdbtk_init ( argv0 ) else gdbtk_lib = GDBTK_LIBRARY; - strcpy (gdbtk_lib_tmp, gdbtk_lib); + gdbtk_lib_tmp = xstrdup (gdbtk_lib); + found_main = 0; /* see if GDBTK_LIBRARY is a path list */ lib = strtok (gdbtk_lib_tmp, GDBTK_PATH_SEP); @@ -1515,8 +1516,7 @@ gdbtk_init ( argv0 ) } if (!found_main) { - strcpy (gdbtk_file, lib); - strcat (gdbtk_file, "/main.tcl"); + gdbtk_file = concat (lib, "/main.tcl", (char *) NULL); if (access (gdbtk_file, R_OK) == 0) { found_main++; @@ -1525,7 +1525,42 @@ gdbtk_init ( argv0 ) } } while ((lib = strtok (NULL, ":")) != NULL); - + + free (gdbtk_lib_tmp); + +#ifdef IDE + if (!found_main) + { + /* Try finding it with the auto path. */ + + static const char script[] ="\ +proc gdbtk_find_main {} {\n\ + global auto_path GDBTK_LIBRARY\n\ + foreach dir $auto_path {\n\ + set f [file join $dir main.tcl]\n\ + if {[file exists $f]} then {\n\ + set GDBTK_LIBRARY $dir\n\ + return $f\n\ + }\n\ + }\n\ + return ""\n\ +}\n\ +gdbtk_find_main"; + + if (Tcl_GlobalEval (interp, (char *) script) != TCL_OK) + { + fputs_unfiltered (Tcl_GetVar (interp, "errorInfo", 0), gdb_stderr); + error (""); + } + + if (interp->result[0] != '\0') + { + gdbtk_file = xstrdup (interp->result); + found_main++; + } + } +#endif + if (!found_main) { fputs_unfiltered_hook = NULL; /* Force errors to stdout/stderr */ @@ -1560,6 +1595,8 @@ gdbtk_init ( argv0 ) error (""); } + free (gdbtk_file); + discard_cleanups (old_chain); } |