[2/4] Save plain text in the source cache

Message ID CAMe9rOp265VtOB2j9T_TCgSTj3vXf8yheWR06fLffbKF2Ns89g@mail.gmail.com
State New, archived
Headers

Commit Message

H.J. Lu Oct. 23, 2019, 6:55 p.m. UTC
  On Tue, Oct 22, 2019 at 4:39 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Fri, Jul 26, 2019 at 6:34 AM Tom Tromey <tromey@adacore.com> wrote:
> >
> > Currently the source cache will only store highlighted text.  However,
> > there's no reason it could not also store plain text, when styling is
> > turned off.
> >
> > This patch makes this change.  This also simplifies the source cache
> > code somewhat.
> >
> > gdb/ChangeLog
> > 2019-07-26  Tom Tromey  <tromey@adacore.com>
> >
> >         * source-cache.c (source_cache::get_plain_source_lines):
> >         Remove "first_line" and "last_line" parameters.
> >         (source_cache::get_source_lines): Cache plain text.
> >         * source-cache.h (class source_cache)
> >         <get_plain_source_lines>: Update.
>
> This caused:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=25126
>
>

This works for my test case.
  

Comments

Andreas Schwab Oct. 24, 2019, 8:17 a.m. UTC | #1
On Okt 23 2019, H.J. Lu wrote:

> +    /* Clear the staled source cache.  */

s/staled/stale/

Andreas.
  
Tom Tromey Oct. 24, 2019, 6:59 p.m. UTC | #2
> This works for my test case.

Thank you.

This is ok with a ChangeLog entry, and with a fix for the typo that
Andreas pointed out.

Tom
  

Patch

diff --git a/gdb/symfile.c b/gdb/symfile.c
index f74c6de596..95dba37eee 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2518,6 +2518,9 @@  reread_symbols (void)
        automatically recreated by sym_read.  */
     free_objfile_separate_debug (objfile);

+    /* Clear the staled source cache.  */
+    forget_cached_source_info ();
+
     /* Remove any references to this objfile in the global
        value lists.  */
     preserve_values (objfile);