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

Message ID CAMe9rOpcS=r4uwFpOUHXteZ8_9rEw3v5ibQwuDizoBTPTYzEDw@mail.gmail.com
State New, archived
Headers

Commit Message

H.J. Lu Oct. 24, 2019, 10:46 p.m. UTC
  On Thu, Oct 24, 2019 at 11:59 AM Tom Tromey <tromey@adacore.com> wrote:
>
> > 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

This is what I checked in.

Thanks.
  

Patch

From 7b71fc971bd31b27cce8b883007ad467a7567499 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 24 Oct 2019 15:43:21 -0700
Subject: [PATCH] Call forget_cached_source_info to clear the stale source
 cache

Clear the stale source cache when re-reading symbols.

	PR gdb/25126
	* symfile.c (reread_symbols): Call forget_cached_source_info to
	clear the stale source cache.
---
 gdb/ChangeLog | 6 ++++++
 gdb/symfile.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 664000add4..8447542d8e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@ 
+2019-10-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gdb/25126
+	* symfile.c (reread_symbols): Call forget_cached_source_info to
+	clear the stale source cache.
+
 2019-10-24  Christian Biesinger  <cbiesinger@google.com>
 
 	* configure: Regenerate.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index f74c6de596..d2ed1ccacd 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 stale source cache.  */
+	  forget_cached_source_info ();
+
 	  /* Remove any references to this objfile in the global
 	     value lists.  */
 	  preserve_values (objfile);
-- 
2.21.0