This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Fix source path lookup immediately after substitute-path
On Tue, Sep 22, 2009 at 02:20:42PM -0700, Joel Brobecker wrote:
> 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.
last_source_visited is the direct cause of the problem I've fixed with
this patch. External circumstances, like "dir" or "cd" or "set
substitute-path" have to be able to invalidate the cache, so it has to
be accessible outside the function. Have I misunderstood?
--
Daniel Jacobowitz
CodeSourcery