[RFC] Fix source path lookup immediately after substitute-path

Joel Brobecker brobecker@adacore.com
Tue Sep 22 21:21:00 GMT 2009


Hi Daniel,

> Any thoughts on this patch?  May I include it in 7.0?

My only thought was that last_source_visited is really only useful
to print_source_lines_base, and it's used as a mechanism to prevent
a warning from being printed every time we try to print source lines
for the same file.  So I thought it might be cleaner if that global
was made static to print_source_lines_base.  However, this wouldn't
work as is, as it turns out this is also used as a cache for source
file lookup! I'm guessing this is only a side-effect of the original
intent.

I believe it would be cleaner to adjust the use of that variable
so as to make it static to print_source_lines_base, but this can
be addressed independently of your patch is someone is interested.
In the meantime, I think your patch is progress, and it seems fine
to put it in 7.0 as well.

> 2009-09-22  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	gdb/
> 	* 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.
-- 
Joel



More information about the Gdb-patches mailing list