From c4e86dd4d087248e379b26bfdde8d6e3121a4bd9 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 22 Sep 2009 22:34:17 +0000 Subject: [PATCH] * source.c (forget_cached_source_info): Clear last_source_visited. (init_last_source_visited): Delete. (directory_command): Do not clear last_source_visited. Call forget_cached_source_info only if required. (unset_substitute_path_command, set_substitute_path_command): Call forget_cached_source_info. * mi/mi-cmd-env.c (mi_cmd_env_dir): Do not call init_last_source_visited. * defs.h (init_last_source_visited): Delete declaration. --- gdb/ChangeLog | 12 ++++++++++++ gdb/defs.h | 2 -- gdb/mi/mi-cmd-env.c | 1 - gdb/source.c | 14 ++++++-------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4b443ab..cb94bd2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2009-09-22 Daniel Jacobowitz + + * source.c (forget_cached_source_info): Clear last_source_visited. + (init_last_source_visited): Delete. + (directory_command): Do not clear last_source_visited. Call + forget_cached_source_info only if required. + (unset_substitute_path_command, set_substitute_path_command): Call + forget_cached_source_info. + * mi/mi-cmd-env.c (mi_cmd_env_dir): Do not call + init_last_source_visited. + * defs.h (init_last_source_visited): Delete declaration. + 2009-09-22 Tom Tromey PR gdb/10583: diff --git a/gdb/defs.h b/gdb/defs.h index f5127fd..94674dc 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -630,8 +630,6 @@ extern char *source_path; extern void init_source_path (void); -extern void init_last_source_visited (void); - /* From exec.c */ /* Take over the 'find_mapped_memory' vector from exec.c. */ diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index cbc9bdb..9f7cfc2 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -232,7 +232,6 @@ mi_cmd_env_dir (char *command, char **argv, int argc) for (i = argc - 1; i >= 0; --i) env_mod_path (argv[i], &source_path); - init_last_source_visited (); ui_out_field_string (uiout, "source-path", source_path); forget_cached_source_info (); diff --git a/gdb/source.c b/gdb/source.c index c39c0a6..7a2829b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -346,6 +346,8 @@ forget_cached_source_info (void) } } } + + last_source_visited = NULL; } void @@ -358,12 +360,6 @@ init_source_path (void) 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 @@ -382,11 +378,10 @@ directory_command (char *dirname, int from_tty) else { mod_path (dirname, &source_path); - last_source_visited = NULL; + forget_cached_source_info (); } if (from_tty) show_directories ((char *) 0, from_tty); - forget_cached_source_info (); } /* Add a path given with the -d command line switch. @@ -1883,6 +1878,8 @@ unset_substitute_path_command (char *args, int from_tty) if (from != NULL && !rule_found) error (_("No substitution rule defined for `%s'"), from); + + forget_cached_source_info (); } /* Add a new source path substitution rule. */ @@ -1921,6 +1918,7 @@ set_substitute_path_command (char *args, int from_tty) /* Insert the new substitution rule. */ add_substitute_path_rule (argv[0], argv[1]); + forget_cached_source_info (); } -- 2.7.4