* 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.
This commit is contained in:
parent
414f5cf3b2
commit
740895462f
1 changed files with 43 additions and 6 deletions
49
gdb/gdbtk.c
49
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue