Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.102 diff -u -r1.102 defs.h --- defs.h 15 Oct 2002 02:16:51 -0000 1.102 +++ defs.h 10 Dec 2002 00:15:26 -0000 @@ -572,9 +572,15 @@ extern void mod_path (char *, char **); +extern void add_path (char *, char **, int); + extern void directory_command (char *, int); +extern char *source_path; + extern void init_source_path (void); + +extern void init_last_source_visited (void); extern char *symtab_to_filename (struct symtab *); Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.36 diff -u -r1.36 source.c --- source.c 24 Oct 2002 21:02:53 -0000 1.36 +++ source.c 10 Dec 2002 00:15:26 -0000 @@ -357,6 +357,12 @@ forget_cached_source_info (); } +void +init_last_source_visited (void) +{ + last_source_visited = NULL; +} + /* Add zero or more directories to the front of the source path. */ void @@ -387,6 +393,18 @@ void mod_path (char *dirname, char **which_path) { + add_path (dirname, which_path, 1); +} + +/* Workhorse of mod_path. Takes an extra argument to determine + if dirname should be parsed for separators that indicate multiple + directories. This allows for interfaces that pre-parse the dirname + and allow specification of traditional separator characters such + as space or tab. */ + +void +add_path (char *dirname, char **which_path, int parse_separators) +{ char *old = *which_path; int prefix = 0; @@ -403,9 +421,16 @@ struct stat st; { - char *separator = strchr (name, DIRNAME_SEPARATOR); - char *space = strchr (name, ' '); - char *tab = strchr (name, '\t'); + char *separator = NULL; + char *space = NULL; + char *tab = NULL; + + if (parse_separators) + { + separator = strchr (name, DIRNAME_SEPARATOR); + space = strchr (name, ' '); + tab = strchr (name, '\t'); + } if (separator == 0 && space == 0 && tab == 0) p = dirname = name + strlen (name); @@ -536,7 +561,8 @@ tinybuf[0] = DIRNAME_SEPARATOR; tinybuf[1] = '\0'; - /* If we have already tacked on a name(s) in this command, be sure they stay on the front as we tack on some more. */ + /* If we have already tacked on a name(s) in this command, be sure they stay + on the front as we tack on some more. */ if (prefix) { char *temp, c; Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.290 diff -u -r1.290 Makefile.in --- Makefile.in 5 Dec 2002 05:17:39 -0000 1.290 +++ Makefile.in 10 Dec 2002 00:15:26 -0000 @@ -168,12 +168,12 @@ # SUBDIR_MI_OBS = \ mi-out.o mi-console.o \ - mi-cmds.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \ + mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \ mi-cmd-disas.o \ mi-main.o mi-parse.o mi-getopt.o SUBDIR_MI_SRCS = \ mi/mi-out.c mi/mi-console.c \ - mi/mi-cmds.c \ + mi/mi-cmds.c mi/mi-cmd-env.c \ mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \ mi/mi-cmd-disas.c \ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c @@ -2526,6 +2526,10 @@ mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \ $(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c +mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \ + $(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h) $(inferior.h) \ + $(mi_getopt_h) $(environ_h) $(gdbcmd_h) $(top_h) + $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-env.c mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \ $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c