aboutsummaryrefslogtreecommitdiff
path: root/gdb/source-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/source-cache.c')
-rw-r--r--gdb/source-cache.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 0650768..7016476 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -162,9 +162,8 @@ source_cache::ensure (struct symtab *s)
{
if (m_source_map[i].fullname == fullname)
{
- /* This should always hold, because we create the file
- offsets when reading the file, and never free them
- without also clearing the contents cache. */
+ /* This should always hold, because we create the file offsets
+ when reading the file. */
gdb_assert (m_offset_cache.find (fullname)
!= m_offset_cache.end ());
/* Not strictly LRU, but at least ensure that the most
@@ -240,7 +239,11 @@ source_cache::ensure (struct symtab *s)
m_source_map.push_back (std::move (result));
if (m_source_map.size () > MAX_ENTRIES)
- m_source_map.erase (m_source_map.begin ());
+ {
+ auto iter = m_source_map.begin ();
+ m_offset_cache.erase (iter->fullname);
+ m_source_map.erase (iter);
+ }
return true;
}